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

Can't display Geoserver vector tile #315

Open
bzzzggz opened this issue Jan 7, 2021 · 1 comment
Open

Can't display Geoserver vector tile #315

bzzzggz opened this issue Jan 7, 2021 · 1 comment

Comments

@bzzzggz
Copy link

bzzzggz commented Jan 7, 2021

I am using Geoserver as the data source and designed a map with Maputnik.

When I try to test it with olms, the map didn't load with no error code.

Code am using:

//olms('map', 'https://api.mapbox.com/styles/v1/mapbox/bright-v9?access_token=' + key); olms('map', './data/basemap.json');

The map loading properly with Mapbox style.

I also test the json file with Mapbox gl js for Leaflet, works fine as well.

The vector tile link used in Mapbox style format is:

https://maps.xxx.xxxx/geoserver/gwc/service/wmts?REQUEST=GetTile&SERVICE=WMTS&VERSION=1.0.0&LAYER=GIS_Data_Public%3Abasemap&STYLE=&TILEMATRIX=EPSG:3857:{z}&TILEMATRIXSET=EPSG:3857&FORMAT=application/vnd.mapbox-vector-tile&TILECOL={x}&TILEROW={y}

Not sure which part is wrong.

Thanks.

@ahocevar
Copy link
Member

ahocevar commented Jan 8, 2021

If you use ol-mapbox-style's default export (olms() in your snippet) to append layers to an existing map, you'll have to pass it the map instance. So your code should look like this:

(async function() {
  const map = await olms('map', 'https://api.mapbox.com/styles/v1/mapbox/bright-v9?access_token=' + key);
  olms(map, './data/basemap.json');
})();

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