3DSD in I3S by ArcGIS JS API 4 (WGS84 Web Mercator)

by LandsD Map API

HTML

<script src="https://js.arcgis.com/4.23/"></script>
<link rel="stylesheet" href="https://js.arcgis.com/4.23/esri/themes/light/main.css" />

<body>
  <div id="viewDiv"></div>
  <div id="landsdlogo" class="landsdlogo"></div>

</body>

CSS

html,
body,
#viewDiv {
  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;
}

JavaScript

var basemapURL = "https://api.hkmapservice.gov.hk/ags/map/worldimagery/WGS84";
var mapEngLBUrl = "https://api.hkmapservice.gov.hk/ags/map/label-tc/WGS84";

var groundURL = "https://api.hkmapservice.gov.hk/ags/image/hkterrain/WGS84";
var infra3Durl = " https://api.hkmapservice.gov.hk/ags/i3s/3dsd/infrastructure/WGS84"
var building3Durl = " https://api.hkmapservice.gov.hk/ags/i3s/3dsd/building/WGS84"

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", "dojo/domReady!"
], function(Map, SceneView, SceneLayer, Basemap, Ground, TileLayer, ElevationLayer, SceneLayer, urlUtils, MapView, esriConfig, FeatureLayer, SpatialReference, Point, Compass) {
  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
          }
        }
      }

      if (params.url.indexOf("api.hkmapservice.gov.hk/ags/map/layer/ib1000/buildings/building/0") >= 0)
        params.url = params.url.replace('building/0', 'building');
    },
    after: function(response) {
      if (!response.ssl) {
        //response.ssl = true;
      }
    }
  });
  urlUtils.removeQueryParameters = function(a, c) {
    return a;
  }

  var basemap = new Basemap({
    baseLayers: [
      new TileLayer({
        url: basemapURL
      }),
      new TileLayer({
        url: mapEngLBUrl
      })
    ]
  });
  var ground = new Ground({
    layers: [
      new ElevationLayer({
       ...