Mapbox Vector Tiles - OpenLayers
文章推薦指數: 80 %
A simple vector tiles map. Note: Make sure to get your own Mapbox API key when using this example. No map will be visible when the API key has expired.
×
ThisexampleusesOpenLayersv6.9.0.Thelatestisv.
Edit
MapboxVectorTiles
simple4
mapbox5
vector66
tiles6
×
ExampleofaMapboxvectortilesmap.
Asimplevectortilesmap.Note:MakesuretogetyourownMapboxAPIkeywhenusingthisexample.NomapwillbevisiblewhentheAPIkeyhasexpired.
main.js
import'ol/ol.css';
importMVTfrom'ol/format/MVT';
importMapfrom'ol/Map';
importVectorTileLayerfrom'ol/layer/VectorTile';
importVectorTileSourcefrom'ol/source/VectorTile';
importViewfrom'ol/View';
import{Fill,Icon,Stroke,Style,Text}from'ol/style';
constkey=
'YourMapboxaccesstokenfromhttps://mapbox.com/here';
constmap=newMap({
layers:[
newVectorTileLayer({
declutter:true,
source:newVectorTileSource({
attributions:
'©
package.json { "name":"mapbox-vector-tiles", "dependencies":{ "ol":"6.9.0" }, "devDependencies":{ "parcel":"^2.0.0-beta.1" }, "scripts":{ "start":"parcelindex.html", "build":"parcelbuild--public-url.index.html" } }
延伸文章資訊
- 1Unlimited private tilesets available for all users - Mapbox blog
- 2mapbox/vector-tile-js - GitHub
Parses vector tiles with JavaScript. Contribute to mapbox/vector-tile-js development by creating ...
- 3HERE Vector Tile Examples
Examples of the HERE Vector Tile API with various 3rd party web map renderers. ... From left to r...
- 4Add a vector tile layer | Mapbox GL JS | ArcGIS Developer
Add a vector tile source. You use a source of type vector to add the vector tiles. The source tel...
- 5Mapbox Vector Tile specification - GitHub
Mapbox Vector Tile Specification. A specification for encoding tiled vector data. License. The te...