-
-
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
Release topojson v1.0 #44
Comments
Btw: this was the end of my summer of code. Tomorrow back to work.. |
Hi @mattijn, I just came across this repo. Really good work! Instead of the PR mentioned above, I would like to see it done using your package, so I am checking with you to see whether it is a safe (stable) option yet. https://github.com/calvinmetcalf/topojson.py seem to be unmaintained and with a fraction of options. If you need a hand pushing the last bit, let me know, I might find a moment. |
Thanks @martinfleis, for your comment. There are still a few open issues to solve before releasing a 1.0 version. A bit of pushing is definitely helpful. Potential integration with geopandas might be that push! :) Besides the defined issues, there are two things to be aware of to find out if this repo is useful for integration: I never compared this repo to the unmaintained https://github.com/calvinmetcalf/topojson.py repo in terms of speed and correctness, but the start principles differs. This repo builds on shapely and numpy, where the other is solely using python. 2. Toposimplify
This would also make it possible to have an improved interactive experience, since the exact So to answer your question, its close to stable, but not yet ready. |
Thank you!
For Douglas-Pecker algorithm, epsilon is in the same units as geometry, that is why there is so big difference between degrees and meters. I like this animation from Wikipedia, which is clear on what is epsilon. Epsilon in this case is the half of the width of the blue buffer around the line connecting furthest points. If the point happens to be within the buffer (i.e. its distance from the line connecting furthest points is smaller than epsilon), it gets deleted. For Visvalingam-Whyatt algorithm, epsilon is different, aerial value, so it will be larger. VW constructs triangles between the points along the line and removes those points, which are associated (are on the top of) with the triangle which area is smaller than epsilon. I hope it is clear. In both cases, values are depending on the actual units. It is then complicated to guess default value. That is likely the reason why shapely's simplify does not have default and user has to specify it. That might be good way for
I'll need to explore your code to say anything meaningful on speed during topology creation. One speedup could be possible in here, if we used vectorized pygeos version of simplify instead of loop through shapely. Lines 529 to 541 in 238fb29
GeoPandas is close to 0.8 release, so I would like include toposimplify (geopandas/geopandas#1387) in 0.9. There's some time to release topojson 1.0 in the meantime. |
The % is mapshaper is the number of retained points. I don't think there's any option how to do that using GEOS and |
Thanks for the detailed feedback. Very much appreciated. As you have noticed I started to push the last bits of open issues. In coming week I'll distill the above mentioned points in separate issues, and create a new release candidate version ( In the period after will continue to improve the documentation of the manual and inline docstrings. No new features will be introduced and if no apparent bugs appear the |
Just a small followup. After your question I decided to write up the explanation of algorithms here http://martinfleischmann.net/line-simplification-algorithms/ |
That is great @martinfleis! Really nice explanation of differences between the two epsilons. Love it. I created #73, which provides an example of the time-expensive bottleneck I mentioned above. |
@martinfleis, as you might have noticed, I've released version |
@mattijn I've seen, the performance gain is great. What are the remaining bottlenecks now? I did not have a chance to actually see what has changed. |
Compared to If no big issues appear I'll release |
I'll try to find a moment to play with the master in the following days.
It will be essentially what is in |
I've checked with geopandas master including pygeos and all still works: import geopandas as gpd
import topojson as tp
print(f'geopandas: {gpd.__version__}\ntopojson: {tp.__version__}')
gpd.options.use_pygeos = True
gdf = gpd.read_file(gpd.datasets.get_path("naturalearth_lowres"))
topo = tp.Topology(gdf.query('continent == "Africa"')).toposimplify(4)
topo.to_svg()
topo.to_gdf().head(1)
Regarding pygeos related things to investigate:
|
Indeed, everything should work, there's a compatibility layer in GeoPandas.
Look at new |
Current version on PyPi is
v1.0rc4
.Things left to do for release
v1.0
:The text was updated successfully, but these errors were encountered: