From 3c320dcf5ebdd1ca90acef7ac6f8d014284503e5 Mon Sep 17 00:00:00 2001
From: Joe TS Dell <thunyathep.s@outlook.com>
Date: Fri, 9 Jul 2021 13:45:37 +0200
Subject: [PATCH] update

---
 .../collections/Stuttgart/Stuttgart.json      | 111 ++++++++++++++++++
 .../Stuttgart_LOD2_Stadtmitte.json            |  62 ++++++++++
 3DGeoVolumes/collections/collections.json     | 101 +++++++++++++++-
 server.js                                     |  26 +++-
 views/geovolumes/collections.ejs              |   5 +-
 5 files changed, 297 insertions(+), 8 deletions(-)
 create mode 100644 3DGeoVolumes/collections/Stuttgart/Stuttgart.json
 create mode 100644 3DGeoVolumes/collections/Stuttgart/Stuttgart_LOD2_Stadtmitte/Stuttgart_LOD2_Stadtmitte.json

diff --git a/3DGeoVolumes/collections/Stuttgart/Stuttgart.json b/3DGeoVolumes/collections/Stuttgart/Stuttgart.json
new file mode 100644
index 0000000..2644d4f
--- /dev/null
+++ b/3DGeoVolumes/collections/Stuttgart/Stuttgart.json
@@ -0,0 +1,111 @@
+{
+    "links": [
+      {
+        "rel": "self",
+        "href": "host_url/collections/Stuttgart",
+        "type": "application/json",
+        "title": "Stuttgart 3D models"
+      }
+    ],
+    "collections": [
+      {
+        "id": "Stuttgart",
+        "title": "Stuttgart 3D Models Demo",
+        "description": "All Supported 3D Containers for the city of Stuttgart LoD 1 from OSM with Textures",
+        "collectiontype": "3d-container",
+        "extent": {
+          "spatial": {
+            "bbox": [
+              [9.161434,48.771841,-10,9.183426,48.786318,550]
+            ],
+            "crs": "http://www.opengis.net/def/crs/OGC/0/CRS84h"
+          }
+        },
+        "links": [
+          {
+            "rel": "collections",
+            "href": "host_url/collections/",
+            "type": "application/json"
+          },
+          {
+            "title": "Stuttgart 3D Building Model (LoD 1) - Collections",
+            "rel": "self",
+            "href": "host_url/collections/Stuttgart_LoD1_OSM_Textures/",
+            "type": "application/json"
+          },
+          {
+            "title": "Stuttgart 3D Building Model (LoD 1) : 3D Tiles",
+            "rel": "items",
+            "href": "https://steinbeis-3dps.eu/3DGeoVolumes/collections/Stuttgart/Stuttgart_3DBuildings_LoD1/3dtiles/",
+            "type": "application/json+3dtiles"
+          }
+        ],
+        "children": [
+            {
+                "id": "Stuttgart_LOD2_Stadtmitte",
+                "title": "Stuttgart 3D Models LOD2 Stadtmitte Demo",
+                "description": "All Supported 3D Containers for the city of Stuttgart 3D Models LOD2 Stadtmitte",
+                "collectiontype": "3d-container",
+                "extent": {
+                  "spatial": {
+                    "bbox": [
+                      [9.161434,48.771841,-10,9.183426,48.786318,550]
+                    ],
+                    "crs": "http://www.opengis.net/def/crs/OGC/0/CRS84h"
+                  }
+                },
+                "links": [
+                  {
+                    "rel": "collections",
+                    "href": "host_url/collections/",
+                    "type": "application/json"
+                  },
+                  {
+                    "title": "Stuttgart LOD2 Stadtmitte - Collections",
+                    "rel": "self",
+                    "href": "host_url/collections/Stuttgart/Stuttgart_LOD2_Stadtmitte",
+                    "type": "application/json"
+                  },
+                  {
+                    "title": "Stuttgart LOD2 Stadtmitte : 3D Tiles",
+                    "rel": "items",
+                    "href": "http://193.196.37.89:8092/AssetsHFT/3DTile_Stuttgart_City_LoD2_InnenStadt_ClampToGround/tileset.json",
+                    "type": "application/json+3dtiles"
+                  }
+                ],
+                "children": [
+                  
+                ],
+                "content": [
+                  {
+                    "title": "Stuttgart LOD2 Stadtmitte - Collections",
+                    "rel": "original",
+                    "href": "host_url/collections/Stuttgart/Stuttgart_LOD2_Stadtmitte",
+                    "type": "application/json"
+                  },
+                  {
+                    "title": "Stuttgart LOD2 Stadtmitte : 3D Tiles",
+                    "rel": "original",
+                    "href": "http://193.196.37.89:8092/AssetsHFT/3DTile_Stuttgart_City_LoD2_InnenStadt_ClampToGround/tileset.json",
+                    "type": "application/json+3dtiles"
+                  }
+                ]
+              }
+        ],
+        "content": [
+          {
+            "title": "Stuttgart 3D Building Model (LoD 1) - Collections",
+            "rel": "original",
+            "href": "host_url/collections/Stuttgart_LoD1_OSM_Textures/",
+            "type": "application/json"
+          },
+          {
+            "title": "Stuttgart 3D Building Model (LoD 1) : 3D Tiles",
+            "rel": "original",
+            "href": "https://steinbeis-3dps.eu/3DGeoVolumes/collections/Stuttgart/Stuttgart_3DBuildings_LoD1/3dtiles/",
+            "type": "application/json+3dtiles"
+          }
+        ]
+      }
+    ]
+  }
\ No newline at end of file
diff --git a/3DGeoVolumes/collections/Stuttgart/Stuttgart_LOD2_Stadtmitte/Stuttgart_LOD2_Stadtmitte.json b/3DGeoVolumes/collections/Stuttgart/Stuttgart_LOD2_Stadtmitte/Stuttgart_LOD2_Stadtmitte.json
new file mode 100644
index 0000000..705110f
--- /dev/null
+++ b/3DGeoVolumes/collections/Stuttgart/Stuttgart_LOD2_Stadtmitte/Stuttgart_LOD2_Stadtmitte.json
@@ -0,0 +1,62 @@
+{
+    "links": [
+      {
+        "rel": "self",
+        "href": "host_url/collections/Stuttgart/Stuttgart_LOD2_Stadtmitte",
+        "type": "application/json",
+        "title": "Stuttgart LOD 2 3D models"
+      }
+    ],
+    "collections": [
+        {
+            "id": "Stuttgart_LOD2_Stadtmitte",
+            "title": "Stuttgart 3D Models LOD2 Stadtmitte Demo",
+            "description": "All Supported 3D Containers for the city of Stuttgart 3D Models LOD2 Stadtmitte",
+            "collectiontype": "3d-container",
+            "extent": {
+              "spatial": {
+                "bbox": [
+                  [9.161434,48.771841,-10,9.183426,48.786318,550]
+                ],
+                "crs": "http://www.opengis.net/def/crs/OGC/0/CRS84h"
+              }
+            },
+            "links": [
+              {
+                "rel": "collections",
+                "href": "host_url/collections/",
+                "type": "application/json"
+              },
+              {
+                "title": "Stuttgart LOD2 Stadtmitte - Collections",
+                "rel": "self",
+                "href": "host_url/collections/Stuttgart/Stuttgart_LOD2_Stadtmitte",
+                "type": "application/json"
+              },
+              {
+                "title": "Stuttgart LOD2 Stadtmitte : 3D Tiles",
+                "rel": "items",
+                "href": "http://193.196.37.89:8092/AssetsHFT/3DTile_Stuttgart_City_LoD2_InnenStadt_ClampToGround/tileset.json",
+                "type": "application/json+3dtiles"
+              }
+            ],
+            "children": [
+              
+            ],
+            "content": [
+              {
+                "title": "Stuttgart LOD2 Stadtmitte - Collections",
+                "rel": "original",
+                "href": "host_url/collections/Stuttgart/Stuttgart_LOD2_Stadtmitte",
+                "type": "application/json"
+              },
+              {
+                "title": "Stuttgart LOD2 Stadtmitte : 3D Tiles",
+                "rel": "original",
+                "href": "http://193.196.37.89:8092/AssetsHFT/3DTile_Stuttgart_City_LoD2_InnenStadt_ClampToGround/tileset.json",
+                "type": "application/json+3dtiles"
+              }
+            ]
+          }
+    ]
+  }
\ No newline at end of file
diff --git a/3DGeoVolumes/collections/collections.json b/3DGeoVolumes/collections/collections.json
index 49f0cc2..4ed1273 100644
--- a/3DGeoVolumes/collections/collections.json
+++ b/3DGeoVolumes/collections/collections.json
@@ -1,7 +1,7 @@
 {
     "links": [
       {
-        "rel": "self",
+        "rel": "original",
         "href": "host_url/collections",
         "type": "application/json",
         "title": "All geospatial data available from this API"
@@ -70,6 +70,105 @@
             "type": "application/json+i3s"
           }
         ]
+      },
+      {
+        "id": "Stuttgart",
+        "title": "Stuttgart 3D Models Demo",
+        "description": "All Supported 3D Containers for the city of Stuttgart LoD 1 from OSM with Textures",
+        "collectiontype": "3d-container",
+        "extent": {
+          "spatial": {
+            "bbox": [
+              [9.161434,48.771841,-10,9.183426,48.786318,550]
+            ],
+            "crs": "http://www.opengis.net/def/crs/OGC/0/CRS84h"
+          }
+        },
+        "links": [
+          {
+            "rel": "collections",
+            "href": "host_url/collections/",
+            "type": "application/json"
+          },
+          {
+            "title": "Stuttgart 3D Building Model - Collections",
+            "rel": "self",
+            "href": "host_url/collections/Stuttgart/",
+            "type": "application/json"
+          },
+          {
+            "title": "Stuttgart 3D Building Model (LoD 1) : 3D Tiles",
+            "rel": "items",
+            "href": "https://steinbeis-3dps.eu/3DGeoVolumes/collections/Stuttgart/Stuttgart_3DBuildings_LoD1/3dtiles/",
+            "type": "application/json+3dtiles"
+          }
+        ],
+        "children": [
+          {
+            "id": "Stuttgart_LOD2_Stadtmitte",
+            "title": "Stuttgart 3D Models LOD2 Stadtmitte Demo",
+            "description": "All Supported 3D Containers for the city of Stuttgart 3D Models LOD2 Stadtmitte",
+            "collectiontype": "3d-container",
+            "extent": {
+              "spatial": {
+                "bbox": [
+                  [9.161434,48.771841,-10,9.183426,48.786318,550]
+                ],
+                "crs": "http://www.opengis.net/def/crs/OGC/0/CRS84h"
+              }
+            },
+            "links": [
+              {
+                "rel": "collections",
+                "href": "host_url/collections/",
+                "type": "application/json"
+              },
+              {
+                "title": "Stuttgart LOD2 Stadtmitte - Collections",
+                "rel": "self",
+                "href": "host_url/collections/Stuttgart/Stuttgart_LOD2_Stadtmitte",
+                "type": "application/json"
+              },
+              {
+                "title": "Stuttgart LOD2 Stadtmitte : 3D Tiles",
+                "rel": "items",
+                "href": "http://193.196.37.89:8092/AssetsHFT/3DTile_Stuttgart_City_LoD2_InnenStadt_ClampToGround/tileset.json",
+                "type": "application/json+3dtiles"
+              }
+            ],
+            "children": [
+              
+            ],
+            "content": [
+              {
+                "title": "Stuttgart LOD2 Stadtmitte - Collections",
+                "rel": "original",
+                "href": "host_url/collections/Stuttgart/Stuttgart_LOD2_Stadtmitte",
+                "type": "application/json"
+              },
+              {
+                "title": "Stuttgart LOD2 Stadtmitte : 3D Tiles",
+                "rel": "original",
+                "href": "http://193.196.37.89:8092/AssetsHFT/3DTile_Stuttgart_City_LoD2_InnenStadt_ClampToGround/tileset.json",
+                "type": "application/json+3dtiles"
+              }
+            ]
+          }
+        ],
+        "content": [
+          {
+            "title": "Stuttgart 3D Building Model - Collections",
+            "rel": "original",
+            "href": "host_url/collections/Stuttgart/",
+            "type": "application/json"
+          },
+          {
+            "title": "Stuttgart 3D Building Model (LoD 1) : 3D Tiles",
+            "rel": "original",
+            "href": "https://steinbeis-3dps.eu/3DGeoVolumes/collections/Stuttgart/Stuttgart_3DBuildings_LoD1/3dtiles/",
+            "type": "application/json+3dtiles"
+          }
+        ]
       }
     ]
   }
\ No newline at end of file
diff --git a/server.js b/server.js
index 1a2e2e4..0275850 100644
--- a/server.js
+++ b/server.js
@@ -151,12 +151,29 @@
         }
     })
 
+    app.get('/collections/:collectionsId/:containerId', function (req, res) {
+        try {
+            var collection_json = require(`./3DGeoVolumes/collections/${req.params.collectionsId}/${req.params.containerId}/${req.params.containerId}.json`)
+            res.json(collection_json);
+        } catch (error) {
+            res.send("internal error at /3DGeoVolumes/collections/:collectionsId/:containerId")
+        }
+    })
+
+    // app.get('/collections/Stuttgart_LOD2_Stadtmitte/3dtiles', function (req, res) {
+    //     res.redirect("http://193.196.37.89:8092/AssetsHFT/3DTile_Stuttgart_City_LoD2_InnenStadt_ClampToGround/tileset.json")
+    // })
+
     // request 3D Tiles
     app.get('/collections/:collectionsId/3dtiles', function (req, res) {
         try {
-            var collections_3dtiles_json = require(`./3DGeoVolumes/collections/${req.params.collectionsId}/3dtiles/tileset.json`)
-            var collections_3dtiles_output = replace_server_url(collections_3dtiles_json)
-            res.json(collections_3dtiles_output);
+            if (req.params.collectionsId == "Stuttgart_LOD2_Stadtmitte") {
+                res.redirect("http://193.196.37.89:8092/AssetsHFT/3DTile_Stuttgart_City_LoD2_InnenStadt_ClampToGround/tileset.json")
+            } else {
+                var collections_3dtiles_json = require(`./3DGeoVolumes/collections/${req.params.collectionsId}/3dtiles/tileset.json`)
+                var collections_3dtiles_output = replace_server_url(collections_3dtiles_json)
+                res.json(collections_3dtiles_output);
+            }
         } catch (error) {
             res.send("internal error at /3DGeoVolumes/collections/:collectionsId/3dtiles")
         }
@@ -166,7 +183,8 @@
     app.get('/collections/NewYork/i3s', function (req, res) {
         res.redirect("https://tiles.arcgis.com/tiles/P3ePLMYs2RVChkJx/arcgis/rest/services/Buildings_NewYork_17/SceneServer/layers/0/")
     })
-
+    
+    
     app.get('/i3s', function (req, res) {
         if (req.query.i3s_resource_url) {
             res.render('arcgisclient.ejs', 
diff --git a/views/geovolumes/collections.ejs b/views/geovolumes/collections.ejs
index bab8372..3ce9522 100644
--- a/views/geovolumes/collections.ejs
+++ b/views/geovolumes/collections.ejs
@@ -29,9 +29,8 @@
 
                     <h3>
                         <img src="https://steinbeis-3dps.eu/images/stw-stuttgart.jpg" alt="" width="50px">
-                        <img src="https://transfer.hft-stuttgart.de/pages/buildicipate/webpage/assets/images/hft_logo.svg"
-                            alt="" width="50px">
-                        STT GeoVolumes Server
+                        
+                        Demo GeoVolumes Server
                     </h3>
                 </a>
             </div>
-- 
GitLab