-
Notifications
You must be signed in to change notification settings - Fork 900
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
ENH: quantize polygons/snap shapes to grid? #1727
Comments
On top of this it would be nice to also expose |
Great if On Both rescale the geometries to a grid, round coordinates to the nearest integer, and then re-transform the coordinates back to the original space. I haven't yet dug into dropping adjacent points, but that should be pretty immediate from here. My concern with topojson was mattijn/topojson#110, which I have yet to reproduce successfully. I do know that I haven't seen this behavior as I have implemented these methods in |
It is not. The point of |
Is your feature request related to a problem?
In spatial applications, "quantization" entails removing the significant digits from coordinates and removing the duplicated points. This is often an analogue to simplification: quantization makes it easy to find vertices to remove, and snaps the geometries to a grid.
Quantization (as I understand it) is functionally the same as
ST_SnapToGrid
in postgis.Describe the solution you'd like
I'm thinking of a
quantize
method on aGeoSeries
that mirrors the functionality ofsimplify
API breaking implications
There should be no API breakage here.
Describe alternatives you've considered
pygeos
may be the reasonable place to implement the actual algorithm or wrap existing GEOS (xref discussion in #1724), since that's a natural analogue to . Regardless of where the implementation lives, it'd be good to expose it on theGeoSeries
.Additional context
An example implementation without
pygeos.snap
& without de-duplication:n_bins
An implementation of this would be:
which yields results like this:
The text was updated successfully, but these errors were encountered: