Python and Snapping

514
4
05-02-2013 09:40 AM
JeffPapirtis
New Contributor III
I am working on a python Add-in and in order to have the proper output I need to be able to snap to the corner point of a land grid.  I have not been able to find any functions within arcpy that allows for this to happen.

I need the same functionality found on the snapping toolbar in order to get the precise X,Y Coordinates as input into my python script.

Has anyone tried this before or is anyone aware of this functionality within arcpy?

Thanks,
Tags (2)
0 Kudos
4 Replies
markdenil
Occasional Contributor III
what is the nature of your "land grid"?
Is it a fishnet of intersecting lines?
Is it a polygon FC with tiled rectangles?

If they are polygons, the polygon's extent object will tell you the lower left corner coordinates of the square you have selected,
and will even return a point object for the lowerLeft (or whichever corner you fancy as 'origin')

If the grid a fishnet of lines, you can create intersection points by using Planarize Lines,
then collecting the four closest points to your cursor click.
These four will be the corners of the grid sqaure.
Some math comparing the point coordinate values will give to the corner you want.
0 Kudos
JeffPapirtis
New Contributor III
Thanks for the quick reply.  The Land grid is made up of polygons.  I had not thought about selecting the feature to obtain its extent.  Thanks for the idea!
0 Kudos
ChrisSnyder
Regular Contributor III
How about using a "FeatureSet". This is a data type that you can set up in a toolbox that allows you to interactivly create point, lines or polygons as input to a toolbox, which is very cool. Does not need to be an AddIn. Snapping is enabled, so that when you are creating your point or whatever in the map frame, your cursor snaps to other layers.
0 Kudos
ChrisSnyder
Regular Contributor III
How about using a "FeatureSet". This is a data type that you can set up in a toolbox that allows you to interactivly create point, lines or polygons as input to a toolbox, which is very cool. Does not need to be an AddIn. Snapping is enabled, so that when you are creating your point or whatever in the map frame, your cursor snaps to other layers.
0 Kudos