I have a polygon shapefile. I want to create points at an interval of 0.125 decimal degrees in this polygon.

How can I create a script with python in ArcGIS 10 to automate the process of create points?

The start point is the south-west corner and the end point is north-east of the polygon.


If you're interested in additional vertices along your polygon feature, you can use the built-in Densify function:

import arcpy
arcpy.Densify_edit("polygon.shp", "DISTANCE", "0.125")
| improve this answer | |
  • densify only divide borders of polygon . – BBG_GIS May 17 '11 at 9:45

You already have your answer; you have your start X/Y and finish X/Y, so you have a range and the distance between the points

Calculate the amount of points you will create per axis

xRange = maxX - minX

yRange= maxY - minY

xloop = int(xRange /0.125)+1

yloop = int(yRange /0.125)+1

Create your point variables

pointGeometryList = []

point = arcpy.Point()

Set the start point

point.Y = minY

point.X = minX

for y in range(0,yLoop):
....for x in range(0,xLoop):

add a point to your point array

........pointGeometry = arcpy.PointGeometry(point)


move along the x axis and create a point per 0.125 degrees

........point.X = point.X + 0.125

once the xloop has finished, reset X

....point.X = minX

and move the yaxis up 0.125

....point.Y = point.Y + 0.125

create the point feature

arcpy.CopyFeatures_management(pointGeometryList, "c:/geometry/a.gdb/points")

Please note, this si off the top of my head and completely untested, so I am not responsible for it if you use it. However, that should, I think, start you off.

You will have created points outside of the polygon, as I have ensured the MBR is properly represented; you may want to erase features outside of the polygon afterwards.

| improve this answer | |
  • +1 Whether it works as-is or not, it's a clear, complete account of the algorithm and of the steps needed to make it work in ArcGIS. – whuber May 19 '11 at 16:00

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