arcpy 는 display as XY 를 실현 하여 표를 arcmap 에 펼 칩 니 다.

1107 단어 python

       ,    ,       
# MakeXYLayer.py
# Description: Creates an XY layer and exports it to a layer file

# import system modules 
import arcpy
from arcpy import env

# Set environment settings
env.workspace = "C:/data"
 
try:
    # Set the local variables
    in_Table = "firestations.dbf"
    x_coords = "POINT_X"
    y_coords = "POINT_Y"
    z_coords = "POINT_Z"
    out_Layer = "firestations_layer"
    saved_Layer = r"c:\output\firestations.lyr"
 
    # Set the spatial reference
    spRef = r"Coordinate Systems\Projected Coordinate Systems\Utm\Nad 1983\NAD 1983 UTM Zone 11N.prj"
 
    # Make the XY event layer...
    arcpy.MakeXYEventLayer_management(in_Table, x_coords, y_coords, out_Layer, spRef, z_coords)
 
    # Print the total rows
    print arcpy.GetCount_management(out_Layer)
 
    # Save to a layer file
    arcpy.SaveToLayerFile_management(out_Layer, saved_Layer)
 
except:
    # If an error occurred print the message to the screen
    print arcpy.GetMessages()

좋은 웹페이지 즐겨찾기