diff --git a/server.js b/server.js index 7764594fffb6278d0b5c270df661020b0ae021df..1cbd6f614e61b2e0eb389fddc44f540dbb83a1f7 100644 --- a/server.js +++ b/server.js @@ -167,6 +167,15 @@ res.redirect("https://tiles.arcgis.com/tiles/P3ePLMYs2RVChkJx/arcgis/rest/services/Buildings_NewYork_17/SceneServer/layers/0/") }) + app.get('/i3s', function (req, res) { + if ("i3s_resource_url" in req.params) { + res.render('geovolumes/collections.ejs', + req.params + ) + } else { + res.send("Error: no i3s parameter specified") + } + }) const httpServer = http.createServer(app); httpServer.listen(port, () => { console.log(`HTTP Server running on port ${port}`); diff --git a/views/arcgisclient.ejs b/views/arcgisclient.ejs new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/views/cesiumclient.ejs b/views/cesiumclient.ejs new file mode 100644 index 0000000000000000000000000000000000000000..b1b1e983965c569cd1850e411e5f716dd2c79ca3 --- /dev/null +++ b/views/cesiumclient.ejs @@ -0,0 +1,98 @@ +<!DOCTYPE html> +<html> + +<head> + <meta charset="utf-8" /> + <meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" /> + <title>i3s client</title> + <style> + html, + body, + #viewDiv { + padding: 0; + margin: 0; + height: 100%; + width: 100%; + } + </style> + <link rel="icon" type="image/ico" href="img/favicon.ico" sizes="16x16"> + + <link rel="stylesheet" href="https://js.arcgis.com/4.14/esri/themes/light/main.css" /> + <link rel="stylesheet" href="./geoportal-i3s.css" /> + <script src="https://js.arcgis.com/4.14/"></script> + + <script> + var urlParams = new URLSearchParams(window.location.search); + var i3s_url = ""; + + require([ + "esri/Map", + "esri/views/SceneView", + "esri/layers/SceneLayer", + "esri/support/actions/ActionButton" + ], function (Map, SceneView, SceneLayer, ActionButton) { + // Create Map + var map = new Map({ + basemap: "dark-gray", + ground: "world-elevation" + }); + + // Create the SceneView + var view = new SceneView({ + container: "viewDiv", + map: map, + camera: { + position: [-74.0338, 40.6913, 707], + tilt: 81, + heading: 50 + } + }); + + // Create SceneLayer and add to the map + var sceneLayer; + if (urlParams.has('i3s_resource_url')) { + i3s_url = urlParams.get('i3s_resource_url'); + console.log(`loading: ${i3s_url}`) + sceneLayer = new SceneLayer({ + url: i3s_url, + popupEnabled: true + }); + map.add(sceneLayer); + sceneLayer.when(function () { + view.goTo(sceneLayer.fullExtent); + }); + } else { + // ... + } + map.add(sceneLayer); + // Create MeshSymbol3D for symbolizing SceneLayer + var symbol = { + type: "mesh-3d", // autocasts as new MeshSymbol3D() + symbolLayers: [{ + type: "fill", // autocasts as new FillSymbol3DLayer() + // If the value of material is not assigned, the default color will be grey + // material: { + // color: [244, 247, 134] + // } + }] + }; + // Add the renderer to sceneLayer + sceneLayer.renderer = { + type: "simple", // autocasts as new SimpleRenderer() + symbol: symbol + }; + view.ui.add("paneDiv", "top-right"); + }); + </script> +</head> + +<body> + <div id="viewDiv"></div> + <div id="paneDiv" class="esri-widget"> + <h1 style="line-height: 1em;">i3s client</h1> + <!-- <a id="tent" class="esri-button" href="./index.html" target="_blank" style="text-decoration: none; ">Back to STT + GeoPortal <br>(3D Tiles Client)</a><br /> --> + </div> +</body> + +</html> \ No newline at end of file diff --git a/views/geovolumes/collections.ejs b/views/geovolumes/collections.ejs index a1e681d83a08dd1a60a6915938730361d4833ed0..b339435041bed6b6cd75e9806c11d1c9b7c097d3 100644 --- a/views/geovolumes/collections.ejs +++ b/views/geovolumes/collections.ejs @@ -75,9 +75,12 @@ <b>Links</b>: <br> <% for(var j=0; j < collection_resource_updated_bbox["collections"][i].links.length; j++) { %> <% if (collection_resource_updated_bbox["collections"][i].links[j]["title"]) { %> - <a href="<%= collection_resource_updated_bbox["collections"][i].links[j]["href"]%>" target="_blank"> - <%= collection_resource_updated_bbox["collections"][i].links[j]["title"]%> - </a> <br> + <a href="<%= collection_resource_updated_bbox["collections"][i].links[j]["href"]%>" target="_blank"><%= collection_resource_updated_bbox["collections"][i].links[j]["title"]%></a> + <% if (collection_resource_updated_bbox["collections"][i].links[j]["title"].includes("i3s") ) { %> + <a href="i3s/?i3s_resource_url=<%= collection_resource_updated_bbox["collections"][i].links[j]["href"]%>" target="_blank"><span class="badge bg-primary">i3s client (ArcGIS JS)</span> + </a> + <% } %> + <br> <% } %> <% } %> <b>Children:</b> @@ -101,7 +104,13 @@ <% if (collection_resource_updated_bbox["collections"][i].children[j].links[k]["title"]) { %> <a href="<%= collection_resource_updated_bbox["collections"][i].children[j].links[k]["href"]%>" target="_blank"> <%= collection_resource_updated_bbox["collections"][i].children[j].links[k]["title"]%> - </a> <br> + </a> + <% if (collection_resource_updated_bbox["collections"][i].children[j].links[k]["title"].includes("i3s") ) { %> + <a href="<%= collection_resource_updated_bbox["collections"][i].children[j].links[k]["href"]%>" target="_blank"> + i3s client by ArcGIS JS + </a> + <% } %> + <br> <% } %> <% } %> </div>