Saturday, 21 November 2015

arcgis 10.0 - Creating shapefile from lat/long values using ArcPy?



How can I create a shapefile using Python in ArcGIS 10?


I have lat & long.


From this I need Python code which will create a shapefile in ArcGIS Desktop 10.



Answer



For creating points:


ptList =[[20.000,43.000],[25.500, 45.085],[26.574, 46.025], [28.131, 48.124]]
pt = arcpy.Point()
ptGeoms = []
for p in ptList:

pt.X = p[0]
pt.Y = p[1]
ptGeoms.append(arcpy.PointGeometry(pt))

arcpy.CopyFeatures_management(ptGeoms, r"C:\Temp\test.shp")

It will return a message like this:



No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...