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

Plugins: Add support for Mapbox Vector Tiles (MVT) format #982

Open
gkjohnson opened this issue Feb 17, 2025 · 0 comments · May be fixed by #990
Open

Plugins: Add support for Mapbox Vector Tiles (MVT) format #982

gkjohnson opened this issue Feb 17, 2025 · 0 comments · May be fixed by #990
Milestone

Comments

@gkjohnson
Copy link
Contributor

gkjohnson commented Feb 17, 2025

Resources

Implementation

The TMS and XYZ Format Plugins implicitly support loading and generating of geometry (ellipsoid and planar) for each tile. We can add support for vector tiles via a separate plugin so it can be optionally bundled - particularly since it will require protobuf.

We can start with the addition of an MVTLoader (a la the other the other tile format loaders) that loads the MVT file in a planar format. Then next steps can involve integrating it into the existing TMS / XYZ loaders:

fetch( './path/to/file.mvt' )
  .then( res => res.arrayBuffer() )
  .then( buffer => {

    // returns a three.js mesh based on vector paths
    return new MVTLoader().parse( buffer );

  } );

The MVTLoader can take advantage of three.js' Shape, ShapePath, and ShapeGeometry classes. Three.js' SVGLoader may also be helpful to reference.

Open Questions

The Shape classes will be able to generate shape paths for planar geometry easily but in order to support an ellipsoidal projection we need vertices within these path shapes so the ellipsoid shape can be properly represented. We can see how things look before investigating how to solve the issue but I expect we will see artifacts when generating the globe geometry. One option is the further tessellate large triangle or edges after construction to some threshold before performing the ellipsoid projections.

@gkjohnson gkjohnson added this to the v0.4.6 milestone Feb 17, 2025
@crubier crubier linked a pull request Feb 19, 2025 that will close this issue
@gkjohnson gkjohnson modified the milestones: v0.4.6, v0.4.7 Feb 21, 2025
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

Successfully merging a pull request may close this issue.

1 participant