mapbox / tippecanoe

Build vector tilesets from large collections of GeoJSON features.
BSD 2-Clause "Simplified" License
2.72k stars 432 forks source link

polygon mesh #575

Open andrewharvey opened 6 years ago

andrewharvey commented 6 years ago

We already have --detect-shared-borders:

-ab or --detect-shared-borders: In the manner of TopoJSON, detect borders that are shared between multiple polygons and simplify them identically in each polygon. This takes more time and memory than considering each polygon individually.

How about a mesh option like https://github.com/topojson/topojson-client#mesh which extracts shared borders from polygons and creates a single line?

This is useful when creating a map of parcel boundaries as lines only, where you don't need the original polygon as it avoids overlapping lines which can improve how it renders visual. Not sure if it would decrease or increase the file size.

e-n-f commented 6 years ago

It would be relatively straightforward to pull out the detected edges into new features, but I don't feel like this necessarily belongs in Tippecanoe, since it seems like more of a data analysis task than a tiling task. It seems like it might be better as a preprocessor. Do you think it makes more sense as part of tiling?

andrewharvey commented 6 years ago

I agree, it's something that can be done outside of tippecanoe. I was thinking doing it part of tippecanoe would be more efficient since it's already detecting the shared borders when using -ab, but if it'll add too much blot I understand.

e-n-f commented 6 years ago

I'm really hesitant to add any new features relating to polygons right now because so many things are going to have to change for cross-tile geometry merging in the new vector tile spec. But I can look into this after things settle back down.

e-n-f commented 6 years ago

OK, you can try this in https://github.com/mapbox/tippecanoe/pull/576 with --extract-borders.

andrewharvey commented 6 years ago

With the au/qld parcels from zoom 12-16 it comes to a 1.1GB tileset without --extract-borders and 950MB with --extract-borders.

For me it's more the rendering benefits this brings from drawing a single line instead of multiple overlapping lines.

e-n-f commented 6 years ago

I'm glad this was useful for you. In the long run I still think it makes more sense to do as a preprocessing step on the source data (using TopoJSON, for instance) rather than as part of tiling. (Or perhaps as part of the large-scale spatial join tool that is still in the back of my mind, since detecting shared borders could be one aspect of finding feature overlap.)

stevage commented 5 years ago

I was actually going to request a very different but also very related feature, which is to treat all polygons as line features. I was primarily thinking of the size benefit - presumably all the tiles that are entirely within a single polygon would no longer have to exist, so the end result would be a lot smaller.

But I also figured that could be done by a pre-processor, so... shrug