protomaps / basemaps

Basemap PMTiles generation and cartographic styles for OpenStreetMap data and more
https://maps.protomaps.com/
Other
378 stars 49 forks source link

Some state (region) label points are dropped at some early zooms #89

Closed nvkelso closed 1 year ago

nvkelso commented 1 year ago

This is especially bad at zooms 2 and 3 in the USA.

Likely part of the label thinning for places layer. Perhaps that should be limited to locality and neighbourhood features only?

Zoom 2:

image

Zoom 3:

image
nvkelso commented 1 year ago

Consider moving the sortKey transform to post processing step...

nvkelso commented 1 year ago

Consider also varying the number of kept features by zoom (or limiting the size of the grid by zoom) – and limiting to just locality kinds.

Right now we do a combination:

  feat.setPointLabelGridSizeAndLimit(13, 64, 4); // each cell in the 4x4 grid can have 4 items

But we could split that apart so the Size is constant but the limit varies by zoom:

    feat.setPointLabelGridLimit(LOCALITY_GRID_LIMIT_ZOOM_FUNCTION);

or

    feat.setPointLabelGridSize(LOCALITY_GRID_SIZE_ZOOM_FUNCTION);

Where LOCALITY_GRID_LIMIT_ZOOM_FUNCTION might look like:

private static final ZoomFunction<Number> LOCALITY_GRID_LIMIT_ZOOM_FUNCTION = ZoomFunction.fromMaxZoomThresholds(Map.of(
    7, 2,
    8, 4,
    9, 6,
    10, 8
    11, 10
  ), 0);

With the zoom breaks adapted from Tilezen, where no thinning is done from zoom 0 to 6 inclusive (as Natural Earth is pre-compiled).

nvkelso commented 1 year ago

It's unclear if you can limit the label grid to apply to certain features versus all features in a layer (eg just locality kinds).

bdon commented 1 year ago

label grid applies to all features in a layer. another option is just making buckets way bigger at low zooms and then doing some post-processing