mapbox / mapbox-gl-js

Interactive, thoroughly customizable maps in the browser, powered by vector tiles and WebGL
https://docs.mapbox.com/mapbox-gl-js/
Other
11.2k stars 2.22k forks source link

TileJSON as source #10758

Closed AgentSmith0 closed 3 years ago

AgentSmith0 commented 3 years ago

2.3.0:

Question

Is it possible to use TileJSON as source? My TileJSON looks like the following: {"name":"TILESET ED","type":"baselayer","version":"2013","description":"Germany","format":"png","bounds":[5.5,47,15,55],"attribution":"open fightmaps association / www.openflightmaps.org","minzoom":4,"maxzoom":11,"basename":"tiles/ed_256","profile":"mercator","scale":1,"tiles":["http://10.0.0.1/tileserver/tiles/tiles/ed_256/{z}/{x}/{y}.png"],"tilejson":"2.0.0","scheme":"xyz"} Just referencing the url in the styles attribute of the map initialization does not work. It says there are missing required properties.

In mapbox.js this was easy to do by using the L.mapbox.tileLayer() function.

AgentSmith0 commented 3 years ago

Fixed it by using a style json and referencing the TileJSON.