Terrastories / terrastories

Terrastories is a geostorytelling application for mapping, managing and sharing place-based stories.
https://terrastories.app
MIT License
319 stars 157 forks source link

[Map] adjust Tippecanoe settings to optimally render spatial data #206

Closed rudokemper closed 5 years ago

rudokemper commented 5 years ago

In the current tilebuilder/tileserver setup, Terrastories seems to have an issue in rendering data points and labels: only a very small selection shows up on the map.

For example, This branch being developed for Terrastories as a SaaS has generic world countries and cities point content. This is what it looks like styled in Mapbox Studio:

capture1

With our setup, it looks like this. Note that there is exclusively one point and label showing up: Inuvik in the far north of Canada.

capture2

As you start to zoom, some more labels do show up, but the selection continues to be incomplete. In this screenshot, Cleveland and Columbus should be visible as well:

capture3

We should see if it's possible finetune Terrastories so that it can properly render shapefiles akin to Mapbox Studio.

rudokemper commented 5 years ago

Update: this may be related to Tippecanoe zoom limits instead of Tileserver:

https://docs.mapbox.com/help/troubleshooting/adjust-tileset-zoom-extent/ https://stackoverflow.com/questions/42772343/tippecanoe-dont-drop-any-points https://github.com/mapbox/tippecanoe

EDIT: Confirmed. Figuring out an optimal setup now.

rudokemper commented 5 years ago

By adjusting the tippecanoe configuration, I was able to generate the points as desired for the above map:

image

This was done by adding -zg and -Bg as parameters to the line of script in convert.sh. It reads:

tippecanoe --read-parallel -zg -Bg -o /data/mbtiles/basic.mbtiles $(find /tmp/line -type f | grep .json$)

This is what these parameters are.

-zg or --maximum-zoom=g: Guess what is probably a reasonable maxzoom based on the spacing of features. -B zoom or --base-zoom=zoom: Base zoom, the level at and above which all points are included in the tiles (default maxzoom). If you use -Bg, it will guess a zoom level that will keep at most 50,000 features in the densest tile. You can also specify a marker-width with -Bgwidth to allow fewer features in the densest tile to compensate for the larger marker, or -Bfnumber to allow at most number features in the densest tile.

However, for the Matawai instance, this seems to cut off data; the following lines are shown when running the tilebuilder script:

Choosing a maxzoom of -z8 for features about 1030 feet (314 meters) apart Choosing a maxzoom of -z11 for resolution of about 129 feet (39 meters) within features Choosing a base zoom of -B0 to keep 20071 features in tile 0/0/0. tile 7/44/62 size is 617925 with detail 12, >500000 tile 8/88/124 size is 743667 with detail 12, >500000

And we can confirm that some of the data is not showing up in certain tile areas.

image

So, while the problem has been properly diagnosed, we need to figure out an optimal tippecanoe setting that will work for most of our use cases.

mirandawang commented 5 years ago

closing for now; moving details to issue google doc