I would like to create a script tool that takes 3 parameters in ArcMap:

  1. Google maps coordinate (e.g. -33.876846, 151.215117)
  2. text string
  3. text string

The coordinates would define the XY geometry, and the two strings would be the attributes for the new point ("Report" and "Hyperlink") I am limited to ArcMap 10.0, so I can't use the .da module. I think I have the geometry figured out, but not the attributes.

import arcpy

mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd)[0]

#for use in ArcGIS script - gets input coordinates
coordsIn = arcpy.GetParameterAsText(0)

#get Report name
Report = arcpy.GetParameterAsText(1)

#get Report Hyperlink
Hyperlink = arcpy.GetParameterAsText(2)

#delimits coordinates by comma and places them in list "coordsplit"
coordsplit = coordsIn.split(",");

#defines coordinates
X = float(coordsplit[0])
Y = float(coordsplit[1])

#assign feature class to edit
featureClass = "D:\\data\\testing\\testing.gdb\\ReportsGDA"

#create insert cursor
rowInserter = arcpy.InsertCursor(featureClass)

#create update cursor
rowUpdater = arcpy.UpdateCursor(featureClass)

#assign coordinates to point object
pointGeometry = arcpy.Point(X,Y)

# Use the insert cursor to put the point object
# in the feature class
newPoint = rowInserter.newRow()
newPoint.Shape = pointGeometry

#update attributes
for feature in rowUpdater:
    if feature.Report == None:
        feature.Report = Report
        feature.Hyperlink = Hyperlink

2 Answers 2


You stated in a comment in PolyGeo's answer that you have the geometry working. Updating the attribute is very similar. You want to update the row object before inserting it.

Remove the last for loop and update the code prior to this:

# Use the insert cursor to put the point object
# and attributes in the feature class
newPoint = rowInserter.newRow()
newPoint.Shape = pointGeometry
newPoint.Report = Report
newPoint.Hyperlink = Hyperlink
  • Works perfectly, much appreciated Mar 3, 2015 at 5:59

Your code does not look like it could write a geometry at 10.0 because, as @MichaelMiles-Stimson says, SHAPE@ tokens are an arcpy.da (10.1+) construct.

The approach to this that I would use at 10.0 is:

  1. Write the geometries into a feature class by using code like that on the Writing Geometries help page that @MichaelMiles-Stimson gave a link to.
  2. Use an insert cursor to write a table with a common field and the attributes
  3. Use Join Fields to join the attributes onto the features
  • thanks for the input. I have the geometry working, but still not sure how to work the attributes. I can get it working with a for loop (as in gis.stackexchange.com/questions/60458/…), but this just overwrites all of the attributes in the feature class with the same values. Feb 20, 2015 at 4:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.