1

From comments at Determining if point on boundary using shapely? I am creating an ArcPy equivalent Q&A to that one which was answered for shapely. Quoting the asker of the original question:

I'm new to Python, and I want to test if a certain point lies ON the (boundary) of a polygon - not inside, not outside, just if it's on the boundary. The points and polygon already defined

polygon = [(3, 2), (5, 1), (7, 2), (8, 6), (9, 7), (11, 6), (10, 4), (12, 2), (15, 2), (16, 5), (19, 7), (18, 11), (14, 12), (11, 9), (5, 9), (2, 6)] 
Point_X = 14
Point_Y = 12

this point should be a boundary. How can I do that?

asked Jan 16, 2018 at 4:55

1 Answer 1

1

As commented by @Vince on the original question:

Due to the imprecision associated with floating-point values, far fewer points which are "on" a line will actually be reported as such in real-world situations. If you want to test this, your code needs to use ArcPy functions to assemble Polygon and PointGeometry objects, so that you can cast the Polygon to a line (using Geometry.boundary()) and test for point intersection with Geometry.contains(). Be sure to specify an appropriate SpatialReference.

answered Jan 16, 2018 at 4:56
2
  • 1
    I'd used distance to method. That way a tolerance can be introduced. Commented Jan 16, 2018 at 5:05
  • I second @FelixIP, I've always used within a distance for points on lines. You could use Near/Generate Near Table if you have an advanced license but I find it much easier to buffer the boundary then select the points that intersect the buffer (Geometry.boundary().buffer(Some_very_small_distance)) Commented Jan 16, 2018 at 5:33

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.