-
Notifications
You must be signed in to change notification settings - Fork 105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Polygon intersection and containment #193
Comments
Thank you @atombender for opening this issue :) This library effectively contains three parts: a Go-friendly representation for geometry types, a set of packages to serialize and deserialize those types, and packages (like The fix depends on your requirements:
|
Thanks for responding! After I wrote the comment, I went hunting for bindings to either GEOS or GDAL, and I ended up on this decent maintained fork of an old, abandoned set of bindings to GEOS, which seems like an absolutely solid library. Your support for WKT/WKB was a life-saver. So now I read GeoSON into go-geom, then convert to GEOS to perform operations like the ones I need. Having to go through WKB is not optimal, but fortunately this is not on a fast path, and it looks like it would be feasible to write a translator if we should need more speed. My only complaint with this solution is the fact that the GEOS library is now a build dependency. Geometry/geography libs for Go are lacking. I poked through so many pure Go libraries that provide a lot of trivial functionality (such as reading and writing GeoJSON), but fall short when it comes to the actual hard stuff. If you ever feel like sitting down and making the |
@atombender You could give |
Or better, go-geos now provides this functionality in Go using the battle-tested GEOS library. Note that GDAL is for data formats and GEOS is for geometric operations like polygon intersection and containment. |
I'm looking for a way to use this library to check, using Cartesian coordinates:
I'm not seeing any exported functions for doing this. Is there any support for it, or should I look somewhere else?
From what I can tell, checking if a point is contained in a polygon can be accomplished this way:
Or? I'm not too familiar with rings or if this is how they're intended to be used. Either way, such a function would be a useful addition to this library, I think.
The text was updated successfully, but these errors were encountered: