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

Mapbox vector layer #10996

Merged
merged 1 commit into from
May 4, 2020
Merged

Mapbox vector layer #10996

merged 1 commit into from
May 4, 2020

Conversation

tschaub
Copy link
Member

@tschaub tschaub commented May 3, 2020

This adds a MapboxVector layer constructor that can be used to render a Mapbox-hosted style. As mentioned in the docs, this only works with vector type sources. For styles that have more than a single source, the layer can be configured with a source property to indicate the id of the source to use. The layers property can also be used to render a subset of layers in the style (provided that they share the same vector source).

Example usage:

new Map({
  target: 'map',
  view: new View({
    center: [0, 0],
    zoom: 2
  }),
  layers: [
    new MapboxVector({
      styleURL: 'mapbox://styles/tschaub/cjh953yhw1...',
      accessToken:'pk.redacted'
    })
  ]
});

Where the styleURL and accessToken are copied from studio:
image

See openlayers/ol-mapbox-style#268 for the original PR (and credits to that library for making this easy).

Copy link
Member

@ahocevar ahocevar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, very impressive work @tschaub. And extra bonus points for the improvements to the rendering test and api doc systems you made along the way. Thanks!

@tschaub tschaub merged commit 8ea2fe1 into openlayers:master May 4, 2020
@tschaub tschaub deleted the mapbox-vector-layer branch May 4, 2020 14:01
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 this pull request may close these issues.

None yet

2 participants