How do you run the snap gp tool on each feature, one at a time, with definition queries?

4053
5
05-17-2016 12:29 PM
MichaelHeirendt
New Contributor

I'd like to snap a whole lot of points (water meters) to an endpoint (water laterals). In the table, there is a matching "Parcel ID" field that I am thinking can be used as a definition query for both features, and then running the snap tool for just that meter, and having the script iterate this process through all meters. Any thoughts on this process or a good way to go about this?

0 Kudos
5 Replies
DanPatterson_Retired
MVP Emeritus

well it will snap to the edge, endpoint or vertices of the other feature, but there is no mention in the Environments section to indicate whether selections will be honoured.  Given that the process modify existing feature classes, I would give it a test on a small copy of both layers to see if the selections (via select by attributes) or definition queries will do the job

Snap—Help | ArcGIS for Desktop

MichaelHeirendt
New Contributor

Thanks for your reply. I ended up using model builder to iterate through row selections by the parcel ID, and use the ID as the definition query for the snapping environment. Seems to work alright, but it creates a feature layer out of the definition query, so right at about 500 records it starts to take about 30 seconds per snap, then Arcmap usually crashes shortly after. Any opinions on options that would use less memory within the model?

0 Kudos
DanPatterson_Retired
MVP Emeritus

are you deleting the query and/or the layer after you have created the snap?  I suspect, the layer or memory references to it, are being kept

0 Kudos
MichaelHeirendt
New Contributor

I suspect you are correct, however, I am not sure that you can delete a feature layer seeing as how it is just a reference to a feature class as opposed to a physical copy. I attached an image of what I have to give you an idea of what's going on.

Model.JPG

0 Kudos
DanPatterson_Retired
MVP Emeritus

In modelbuilder, I don't know, I suppose the defn query is made somewhere in there and access to it in modelbuilder might not be possible.  a copy of the exported script might help, just make sure your model parameters are in the correct order before saving... unless someone that uses MB alot has some idea how memory is managed in that enironment.

0 Kudos