-
-
Notifications
You must be signed in to change notification settings - Fork 27
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
Investigate the effects of low topoquantization epsilon values #110
Comments
Thanks for your interest in this issue. At this place in the docs https://mattijn.github.io/topojson/example/settings-tuning.html#prequantize I've worked out the quantization process in 1D. I see you have linked this issue to another at the geopandas repo. Im still figuring out what is going wrong here. Maybe your usecase is a smaller reproducible example. |
Found a use-case small enough for debugging: import topojson as tp
import geopandas as gpd
gdf = gpd.read_file(gpd.datasets.get_path("naturalearth_lowres"))
gdf = gdf[gdf.name.isin(['France', 'Belgium', 'Netherlands'])]
tp.Topology(data=gdf).toposimplify(4).topoquantize(500).to_alt(color='properties.name:N') |
Thanks again for commenting in order to bring this issue on my radar again! This issue is fixed by #116, linestrings which can become points due filtering of repeating coordinates that were not written back to the linestring. After delta-encoding the start-coordinates of quantised linestrings got mixed up with this case. During debugging I found out that the overal bbox is not regenerated after simplification and quantization. Filled #117 for this. |
I've to admit it's not fast. import topojson as tp
import geopandas as gpd
import matplotlib.pyplot as plt
brexit = gpd.read_file('/Users/mattijnvanhoek/Downloads/brexit.gpkg')
topo = tp.Topology(brexit)
q100 = topo.topoquantize(100).to_gdf()
q250 = topo.topoquantize(250).to_gdf()
q500 = topo.topoquantize(500).to_gdf()
f, ax = plt.subplots(1, 3, figsize=(10, 10))
q100.plot(ax=ax[0])
q250.plot(ax=ax[1])
q500.plot(ax=ax[2]) Would indeed be good to investigate routes for quantization through pygeos as well, like in this comment geopandas/geopandas#1727 (comment) |
If you're game for a numba implementation, I'm sure that'd help accelerate things? I prefer working on the topojson-style data structure, and numba could work well with ragged arrays stored as lists of tuples. |
This is discussed previously with @Casyfill and might be a good method indeed to improve speed further. It might be very simple to get good results, but I've never tried it. Let me open a new issue so it can be tracked. |
Given the following behaviour:
Are these artifacts explainable by the principles of
quantization
or is there a certain process that needs improvement?Help is welcome!
The text was updated successfully, but these errors were encountered: