mapbox-gl加载体例3857加载
var map = new mapboxgl.Map({ container: 'map', zoom: 5, center: [119.42884, 32.19574], style: { "version": 8, "sources": { "tianditu": { "tyPE": "raster", "tiles": ['http://t0.tianditu.gov.cn/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=<YOUr token>'], "tileSize": 256, } }, "layers": [{ "id": "tianditu", "type": "raster", "source": "tianditu", }, ], } });
mapbox-gl官方自己不撑持4490,github上有修改版撑持4490,https://github.com/cgcs2000/mapbox-gl-js,加载代码一致,需替代成4490坐标系底图。
leaflet3857加载
var map = L.map('map', { center: [39, 117], zoom: 11 }); L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', { attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors' }).addTo(map);
4490加载
var map = L.map('map', { center: [39, 117], zoom: 11, crs: L.CRS.EPSG4326 }); L.tileLayer('http://support.supermap.com:8090/iserver/services/map-china400/wmts-china/China_4490/default/ChinaPublicServices_China_4490/{z}/{y}/{x}.png').addTo(map);
openlayers3857加载
const map = new ol.Map({ layers: [ new ol.layer.Tile({ source: new ol.source.TileImage({ url: "https://services.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}" }), }), ], target: 'map', view: new ol.View({ center: [0, 0], zoom: 2, }), });
4490加载
const map = new ol.Map({ layers: [ new ol.layer.Tile({ source: new ol.source.TileImage({ url: "http://t0.tianditu.gov.cn/DataServer?T=vec_c&x={x}&y={y}&l={z}&tk=12c963a4b7b670fdab44ce45fd0a89f2", PRojection: "EPSG:4326" }), }) ], target: 'map', view: new ol.View({ center: [119.42884, 36.19574], zoom: 8, projection: "EPSG:4326" }), });
若是自己基于Arcgis或者超图开发,利用他们自己供给的API就能停止开发。
发表评论