Select to view content in your preferred language

Iterate through point features as origin for fishnet

858
1
11-04-2010 10:55 AM
MichaelKieser
Deactivated User
I am trying to iterate through a polygon feature class, select the point feature within the polygon (note: there is only one point per polygon) as the origin to a fishnet, and then clip the fishnet at the polygon boundary.

The iteration of the polygon feature class, selecting the point feature within the polygon, and clipping the fishnet are all fairly easy. But how does one go about making the point feature as the origin to the fishnet?

I have tried the "Get Value Field" to get the northing and easting from fields in the point feature class, but how does one get the values into the Point Origin X/Y?
1 Reply
ChrisSnyder
Honored Contributor
Basically all you do then would be to make the point's x,y coordinate the lower-left coordinate of the fishnet. For example:

dsc = gp.describe(dnrMgmtAllFC) #this is a polygon FC that the fishnet must cover
xMin = dsc.extent.xmin #THIS WOULD BE THE X COORDINATE OF YOUR POINT
yMin = dsc.extent.ymin #THIS WOULD BE THE Y COORDINATE OF YOUR POINT
xMax = dsc.extent.xmax
yMax = dsc.extent.ymax
bufferWidth = 1 #Buffer width expands the the extent of the fishnet by that many map units (to make sure it extends past DNR lands a bit)
numberOfRows = 6
numberOfColumns = 6
fishnetLine1FC = fgdbPath + "\\fishnet_line1"
gp.CreateFishnet_management(fishnetLine1FC, str(xMin - bufferWidth) + " " + str(yMin - bufferWidth), str(xMin - bufferWidth) + " " + str(yMin), "0", "0", numberOfRows, numberOfColumns, str(xMax + bufferWidth) + " " + str(yMax + bufferWidth), "NO_LABELS", ""); showGpMessage()
fishnet1FC = fgdbPath + "\\fishnet_poly1"
gp.FeatureToPolygon_management(fishnetLine1FC, fishnet1FC, "", "", ""); showGpMessage()
gp.Delete_management(fishnetLine1FC, ""); showGpMessage()
0 Kudos