3DSD i3s in HK 1980 Grid
by LandsD Map API
HTML
<link rel="stylesheet" href="https://js.arcgis.com/4.23/esri/themes/light/main.css">
<script src="https://js.arcgis.com/4.23/"></script>
<body>
<div id="scene-area"></div>
<div id="landsdlogo" class="landsdlogo"></div>
</body>
CSS
html,
body,
#scene-area {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
#landsdlogo {
display: inline-block;
vertical-align: bottom;
width: 18px;
height: 18px;
background: url(https://mapapis01.blob.core.windows.net/images/landsdlogo.jpg);
background-repeat: no-repeat;
background-size: 18px 18px;
}
.esri-attribution {
background: transparent;
}
JavaScript
// resize map
const mapdiv = window['scene-area'];
var margin;
if (document.all) {
margin = parseInt(document.body.currentStyle.marginTop, 10) + parseInt(document.body.currentStyle.marginBottom,
10);
} else {
margin = parseInt(document.defaultView.getComputedStyle(document.body, '').getPropertyValue('margin-top')) +
parseInt(document.defaultView.getComputedStyle(document.body, '').getPropertyValue('margin-bottom'));
}
mapdiv.style.height = (window.innerHeight - margin) + 'px';
var basemapURL = "https://api.hkmapservice.gov.hk/ags/map/imagery/HK80";
var mapEngLBUrl = "https://api.hkmapservice.gov.hk/ags/map/label-tc/HK80";
var groundURL = "https://api.hkmapservice.gov.hk/ags/image/hkterrain/HK80";
var infra3Durl = "https://api.hkmapservice.gov.hk/ags/i3s/3dsd/infrastructure/HK80"
var building3Durl = "https://api.hkmapservice.gov.hk/ags/i3s/3dsd/building/HK80"
require([
"esri/Map", "esri/views/SceneView",
"esri/layers/SceneLayer", "esri/Basemap",
"esri/Ground", "esri/layers/TileLayer",
"esri/layers/ElevationLayer", "esri/layers/SceneLayer",
"esri/core/urlUtils", "esri/views/MapView",
"esri/config", "esri/layers/FeatureLayer",
"esri/geometry/SpatialReference", "esri/geometry/Point",
"esri/widgets/Compass",
"esri/widgets/Bookmarks", "esri/webmap/Bookmark", "esri/Viewpoint",
"esri/widgets/Expand", "esri/geometry/Extent",
"esri/widgets/Home",
"dojo/domReady!"
], function(Map, SceneView, SceneLayer, Basemap, Ground, TileLayer, ElevationLayer, SceneLayer, urlUtils,
MapView, esriConfig, FeatureLayer, SpatialReference, Point, Compass, Bookmarks, Bookmark, Viewpoint,
Expand, Extent, Home) {
esriConfig.request.trustedServers.push("https://api.hkmapservice.gov.hk");
esriConfig.request.interceptors.push({
before: function(params) {
if (params.url.indexOf("api.hkmapservice.gov.hk") >= 0) {
if (params.requestOptions.query) {
params.requestOptions.query.key = apikey
} else {
...