felt / tippecanoe

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

Polygon grid features shifting with --coalesce-fraction-as-needed #151

Closed wisesselo closed 1 year ago

wisesselo commented 1 year ago

I'm trying to coalesce a grid of hexagons. My issue is that some of the coalesced polygons are shifting vertically. I confirmed this by checking feature ids before and after coalescing. I read in the docs that "the polygons to which nested polygons are coalesced may not necessarily be the immediately enclosing features." I'm not sure if this is what I'm observing, or if there is a way to control this. Any help is appreciated!

This is the command that resulted in the screenshots below: tippecanoe -o file.mbtiles filenotnull.json --force --maximum-zoom=8 --coalesce-fraction-as-needed

Other things I tried: --include=_solar_1_mean --accumulate-attribute=_solar_1_mean:mean --accumulate-attribute=_solar_1_mean:max

Last zoom level before coalescing occurs: z1 First zoom level where coalescing occurs: z2 Further zoomed out: z3

e-n-f commented 1 year ago

Thanks for the report. The --coalesce-fraction-as-needed coalescing coalesces features by quadkey or Hilbert curve adjacency rather than actual two-dimensional adjacency, which I think probably explains the problem you are seeing. Please try the --hilbert option, which should generally be a better approximation to actual adjacency. If that isn't enough, I can try to look into how to improve it further.

wisesselo commented 1 year ago

Thank you. Using --hilbert improves it significantly for my use case. Here is a before and after: hilbert3