1

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.

closed as off-topic by PolyGeo Oct 14 '17 at 9:14

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions seeking help to debug/write/improve code must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Providing a clear problem statement and evidence of a code attempt will help others to help you. See: How to create a Minimal, Complete, and Verifiable example." – PolyGeo
If this question can be reworded to fit the rules in the help center, please edit the question.

5

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")
  • densify only divide borders of polygon . – BBG_GIS May 17 '11 at 9:45
6

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)

........pointGeometryList.append(pointGeometry)

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.

  • +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.