Skip to main content

Load vector tile service

Only services published by Mapmost Studio are supported. Select "Suzhou 2000" when publishing.

show
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>SZ2000</title>
<meta
name="viewport"
content="initial-scale=1,maximum-scale=1,user-scalable=no"
/>
<style>
body {
margin: 0;
padding: 0;
}

#map {
position: absolute;
top: 0;
bottom: 0;
width: 100%;
}
</style>

<script src="https://delivery.mapmost.com/cdn/sdk/webgl/v9.16.0/mapmost-webgl-min.js"></script>
</head>
<body>
<div id="map"></div>
<script>

// Suzhou 2000 rpm SDK coordinates
let center = mapmost.Convert.fromDefinedProj([342171.097900000400841, 665836.627800000831485]);

// Map initialization
let map = new mapmost.Map({
container: 'map', // map container id
style: '<your style url>', // sz2000 style file
center: center, //Coordinates of the initial center point of the map
zoom: 13, // Initial zoom level of the map
pitch: 60, // Map initial pitch angle
bearing: 0, // initial azimuth of the map
userId:'***', // Authorization code
});

map.on('load', function () {
map.addSource('nature', {
type: 'vector',
url: 'http://***/MapmostProxy/sip_nature_sz2000PC.json'
});
map.addLayer({
"id": "river_g",
"type": "fill",
"source": "nature",
"source-layer": "river_g",
"layout": { "visibility": "visible" },
"paint": { "fill-color": "rgba(160, 200, 255, 1)" }
});
})
</script>
</body>
</html>