|
| 1 | +<!--******************************************************************** |
| 2 | +* Copyright© 2000 - 2019 SuperMap Software Co.Ltd. All rights reserved. |
| 3 | +*********************************************************************--> |
| 4 | +<!DOCTYPE html> |
| 5 | +<html> |
| 6 | + <head> |
| 7 | + <meta charset="utf-8" /> |
| 8 | + <meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" /> |
| 9 | + <title data-i18n="resources.title_mvtVectorLayer_restdata"></title> |
| 10 | + <script type="text/javascript" src="../js/include-web.js"></script> |
| 11 | + <style> |
| 12 | + body { |
| 13 | + margin: 0; |
| 14 | + padding: 0; |
| 15 | + } |
| 16 | + |
| 17 | + #map { |
| 18 | + position: absolute; |
| 19 | + top: 0; |
| 20 | + bottom: 0; |
| 21 | + width: 100%; |
| 22 | + } |
| 23 | + </style> |
| 24 | + </head> |
| 25 | + <body> |
| 26 | + <div id="map" style="width:100%;height:100%;z-index:0;position: absolute;"></div> |
| 27 | + <script |
| 28 | + type="text/javascript" |
| 29 | + include="mapbox-gl-enhance" |
| 30 | + src="../../dist/mapboxgl/include-mapboxgl.js" |
| 31 | + ></script> |
| 32 | + <script type="text/javascript"> |
| 33 | + var host = window.isLocal ? window.server : 'http://iclient.supermap.io'; |
| 34 | + var attribution = |
| 35 | + "<a href='https://www.mapbox.com/about/maps/' target='_blank'>© Mapbox </a>" + |
| 36 | + " with <span>© <a href='http://iclient.supermap.io' target='_blank'>SuperMap iClient</a> | </span>" + |
| 37 | + " Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' target='_blank'>SuperMap iServer</a></span> "; |
| 38 | + var tile1 = |
| 39 | + host + |
| 40 | + '/iserver/services/data-osm-line/rest/data/datasources/osm-line/datasets/railways/tileFeature.mvt?returnAttributes=true&width=512&height=512&x={x}&y={y}&scale={scale}&origin={x:-180,y:90}'; |
| 41 | + var tile2 = |
| 42 | + host + |
| 43 | + '/iserver/services/data-osm-line/rest/data/datasources/osm-line/datasets/waterways/tileFeature.mvt?returnAttributes=true&width=512&height=512&x={x}&y={y}&scale={scale}&origin={x:-180,y:90}'; |
| 44 | + var map = new mapboxgl.Map({ |
| 45 | + container: 'map', |
| 46 | + style: { |
| 47 | + version: 8, |
| 48 | + sources: { |
| 49 | + 'raster-tiles': { |
| 50 | + attribution: attribution, |
| 51 | + type: 'raster', |
| 52 | + tiles: [ |
| 53 | + host + |
| 54 | + '/iserver/services/map-china400/rest/maps/ChinaDark/tileImage.png?prjCoordSys={"epsgCode":4326}&scale={scale}&x={x}&y={y}&width={width}&height={height}&origin={"x":-180,"y":90}' |
| 55 | + ], |
| 56 | + tileSize: 256 |
| 57 | + }, |
| 58 | + railways: { |
| 59 | + attribution: attribution, |
| 60 | + type: 'vector', |
| 61 | + tiles: [tile1] |
| 62 | + }, |
| 63 | + waterways: { |
| 64 | + attribution: attribution, |
| 65 | + type: 'vector', |
| 66 | + tiles: [tile2] |
| 67 | + } |
| 68 | + }, |
| 69 | + layers: [ |
| 70 | + { |
| 71 | + id: 'simple-tiles', |
| 72 | + type: 'raster', |
| 73 | + source: 'raster-tiles', |
| 74 | + minzoom: 0, |
| 75 | + maxzoom: 22 |
| 76 | + }, |
| 77 | + { |
| 78 | + id: 'waterwaysLayer', |
| 79 | + type: 'line', |
| 80 | + source: 'waterways', |
| 81 | + 'source-layer': 'waterways@osm-line', |
| 82 | + paint: { |
| 83 | + 'line-width': 1, |
| 84 | + 'line-color': 'rgb(37, 140, 249)', |
| 85 | + 'line-opacity': 0.6 |
| 86 | + } |
| 87 | + }, |
| 88 | + { |
| 89 | + id: 'railwaysLayer', |
| 90 | + type: 'line', |
| 91 | + source: 'railways', |
| 92 | + 'source-layer': 'railways@osm-line', |
| 93 | + paint: { |
| 94 | + 'line-width': 1, |
| 95 | + 'line-blur': 2, |
| 96 | + 'line-color': 'orange', |
| 97 | + 'line-opacity': 0.6 |
| 98 | + } |
| 99 | + } |
| 100 | + ] |
| 101 | + }, |
| 102 | + crs: 'EPSG:4326', |
| 103 | + center: [120.91740589709298, 31.519742618586378], |
| 104 | + zoom: 8 |
| 105 | + }); |
| 106 | + </script> |
| 107 | + </body> |
| 108 | +</html> |
0 commit comments