Skip to content

Instantly share code, notes, and snippets.

@NPS-ARCN-CAKN
Last active December 17, 2015 19:29
Show Gist options
  • Save NPS-ARCN-CAKN/1cafe310c87f3af38e6c to your computer and use it in GitHub Desktop.
Save NPS-ARCN-CAKN/1cafe310c87f3af38e6c to your computer and use it in GitHub Desktop.
ArcPy: Access feature class data
import arcpy
import numpy
input = r"C:\Work\Waypoints.shp"
arr = arcpy.da.FeatureClassToNumPyArray(input, ('ident', 'Latitude', 'Longitude'))
for row in arr:
ident = row["ident"]
lat = row["Latitude"]
lon = row["Longitude"]
sql = "INSERT INTO MyTable(WaypointName,Lat,Lon) VALUES('" + str(ident) + "'," + str(lat) + "," + str(lon) + ");"
print sql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment