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

tile spec v2 support: prepareLayer defaults to version 1 which throws warning in mapbox-gl-js #12

Open
lukeelmers opened this issue Sep 7, 2016 · 2 comments

Comments

@lukeelmers
Copy link

Right now prepareLayer defaults to version 1 if no version is provided. This causes mapbox-gl-js to throw a warning that the tile source does not use vector tile spec v2.

There doesn't seem to be a way to provide version in fromGeojsonVt that can override this default, but it would be awesome to have tile spec v2 support when converting from GeoJSON.

@gmaclennan
Copy link

@lukeelmers I believe a workaround for this would be to use GeoJSONWrapper which is exported but not documented, copying the code from https://github.com/mapbox/vt-pbf/blob/master/index.js#L33-L40

e.g. instead of:

var buff = vtpbf.fromGeojsonVt({ 'geojsonLayer': tile })

do:

var layer = new GeoJSONWrapper(tile.features)
layer.name = 'geojsonLayer'
layer.version = 2
var buff = vtpbf.fromVectorTileJs({layers: {
  geojsonLayer: layer
})

@redbmk
Copy link

redbmk commented Dec 19, 2017

@gmaclennan It looks like fromGeojsonVt now takes an options param, so you can set the version from there. e.g.

var buff = vtpbf.fromGeojsonVt({ 'geojsonLayer': tile }, { version: 2 })

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

3 participants