Comments (5)
I'm fine with changing the default from shared_coords=True
to shared_coords=False
(edit: done by #190).
Did you play with the prequantize
parameter? Its applying a type of normalisation on range, see docs: https://mattijn.github.io/topojson/example/settings-tuning.html#prequantize. It will improve the quality of the topology if the input geometry is messy.
Current default is 1e6
, but I like to change the default to 1e5
(edit: done by #189). But one can play with this value (any integer number is valid) to see what is best for each situation.
from topojson.
Regarding the section about coverages in geos you mentioned:
* A polygon is coverage-valid if:
*
* * The polygon interior does not intersect the interior of other polygons.
* * If the polygon boundary intersects another polygon boundary, the vertices
* and line segments of the intersection match exactly.
As you probably know, gaps and slivers are a big issue in GIS data in general. As long as not all borders between polygons/features are explicitly matched to each other including by having matching vertices everywhere the features touch having a perfect topology is impossible due to rounding errors,... Just doing a conversion from one file format to another can create gaps because of a conversion from double to discrete numbers,... so data that seemed properly matched/snapped will change to gappy/slivery data.
So, even though the current implementations using intersections doesn't need all vertices to be there, once you get into more complex data the places where a point was snapped to the middle of a line without adding the snap-vertex to the neighbour, some of those cases won't be properly "topologized". The only structural way to get perfect results all the time and with all operations (this is not limited to creating a topology) is that data is perfectly matched...
So, if I understand correctly they (geos developers) are in first focussing on tools to cleanup the data... (which is something I've been hoping for to appear for a long time) and which is useful for many more cases than topology. Once the data is cleaned, it will be a lot easier to create topologies from it.
The data I'm working with at the moment, and that I've been using to test, is "happy day scenario" data. It is the result of a polygonize of raster data, so all intersections between data are perfectly matched: every segment is either perfectly horizontal or perfectly vertical, so no gaps and slivers in the data. Most data out there isn't like that though :-(...
from topojson.
So, as long as the shared_coords=True, is faster, an alternative approach could be to change the default from shared_coords=True to shared_coords=False, as this will give the best results for most datasets, but if the user is sure the data is already 100% cleaned/prepared (~coverage-valid), he can use shared_coords=False to get the bit of extra performance.
Mind: when I was adding tests, I first started by running them both using shared_coords=False and shared_coords=True. But, in the first 2 cases where I did this this resulted in what seemed to be a bug at first sight in the shared_coords=True path. So, I might be wrong, I was focused on shared_coords=False, but at first sight there are still some bugs there... that are best fixed if the option is kept alive.
from topojson.
this resulted in what seemed to be a bug at first sight in the shared_coords=True path
Also observed a, what seems like, bug with shared_coords=True
(new default in master is shared_coords=False
):
import geopandas
from topojson import Topology
nybb_path = geopandas.datasets.get_path("nybb")
data = geopandas.read_file(nybb_path)
topo = Topology(
data=data, prequantize=200, shared_coords=True
)
topo.to_alt()
from topojson.
Did you play with the
prequantize
parameter? Its applying a type of normalisation on range, see docs: https://mattijn.github.io/topojson/example/settings-tuning.html#prequantize. It will improve the quality of the topology if the input geometry is messy. Current default is1e6
, but I like to change the default to1e5
(edit: done by #189). But one can play with this value (any integer number is valid) to see what is best for each situation.
No I haven't. I turned it off because the data I've used till now didn't need any cleaning. So I don't have any opionion on what a good value would be...
from topojson.
Related Issues (20)
- Conversion to Typology object causes overlaps HOT 5
- tp.Topology.to_json(pretty=True) doesn't handle None correctly. (Doens't convert None to null) HOT 1
- Converting GeoJSON FeatureCollection to TopoJSON HOT 1
- BUG: `Topology.to_gdf` should keep the original index HOT 2
- holes in multipolygons are lost by simplification HOT 4
- Deprecation warning for shapely 2.0 HOT 3
- Wrong topologies/arcs being created? HOT 7
- Creating a topology for data without junctions and shared_coords=False, prequantize=False gives error
- Bug: polygons that entirely fill islands in another polygon are often not dedupped
- Linestrings that follow the same path but where one contains extra redundant points are not deduplicated
- enh: include features that are possible with shapely 2.0
- tests failing, natural earth dataset changed HOT 2
- RuntimeWarning: invalid value encountered in cast HOT 3
- IndexError: pop index out of range when instanciating Topology with a list of GeoDataFrame HOT 10
- Coordinates not reported correctly on Multipoint with only one point HOT 2
- Excessive memory usage with prequantization enabled HOT 5
- serialize_as_geojson outputs invalid GeoJSON HOT 2
- Topojson >=1.6 requires Python >=3.8, but there is no guard against Python <3.8 HOT 2
- Feature: Use geojson feature/geometry id if exists HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from topojson.