go-spatial / geom

Geometry interfaces to help drive interoperability within the Go geospatial community
MIT License
168 stars 37 forks source link

Point within Polygon? #107

Open alienatorZ opened 4 years ago

alienatorZ commented 4 years ago

I dont see a function for finding whether a point is within a polygon. Am I missing it, or can I request it be added to the API.

Thanks

gdey commented 4 years ago

You are not missing anything. Yes, you can request it to be added. What are you looking for the function to do? Should it support more than just polygons. A detail write up would be great!

Thank you.

gdey commented 4 years ago

@ear7h pointed out: https://godoc.org/github.com/go-spatial/geom/planar/intersect#Ring.ContainsPoint

Which may be a good starting point for an interface for something like this.

alienatorZ commented 4 years ago

Yes I was thinking a function such as: Polygon.Contains(geom Geometry) bool {}

That way if any part of the passed in geometry was within the polygon it would cause the function to return true or else false.

alienatorZ commented 4 years ago

Or you could say the passed in geometry would have to be fully in to return true which is probably better.

missinglink commented 3 years ago

FYI https://github.com/paulmach/orb/blob/master/planar/contains.go