Kowloon Mesh Model in I3S by ArcGIS JS API 4 (WGS84)
original Kowloon East
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/worldimagery/WGS84";
var mapEngLBUrl ="https://api.hkmapservice.gov.hk/ags/map/label-en/WGS84";
var groundURL = "https://api.hkmapservice.gov.hk/ags/image/hkterrain/WGS84";
var meshModelURL = "https://api.hkmapservice.gov.hk/ags/i3s/meshmodel/kowloon/WGS84";
require([
"esri/Map", "esri/views/SceneView",
"esri/layers/IntegratedMeshLayer", "esri/Basemap",
"esri/Ground", "esri/layers/TileLayer", "esri/layers/ElevationLayer",
"esri/core/urlUtils", "esri/views/MapView", "esri/config",
"esri/geometry/SpatialReference", "esri/geometry/Point",
"esri/geometry/support/webMercatorUtils", "dojo/domReady!"
], function(Map, SceneView, IntegratedMeshLayer, Basemap, Ground, TileLayer, ElevationLayer, urlUtils,
MapView, esriConfig, SpatialReference, Point, webMercatorUtils) {
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 {
params.requestOptions.query = {key: apikey}
}
}
},
});
urlUtils.removeQueryParameters = function(a,c) {return a;}
var basemap = new Basemap({
baseLayers: [
new TileLayer({
...