Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support writing MultiPoint into vector tiles #719

Closed
daniel-j-h opened this issue May 8, 2024 · 1 comment
Closed

Support writing MultiPoint into vector tiles #719

daniel-j-h opened this issue May 8, 2024 · 1 comment

Comments

@daniel-j-h
Copy link
Contributor

It looks like tilemaker supports points but only points and not multipoints.

Storing points in vector tiles is highly inefficient due to the heavy vector tile message encoding that's needed to store two numbers for a point. I found a historic ticket on this going into more details: mapbox/vector-tile-spec#35

It would be great if tilemaker could write out MultiPoints where possible to

  • make tiles smaller where many points are used, and
  • to improve decoding and rendering efficiency in clients such as maplibre

For MultiPoints the vector tile geometry type is Point with multiple MoveTo commands.

Vector tile spec on MultiPoints

The vector tile decoding library used e.g. in Maplibre

MultiPoint read and write support in vtzero

MultiPoint writing usage example in vtzero

Tilemaker writing out a point

  • if (oo.oo.geomType == POINT_) {
    vtzero::point_feature_builder fbuilder{vtLayer};
    if (sharedData.config.includeID && oo.id) fbuilder.set_id(oo.id);
    LatpLon pos = source->buildNodeGeometry(oo.oo.objectID, bbox);
    pair<int,int> xy = bbox.scaleLatpLon(pos.latp/10000000.0, pos.lon/10000000.0);
    fbuilder.add_point(xy.first, xy.second);
    oo.oo.writeAttributes(attributeStore, fbuilder, zoom);
    fbuilder.commit();
@systemed
Copy link
Owner

systemed commented May 9, 2024

Good call. We already sort features by attribute so the trick here will be for the point-writing code (as you've identified above) to look ahead in the same way that the polygon and linestring writers just below already do, checking for .compatible and grouping if so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants