Skip to content

Commit 18ea09f

Browse files
committed
【example】增加对接iserver数据服务矢量瓦片的例子 review by liqian
1 parent a5f542b commit 18ea09f

File tree

5 files changed

+117
-0
lines changed

5 files changed

+117
-0
lines changed

examples/locales/en-US/resources.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,7 @@ window.examplesResources = {
439439
"title_mapvNyvTaxi": "NY Taxi Car Points",
440440
"title_modifyFeatures": "Modify Features",
441441
"title_mvtVectorLayer_vectortilerest": "iServer REST VectorTile",
442+
"title_mvtVectorLayer_restdata": "iServer REST Data TileFeature",
442443
"title_mvtVectorLayer": "iServer MVT VectorTile",
443444
"title_mvtVectorLayer4326": "iServer MVT VectorTile (WGS84)",
444445
"title_mvtVectorLayer_mapboxStyle": "Style Switch",

examples/locales/zh-CN/resources.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,7 @@ window.examplesResources = {
383383
"title_modifyFeatures": "修改图形",
384384
"title_mvtVectorLayer": "iServer MVT矢量瓦片",
385385
"title_mvtVectorLayer_vectortilerest": "iServer 矢量瓦片服务",
386+
"title_mvtVectorLayer_restdata": "iServer 数据服务矢量瓦片",
386387
"title_mvtVectorLayer4326": "iServer MVT矢量瓦片(WGS84)",
387388
"title_mvtVectorLayer_mapboxStyle": "OSM风格(MVT WGS84)",
388389
"title_mvtVectorLayer_mapboxStyle_4326": "风格动态切换",

examples/mapboxgl/config.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,13 @@ var exampleConfig = {
491491
version: "9.1.2",
492492
thumbnail: "mvtVectorTile_overlay.png",
493493
fileName: "mvtVectorTile_overlay"
494+
},
495+
{
496+
name: "iServer数据服务矢量瓦片(2000万点)",
497+
name_en: "iServer REST Data VectorTile(20 million Point)",
498+
version: "10.0.1",
499+
thumbnail: "mvtVectorTile_restdata.png",
500+
fileName: "mvtVectorTile_restdata"
494501
}
495502
]
496503
},
32.4 KB
Loading
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
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

Comments
 (0)