Quantcast
Channel: Question and Answer » arcpy
Viewing all articles
Browse latest Browse all 767

How to write point geometries with arcpy instead of gp syntax?

$
0
0

Can someone help me fix some code that simply writes points into a featureclass? It used to work in the older gp. syntax, but I’m having difficulties rewriting it in arcpy for ArcGIS 10.0. In this example it was meant to create a 100m grid of points.

desc = arcpy.Describe("Grid_Extent")
Ext1 = str(desc.Extent)
Ext2 = Ext1.split(' ')
SXMin = int (float(Ext2[0]))
SXStart = int (float(Ext2[0]))
SYMin = int (float(Ext2[1])) 
SXMax = int (float(Ext2[2]))
SYMax = int (float(Ext2[3]))

XMin = SXMin
XMax = SXMax
YMin = SYMin
YMax = SYMax
print str(YMin) + "    " + str(YMax)
print str(XMin) + "    " + str(XMax)
while YMin < YMax:
  while XMin < XMax:
     cur = arcpy.InsertCursor("Grid_100")
     pnt = arcpy.Point()
     pnt.x = XMin
     pnt.y = YMin
     feat = cur.newRow()
     cur.insertRow(feat)
     XMin = XMin + 100
  XMin = SXStart
  YMin = YMin + 100
del cur

Viewing all articles
Browse latest Browse all 767

Trending Articles