Efficient way to check if a vertex coincides with another feature's vertex

420
4
01-12-2019 06:58 AM
ZoltanSzecsei
New Contributor II

Hi,

I'm looking for an efficient way to see which vertices in one feature touch a vertex in another feature.

I will then need to edit the vertex of the "first" feature.

Problem:

I have a large polygon feature set that I will select some polygons from.

For each polygon in this subset, I need to check if any of its vertices coincide with that of another (Polygon or polyline) feature in (two) other feature classes.

If a vertex in this first subset touches a vertex in the 2nd or 3rd feature class, I will have to edit that vertex and update that polygon (in the first feature set).

I have tried crawling through the vertices of the subset and using SelectLayerByLocation by coverting the XYZ of the vertex for use in the Select statement, but this yields unreliable results.

I have tried using various SelectLayerByLocation with various "Intersect" or "WITHIN A DISTANCE 3D" cluses but the problem here is that I cannot (find a way to) release my latest selection without clearing the full selection (because I work with sub-selections from all 3 feature classes)

I'm wondering if the way to go is to create a point file from the first subset, adding the vertex's OID and sequence information as attributes to the resulting point, and then JOINing by location the points to the 2nd and 3rd feature sets. Where there is a JOIN, they touch, where not, they don't touch.

Then using this information to delete and manually rebuild the polygons in this first subset.

All this complication is because I cannot find a way to see if anything exists at a particular XYZ location.

Comments/thoughts welcome.

Thanks in advance,

Zoltan

0 Kudos
4 Replies
JoshuaBixby
MVP Esteemed Contributor

Are you using ArcGIS Pro or ArcMap?  Are you running this within the application, either as a script tool or the interactive Python window, or outside of the application using the bundled Python interpreter?  I ask because Select Layer By Attribute/Location behavior varies a bit between Pro and ArcMap and from within the application and outside.

0 Kudos
ZoltanSzecsei
New Contributor II

Argis 10.4

Using Pycharm IDE and running it in the IDE

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

The Z component of your question complicates the solution since several of ArcGIS Desktop's geoprocessing tools flatten datasets for processing.  I believe Intersect doesn't recognize 3D (or Z if you will), but Spatial Join does recognize 3D (haven't tested personally).

I will have to think this one over a bit more.

ZoltanSzecsei
New Contributor II

Actually, XY snap is all I need for this exercise as it is also interesting to me if the vertices are same XY but Z is different

I think you've hit the nail on the head for me.

My Z tolerance is not as tight as my XY tolerance, so that is why the command below is/was erratic in its hits:

   pg = arcpy.PointGeometry(vert, crs, True)

   arcpy.SelectLayerByLocation_management("hgt_feats","WITHIN_A_DISTANCE_3D",pg, 0.050, 'NEW_SELECTION')

I've just removed the '_3D' and I am getting many more hits now.

I've also examined some test features and the Z values do drift >5cm as I had in my search radius.

Let me work with this, because I think you've just solved it for me.

Big thanks, and chat soon (I'll report back on this list if the SelectLayer as used above still seems dodgy).

Regards,

Zoltan

0 Kudos