mapbox / mapbox/tilelive-bridge

Mapnik.VectorTile.painted() doesn't do what we want it to do

Open
#85 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
63
Forks
40
PR merge metrics
No merged PRs in 30d

Description

TLDR

mapnik.VectorTile.painted() doesn't do exactly what we want any longer, which means our check here isn't as strong as expected.

Problem

When generating tiles and copying them (via tilelive), we have a check in the pyramid tiling scheme to ensure we should continue rendering and copying child tiles. This check is here.

There are some situations where we could have a datasource (geojson for this example) that has data in the z0 tile, but has no data in the z1 tile. This means tilelive-bridge checks vtile.painted() and sets the x-tilelive-contains-data header to false. If this is set to false, the rest of the tiling scheme is skipped, resulting in no tiles.

Node Mapnik essentially uses empty() to check for painted tiles via mapnik-vector-tile, which is exactly what we don't want. Right now this z1 tile returns false for empty(), which tells tilelive to stop the copy process and skip the rest of the tiles. We need to know if the source data is there (even if tile features are not) so we can continue to tile the children.

Why

Currently, I'm unable to figure out why a datasource in Node Mapnik would add data at z0 but not at z1.

Solution

A couple solutions come to mind:

  • [time intensive] improve the painted(), solid(), and empty() architecture in Mapnik. cc @flippmoke
  • [quick fix, potentially at CPU expense] don't check for painted/empty tiles since we already have a relatively solid pyramid built via mapnik-omnivore and spherical mercator. This either means we always set x-tilelive-contains-data to true or remove the if statement in tilelive.

cc @rclark @GretaCB @springmeyer @yhahn @flippmoke @captainbarbosa

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the check in tilelive-bridge/index.js and the child-tile decision in tilelive/lib/stream-pyramid.js, then compare their behavior with empty() in mapnik-vector-tile/src/vector_tile_tile.hpp. Determine how source data should be detected when a tile has no features, and choose between fixing the painted/solid/empty architecture or removing the check. Done means child tiling continues for the described z0/z1 case without incorrectly reporting the tile as empty.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
backend
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.