Using DbGeometry and Entity Framework to work with Sql Geometry types. User can draw a line that can run outside of a given polygon. my validation traps that. I correct this by clipping the line to be the intersection of both geometries.

And that is working. however, the result of that intersection still trips up my validation (i assume by one coincident point).

I either need to shorten that line by a tiny amount or redesign my validation rule(which uses Shape.Within() to determine if the line is outside the polygon). I have solved this issue with polygons in the past by buffering them -0.00001 but that doesn't appear to be an option for lines

1 Answer 1


I sort of solved this by buffering the polygon out a very slight amount as i was never able to negatively buffer the line inward. this solved the validation issue as the polygon boundary and the line end point were no longer coincident

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.