import arcpy
def XY2POINT(in_Table,saved_Layer):print('执行xy转要素点')print('导入表: %s' % in_Table)x_coords = "选X坐标的字段"y_coords = "选Y坐标的字段"out_Layer = 'layer'print('输出表: %s' % out_Layer)spRef = 4490print('"x字段":%s,"y字段":%s,空间参考:%s' % (x_coords, y_coords, spRef))arcpy.MakeXYEventLayer_management(in_Table, x_coords, y_coords, out_Layer, spRef)num = arcpy.GetCount_management(out_Layer)print('表内要素个数: %s' % num)arcpy.FeatureToPoint_management(out_Layer, saved_Layer)print('输出点要素: %s' % saved_Layer)
if __name__ = '__main__':in_Table = r"E:\work\******\test.xlsx\Sheet1$"saved_Layer = r"E:\work\******\firesations.shp"XY2POINT(in_Table,saved_Layer)