Commit 8d158562 authored by Hanadi's avatar Hanadi
Browse files

Initial Commit

parents
# Created by https://www.gitignore.io
### Intellij ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm
*.iml
## Directory-based project format:
.idea/
# if you remove the above rule, at least ignore the following:
# User-specific stuff:
# .idea/workspace.xml
# .idea/tasks.xml
# .idea/dictionaries
# Sensitive or high-churn files:
# .idea/dataSources.ids
# .idea/dataSources.xml
# .idea/sqlDataSources.xml
# .idea/dynamic.xml
# .idea/uiDesigner.xml
# Gradle:
# .idea/gradle.xml
# .idea/libraries
# Mongo Explorer plugin:
# .idea/mongoSettings.xml
## File-based project format:
*.ipr
*.iws
## Plugin-specific files:
# IntelliJ
/out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
### Node ###
# Logs
logs
*.log
# Runtime data
pids
*.pid
*.seed
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# node-waf configuration
.lock-wscript
# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release
# Dependency directory
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
node_modules
# ogc3dcontainer
{
"links": [
{
"title": "Collections Document",
"rel": "self",
"href": "http://localhost:3001/collections",
"type": "application/json"
}
],
"collections": [
{
"id": "stuttgart",
"title": "Stuttgart 3D City Modle",
"description": "3D containers for buildings and bridges in Stuttgart area",
"collectionType": "3d-container",
"extent": {
"spatial": {
"bbox": [
48.7850854,
9.1775762,
14,
48.7987271,
9.2159381,
15
],
"crs": "http://www.opengis.net/def/crs/OGC/0/CRS84h"
}
},
"links": [
{
"title": "Stuttgart 3D Models",
"rel": "self",
"href": "http://localhost:3001/collections/stuttgart",
"type": "application/json"
}
],
"content": [],
"children": [
{
"id": "buildings",
"title": "Stuttgart 3D Buildings",
"description": "3D containers for buildings in Stuttgart area",
"collectionType": "3d-container",
"extent": {
"spatial": {
"bbox": [
48.7850854,
9.1775762,
14,
48.7987271,
9.2159381,
15
],
"crs": "http://www.opengis.net/def/crs/OGC/0/CRS84h"
}
},
"links": [
{
"title": "Stuttgart Buildings",
"rel": "self",
"href": "http://localhost:3001/collections/stuttgart/buildings",
"type": "application/json"
}
],
"content": [],
"children": [
{
"id": "nordbahnhof",
"title": "Stuttgart buildings in nordbahnhof area",
"description": "3D container for nordbahnhof buildings",
"collectionType": "3d-container",
"extent": {
"spatial": {
"bbox": [
48.7850854,
9.1775762,
14,
48.7824145,
9.1897675,
14
],
"crs": "http://www.opengis.net/def/crs/OGC/0/CRS84h"
}
},
"links": [
{
"title": "Nordbahnhof-3D Buildings",
"rel": "self",
"href": "http://localhost:3001/collections/stuttgart/buildings/nordbahnhof",
"type": "application/json"
},
{
"title": "Nordbahnhof-I3S Buildings",
"rel": "item",
"href": "https://tiles.arcgis.com/tiles/oV3ptJTOJUUkJxUq/arcgis/rest/services/Stuttgart_Building_i3s/SceneServer/layers/0",
"type": "application/json-i3s"
},
{
"title": "Nordbahnhof-3D Tiles Buildings",
"rel": "item",
"href": "http://localhost:3001/public/3d-tiles/Nordbahnhof/Building/resources/tileset.json",
"type": "application/json-3dtiles"
}
],
"content": [
{
"title": "Nordbahnhof Buildings-i3s",
"rel": "alternate",
"href": "https://tiles.arcgis.com/tiles/oV3ptJTOJUUkJxUq/arcgis/rest/services/Stuttgart_Building_i3s/SceneServer/layers/0",
"type": "application/json-i3s"
},
{
"title": "Nordbahnhof Buildings-3D Tiles",
"rel": "original",
"href": "http://localhost:3001/public/3d-tiles/Nordbahnhof/Building/tileset.json",
"type": "application/json-3dtiles"
}
],
"children": []
},
{
"id": "steockach",
"title": "Stuttgart buildings in Steockach area",
"description": "3D container for Steockach buildings",
"collectionType": "3d-container",
"extent": {
"spatial": {
"bbox": [
48.7852104,
9.1883564,
13.25,
48.7805316,
9.1797021,
12.75
],
"crs": "http://www.opengis.net/def/crs/OGC/0/CRS84h"
}
},
"links": [
{
"title": "Steockach Buildings",
"rel": "self",
"href": "http://localhost:3001/collections/stuttgart/buildings/steockach",
"type": "application/json"
},
{
"title": "Steockach Buildings-I3S",
"rel": "item",
"href": "https://tiles.arcgis.com/tiles/oV3ptJTOJUUkJxUq/arcgis/rest/services/Steockach_Buildings_i3s/SceneServer/layers/0",
"type": "application/json-i3s"
},
{
"title": "Steockach Buildings-3D Tiles",
"rel": "item",
"href": "http://localhost:3001/public/3d-tiles/Steockach/Building/tileset.json",
"type": "application/json-3dtiles"
}
],
"content": [
{
"title": "Steockach Buildings-I3S",
"rel": "alternate",
"href": "https://tiles.arcgis.com/tiles/oV3ptJTOJUUkJxUq/arcgis/rest/services/Steockach_Buildings_i3s/SceneServer/layers/0",
"type": "application/json-i3s"
},
{
"title": "Steockach Buildings-3D Tiles",
"rel": "original",
"href": "http://localhost:3001/public/3d-tiles/Steockach/Building/tileset.json",
"type": "application/json-3dtiles"
}
],
"children": []
}
]
},
{
"id": "bridges",
"title": "Stuttgart 3D bridges",
"description": "Stuttgart 3D containers for bridges",
"collectionType": "3d-container",
"extent": {
"spatial": {
"bbox": [
48.7850854,
9.1775762,
14,
48.7987271,
9.2159381,
15
],
"crs": "http://www.opengis.net/def/crs/OGC/0/CRS84h"
}
},
"links": [
{
"title": "Stuttgart Bridges",
"rel": "self",
"href": "http://localhost:3001/collections/stuttgart/bridges",
"type": "application/json"
}
],
"content": [],
"children": [
{
"id": "nordbahnhof",
"title": "Stuttgart bridges in nordbahnhof area",
"description": "3D container for nordbahnhof bridges",
"collectionType": "3d-container",
"extent": {
"spatial": {
"bbox": [
48.7850854,
9.1775762,
14,
48.7987271,
9.2159381,
15
],
"crs": "http://www.opengis.net/def/crs/OGC/0/CRS84h"
}
},
"links": [
{
"title": "Nordbahnhof bridges",
"rel": "self",
"href": "http://localhost:3001/collections/stuttgart/bridges/nordbahnhof",
"type": "application/json"
},
{
"title": "Nordbahnhof bridges-i3s",
"rel": "item",
"href": "https://tiles.arcgis.com/tiles/oV3ptJTOJUUkJxUq/arcgis/rest/services/Stuttgart_Bridge_i3s/SceneServer/layers/0",
"type": "application/json-i3s"
},
{
"title": "Nordbahnhof bridges-3D Tiles",
"rel": "item",
"href": "http://localhost:3001/public/3d-tiles/Nordbahnhof/Bridge/tileset.json",
"type": "application/json-i3s"
}
],
"content": [
{
"title": "Nordbahnhof bridges-i3s",
"rel": "alternate",
"href": "https://tiles.arcgis.com/tiles/oV3ptJTOJUUkJxUq/arcgis/rest/services/Stuttgart_Bridge_i3s/SceneServer/layers/0",
"type": "application/json-i3s"
},
{
"title": "Nordbahnhof bridges-3D Tiles",
"rel": "original",
"href": "http://localhost:3001/public/3d-tiles/Nordbahnhof/Bridge/tileset.json",
"type": "application/json-i3s"
}
],
"children": []
},
{
"id": "steockach",
"title": "Stuttgart bridges in Steockach area",
"description": "3D container for Steockach bridges",
"collectionType": "3d-container",
"extent": {
"spatial": {
"bbox": [
48.7850854,
9.1775762,
14,
48.7987271,
9.2159381,
15
],
"crs": "http://www.opengis.net/def/crs/OGC/0/CRS84h"
}
},
"links": [
{
"title": "Steockach bridges",
"rel": "self",
"href": "http://localhost:3001/collections/stuttgart/bridges/steockach",
"type": "application/json"
},
{
"title": "Steockach bridges-i3s",
"rel": "item",
"href": "https://tiles.arcgis.com/tiles/oV3ptJTOJUUkJxUq/arcgis/rest/services/Stuttgart_Bridge_i3s/SceneServer/layers/0",
"type": "application/json-i3s"
},
{
"title": "Steockach bridges-3D Tiles",
"rel": "item",
"href": "http://localhost:3001/public/3d-tiles/Steockach/Bridge/tileset.json",
"type": "application/json-i3s"
}
],
"content": [
{
"title": "Steockach bridges-i3s",
"rel": "alternate",
"href": "https://tiles.arcgis.com/tiles/oV3ptJTOJUUkJxUq/arcgis/rest/services/Stuttgart_Bridge_i3s/SceneServer/layers/0",
"type": "application/json-i3s"
},
{
"title": "Steockach bridges-3D Tiles",
"rel": "original",
"href": "http://localhost:3001/public/3d-tiles/Steockach/Bridge/tileset.json",
"type": "application/json-3dtiles"
}
],
"children": []
}
]
}
]
}
]
}
{
"conformsTo": [
"http://www.opengis.net/spec/OAPI_Common/1.0/req/core"
]
}
{
"title": "3D Container API",
"description": "A pilot of an API for 3D containers and tiles.",
"links": [
{
"title": "Service Description",
"href": "https://app.swaggerhub.com/apis/timothy-miller/3D-Data-Container/0.0.1",
"rel": "service-desc"
},
{
"title": "Conformance",
"href": "http://localhost:3001/conformance/",
"rel": "conformance"
},
{
"title": "Collections",
"href": "http://localhost:3001/collections/",
"rel": "data"
}
]
}
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const express_1 = __importDefault(require("express"));
const cors_1 = __importDefault(require("cors"));
const Ogc3D_1 = require("./src/Ogc3D");
const ErrorHandler_1 = require("./src/ErrorHandler");
const app = express_1.default();
app.use(cors_1.default());
const PORT = 3001;
// Routes
app.get("/", (req, res) => {
console.debug("Received request for Landing Page");
res.send(Ogc3D_1.loadLandingPage());
});
app.get("/conformance", (req, res) => {
console.debug("Received request for conformance");
res.send(Ogc3D_1.loadConformance());
});
app.get("/collections", (req, res) => {
console.debug("Received request for collections");
res.send(Ogc3D_1.loadCollections());
});
app.get("/collections/*", (req, res) => {
console.debug("Received request for subcollections");
const subCollections = req.params[0].split("/").filter(val => !!val);
res.send(Ogc3D_1.loadSubCollections(subCollections, req.query.format));
});
// Error Handling
// noinspection JSUnusedLocalSymbols
app.use(function (err, req, res, next) {
const errorResponse = ErrorHandler_1.mapError(err);
res.status(errorResponse.status).send(errorResponse);
});
app.use("/public", express_1.default.static("public"));
// Start Application
app.listen(PORT, () => {
console.log(`⚡️[server]: Server is running at http://localhost:${PORT}`);
});
//# sourceMappingURL=index.js.map
\ No newline at end of file
{"version":3,"file":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AAC,KAAK,CAAC,MAA4B,CAAC,CAAC,CAAC;AACzF,CAAC,CAAC,CAAC;AAEH,iBAAiB;AACjB,oCAAoC;AACpC,GAAG,CAAC,GAAG,CAAC,UAAU,GAAU,EAAE,GAAY,EAAE,GAAa,EAAE,IAAkB;IACzE,MAAM,aAAa,GAAG,uBAAQ,CAAC,GAAG,CAAC,CAAC;IACpC,GAAG,CAAC,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;AACzD,CAAC,CAAC,CAAC;AAEH,GAAG,CAAC,GAAG,CAAC,SAAS,EAAC,iBAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;AAG5C,oBAAoB;AACpB,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,EAAE;IAClB,OAAO,CAAC,GAAG,CAAC,qDAAqD,IAAI,EAAE,CAAC,CAAC;AAC7E,CAAC,CAAC,CAAC"}
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.mapError = void 0;
const mapError = (err) => {
if (err.name === "OGC_Exception") {
const ogcException = err;
return {
code: ogcException.code,
description: ogcException.description,
name: ogcException.name,
status: 500,
};
}
if (err.name in ["Collection_Not_Found", "Format_Not_Found"]) {
return {
name: err.name,
message: err.message,
status: 404,
};
}
return {
name: err.name,
message: err.message,
status: 500,
};
};
exports.mapError = mapError;
//# sourceMappingURL=ErrorHandler.js.map
\ No newline at end of file
{"version":3,"file":"ErrorHandler.js","sourceRoot":"","sources":["../../src/ErrorHandler.ts"],"names":[],"mappings":";;;AAGO,MAAM,QAAQ,GAAG,CAAC,GAAU,EAAE,EAAE;IACnC,IAAI,GAAG,CAAC,IAAI,KAAK,eAAe,EAAE;QAC9B,MAAM,YAAY,GAAG,GAAgB,CAAC;QACtC,OAAO;YACH,IAAI,EAAE,YAAY,CAAC,IAAI;YACvB,WAAW,EAAE,YAAY,CAAC,WAAW;YACrC,IAAI,EAAE,YAAY,CAAC,IAAI;YACvB,MAAM,EAAE,GAAG;SACd,CAAC;KACL;IACD,IAAI,GAAG,CAAC,IAAI,IAAI,CAAC,sBAAsB,EAAE,kBAAkB,CAAC,EAAE;QAC1D,OAAO;YACH,IAAI,EAAE,GAAG,CAAC,IAAI;YACd,OAAO,EAAE,GAAG,CAAC,OAAO;YACpB,MAAM,EAAE,GAAG;SACd,CAAC;KACL;IACD,OAAO;QACH,IAAI,EAAE,GAAG,CAAC,IAAI;QACd,OAAO,EAAE,GAAG,CAAC,OAAO;QACpB,MAAM,EAAE,GAAG;KACd,CAAC;AACN,CAAC,CAAC;AAtBW,QAAA,QAAQ,YAsBnB"}
\ No newline at end of file
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.FormatNotFoundException = exports.CollectionNotFoundException = exports.loadSubCollections = exports.loadCollections = exports.loadConformance = exports.loadLandingPage = void 0;
const LandingPage_json_1 = __importDefault(require("../containerAPI/LandingPage.json"));
const Conformance_json_1 = __importDefault(require("../containerAPI/Conformance.json"));
const Collections_json_1 = __importDefault(require("../containerAPI/Collections.json"));
const ogc3dcontainerentitiesmodel_1 = require("ogc3dcontainerentitiesmodel");
const ogc3dcontainerentitiesmodel_2 = require("ogc3dcontainerentitiesmodel");
const loadLandingPage = () => {
return ogc3dcontainerentitiesmodel_1.LandingPage.fromJson(LandingPage_json_1.default);
};
exports.loadLandingPage = loadLandingPage;
const loadConformance = () => {
return ogc3dcontainerentitiesmodel_2.Conformance.fromJson(Conformance_json_1.default);
};
exports.loadConformance = loadConformance;
const loadCollections = () => {
return ogc3dcontainerentitiesmodel_1.Collections.fromJson(Collections_json_1.default);
};
exports.loadCollections = loadCollections;
const loadSubCollections = (collectionIds, format) => {
var _a, _b;
let collection = ogc3dcontainerentitiesmodel_1.Collections.fromJson(Collections_json_1.default);
collectionIds.forEach(id => {
let subCollections;
if (collection instanceof ogc3dcontainerentitiesmodel_1.Collections) {
subCollections = collection.collections;
}
else if (collection instanceof ogc3dcontainerentitiesmodel_1._3DContainer) {
subCollections = collection.children;
}
collection = subCollections === null || subCollections === void 0 ? void 0 : subCollections.find(c => c.id == id);
if (!collection) {
throw new CollectionNotFoundException(`Collection with id '${id}' is not found!`);
}
});
if (format) {
let container = collection;
const link = (_a = container === null || container === void 0 ? void 0 : container.content) === null || _a === void 0 ? void 0 : _a.find(link => link.type === format);
if (!link) {
const availableFormats = (_b = container === null || container === void 0 ? void 0 : container.content) === null || _b === void 0 ? void 0 : _b.map(link => link.type);
let exceptionMessage = `Format '${format}' is not found!`;
if (availableFormats && availableFormats.length) {
const distinctFormats = [...new Set(availableFormats)].join(", ");
exceptionMessage += `. Available formats: [${distinctFormats}]`;
}
throw new FormatNotFoundException(exceptionMessage);
}
return link;
}
return collection;
};
exports.loadSubCollections = loadSubCollections;
class CollectionNotFoundException extends Error {
constructor() {
super(...arguments);
this.name = "Collection_Not_Found";
}
}
exports.CollectionNotFoundException = CollectionNotFoundException;
class FormatNotFoundException extends Error {
constructor() {
super(...arguments);
this.name = "Format_Not_Found";
}
}
exports.FormatNotFoundException = FormatNotFoundException;
//# sourceMappingURL=Ogc3D.js.map
\ No newline at end of file
{"version":3,"file":"Ogc3D.js","sourceRoot":"","sources":["../../src/Ogc3D.ts"],"names":[],"mappings":";;;;;;AAAA,wFAA4E;AAC5E,wFAA4E;AAC5E,wFAA4E;AAC5E,6EAAmF;AACnF,6EAAwD;AAEjD,MAAM,eAAe,GAAG,GAAG,EAAE;IAChC,OAAO,yCAAW,CAAC,QAAQ,CAAC,0BAAe,CAAC,CAAC;AACjD,CAAC,CAAC;AAFW,QAAA,eAAe,mBAE1B;AAEK,MAAM,eAAe,GAAG,GAAG,EAAE;IAChC,OAAO,yCAAW,CAAC,QAAQ,CAAC,0BAAe,CAAC,CAAC;AACjD,CAAC,CAAC;AAFW,QAAA,eAAe,mBAE1B;AAEK,MAAM,eAAe,GAAG,GA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C,MAAM,EAAE;gBAC7C,MAAM,eAAe,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBAClE,gBAAgB,IAAI,yBAAyB,eAAe,GAAG,CAAC;aACnE;YACD,MAAM,IAAI,uBAAuB,CAAC,gBAAgB,CAAC,CAAC;SACvD;QACD,OAAO,IAAI,CAAC;KACf;IACD,OAAO,UAAU,CAAC;AACtB,CAAC,CAAC;AA9BW,QAAA,kBAAkB,sBA8B7B;AAEF,MAAa,2BAA4B,SAAQ,KAAK;IAAtD;;QACI,SAAI,GAAG,sBAAsB,CAAC;IAClC,CAAC;CAAA;AAFD,kEAEC;AAED,MAAa,uBAAwB,SAAQ,KAAK;IAAlD;;QACI,SAAI,GAAG,kBAAkB,CAAC;IAC9B,CAAC;CAAA;AAFD,0DAEC"}
\ No newline at end of file
{
"links" : [
{
"title" : "Collections Document",
"rel" : "self",
"href" : "http://localhost:3001/collections",
"type" : "application/json"
}
],
"collections":[
{
"id": "stuttgart",
"title": "Stuttgart 3D City Model",
"description": "3D containers for buildings and bridges in Stuttgart area",
"collectionType": "3d-container",
"extent":{
"spatial":{
"bbox" : [
48.7803555,
9.1697597,
258.6930957,
48.7994618,
9.2174313,
223.4307978
],
"crs" : "http://www.opengis.net/def/crs/OGC/0/CRS84h"
}
},
"links" : [
{
"title" : "Stuttgart 3D Models",
"rel" : "self",
"href" : "http://localhost:3001/collections/stuttgart",
"type" : "application/json"
}
],
"content":[],
"children":[
{
"id": "buildings",
"title": "Stuttgart 3D Buildings",
"description": "3D containers for buildings in Stuttgart area",
"collectionType": "3d-container",
"extent":{
"spatial":{
"bbox" : [
48.7803555,
9.1697597,
258.6930957,
48.7994618,
9.2174313,
223.4307978
],
"crs" : "http://www.opengis.net/def/crs/OGC/0/CRS84h"
}
},
"links" : [
{
"title" : "Stuttgart Buildings",
"rel" : "self",
"href" : "http://localhost:3001/collections/stuttgart/buildings",
"type" : "application/json"
}
],
"content":[],
"children":[
{
"id": "nordbahnhof",
"title": "Stuttgart buildings in nordbahnhof area",
"description": "3D container for nordbahnhof buildings",
"collectionType": "3d-container",
"extent":{
"spatial":{
"bbox" : [
48.7803555,
9.1697597,
258.6930957,
48.7924498,
9.1982883,
232.0435026
],
"crs" : "http://www.opengis.net/def/crs/OGC/0/CRS84h"
}
},
"links" : [
{
"title" : "Nordbahnhof-3D Buildings",
"rel" : "self",
"href" : "http://localhost:3001/collections/stuttgart/buildings/nordbahnhof",
"type" : "application/json"
},
{
"title" : "Nordbahnhof-I3S Buildings",
"rel" : "item",
"href" : "http://localhost:3000/i3s/stuttgart_buildings.html",
"type" : "application/json-i3s"
},
{
"title" : "Nordbahnhof-3D Tiles Buildings",
"rel" : "item",
"href" : "http://localhost:3001/public/3d-tiles/Nordbahnhof/Building/tileset.json",
"type" : "application/json-3dtiles"
}
],
"content":[
{
"title" : "Nordbahnhof Buildings-i3s",
"rel" : "alternate",
"href" : "http://localhost:3000/i3s/stuttgart_buildings.html",
"type" : "application/json-i3s"
},
{
"title" : "Nordbahnhof Buildings-3D Tiles",
"rel" : "original",
"href" : "http://localhost:3001/public/3d-tiles/Nordbahnhof/Building/tileset.json",
"type" : "application/json-3dtiles"
}
],
"children":[]
},
{
"id": "steockach",
"title": "Stuttgart buildings in Steockach area",
"description": "3D container for Steockach buildings",
"collectionType": "3d-container",
"extent":{
"spatial":{
"bbox" : [
48.7840414,
9.1713103,
263.1214739,
48.7994618,
9.2174313,
223.4307978
],
"crs" : "http://www.opengis.net/def/crs/OGC/0/CRS84h"
}
},
"links" : [
{
"title" : "Steockach Buildings",
"rel" : "self",
"href" : "http://localhost:3001/collections/stuttgart/buildings/steockach",
"type" : "application/json"
},
{
"title" : "Steockach Buildings-I3S",
"rel" : "item",
"href" : "http://localhost:3000/i3s/stoeckach_buildings.html",
"type" : "application/json-i3s"
},
{
"title" : "Steockach Buildings-3D Tiles",
"rel" : "item",
"href" : "http://localhost:3001/public/3d-tiles/Steockach/Building/tileset.json",
"type" : "application/json-3dtiles"
}
],
"content":[
{
"title" : "Steockach Buildings-I3S",
"rel" : "alternate",
"href" : "http://localhost:3000/i3s/stoeckach_buildings.html",
"type" : "application/json-i3s"
},
{
"title" : "Steockach Buildings-3D Tiles",
"rel" : "original",
"href" : "http://localhost:3001/public/3d-tiles/Steockach/Building/tileset.json",
"type" : "application/json-3dtiles"
}
],
"children":[]
}
]
},
{
"id": "bridges",
"title": "Stuttgart 3D bridges",
"description": "Stuttgart 3D containers for bridges",
"collectionType": "3d-container",
"extent":{
"spatial":{
"bbox" : [
48.7814954,
9.1732802,
254.0319873,
48.7894124,
9.2149318,
227.2070862
],
"crs" : "http://www.opengis.net/def/crs/OGC/0/CRS84h"
}
},
"links" : [
{
"title" : "Stuttgart Bridges",
"rel" : "self",
"href" : "http://localhost:3001/collections/stuttgart/bridges",
"type" : "application/json"
}
],
"content":[],
"children":[
{
"id": "nordbahnhof",
"title": "Stuttgart bridges in nordbahnhof area",
"description": "3D container for nordbahnhof bridges",
"collectionType": "3d-container",
"extent":{
"spatial":{
"bbox" : [
48.7814954,
9.1732802,
254.0319873,
48.7934077,
9.203286,
235.1384295
],
"crs" : "http://www.opengis.net/def/crs/OGC/0/CRS84h"
}
},
"links" : [
{
"title" : "Nordbahnhof bridges",
"rel" : "self",
"href" : "http://localhost:3001/collections/stuttgart/bridges/nordbahnhof",
"type" : "application/json"
},
{
"title" : "Nordbahnhof bridges-i3s",
"rel" : "item",
"href" : "http://localhost:3000/i3s/stuttgart_bridges.html",
"type" : "application/json-i3s"
},
{
"title" : "Nordbahnhof bridges-3D Tiles",
"rel" : "item",
"href" : "http://localhost:3001/public/3d-tiles/Nordbahnhof/Bridge/tileset.json",
"type" : "application/json-3dtiles"
}
],
"content":[
{
"title" : "Nordbahnhof bridges-i3s",
"rel" : "alternate",
"href" : "http://localhost:3000/i3s/stuttgart_bridges.html",
"type" : "application/json-i3s"
},
{
"title" : "Nordbahnhof bridges-3D Tiles",
"rel" : "original",
"href" : "http://localhost:3001/public/3d-tiles/Nordbahnhof/Bridge/tileset.json",
"type" : "application/json-3dtiles"
}
],
"children":[]
},
{
"id": "steockach",
"title": "Stuttgart bridges in Steockach area",
"description": "3D container for Steockach bridges",
"collectionType": "3d-container",
"extent":{
"spatial":{
"bbox" : [
48.7928776,
9.1788965,
280.6642798,
48.7894124,
9.2149318,
227.2070862
],
"crs" : "http://www.opengis.net/def/crs/OGC/0/CRS84h"
}
},
"links" : [
{
"title" : "Steockach bridges",
"rel" : "self",
"href" : "http://localhost:3001/collections/stuttgart/bridges/steockach",
"type" : "application/json"
},
{
"title" : "Steockach bridges-i3s",
"rel" : "item",
"href" : "http://localhost:3000/i3s/stoeckach_bridges.html",
"type" : "application/json-i3s"
},
{
"title" : "Steockach bridges-3D Tiles",
"rel" : "item",
"href" : "http://localhost:3001/public/3d-tiles/Steockach/Bridge/tileset.json",
"type" : "application/json-i3s"
}
],
"content":[
{
"title" : "Steockach bridges-i3s",
"rel" : "alternate",
"href" : "http://localhost:3000/i3s/stoeckach_bridges.html",
"type" : "application/json-i3s"
},
{
"title" : "Steockach bridges-3D Tiles",
"rel" : "original",
"href" : "http://localhost:3001/public/3d-tiles/Steockach/Bridge/tileset.json",
"type" : "application/json-3dtiles"
}
],
"children":[]
}
]
}
]
}
]
}
{
"conformsTo": [
"http://www.opengis.net/spec/OAPI_Common/1.0/req/core"
]
}
\ No newline at end of file
{
"title": "3D Container API",
"description": "A pilot of an API for 3D containers and tiles.",
"links": [
{
"title": "Service Description",
"href": "https://app.swaggerhub.com/apis/timothy-miller/3D-Data-Container/0.0.1",
"rel": "service-desc"
},
{
"title": "Conformance",
"href": "http://localhost:3001/conformance/",
"rel": "conformance"
},
{
"title": "Collections",
"href": "http://localhost:3001/collections/",
"rel": "data"
}
]
}
\ No newline at end of file
import {NextFunction, Request, Response} from "express";
import express from "express";
import cors from "cors";
import {loadLandingPage, loadConformance, loadCollections, loadSubCollections} from "./src/Ogc3D";
import {mapError} from "./src/ErrorHandler";
const app = express();
app.use(cors());
const PORT = 3001;
// Routes
app.get("/", (req, res) => {
console.debug("Received request for Landing Page");
res.send(loadLandingPage());
});
app.get("/conformance", (req, res) => {
console.debug("Received request for conformance");
res.send(loadConformance());
});
app.get("/collections", (req, res) => {
console.debug("Received request for collections");
res.send(loadCollections());
});
app.get("/collections/*", (req, res) => {
console.debug("Received request for subcollections");
const subCollections = req.params[0].split("/").filter(val => !!val);
res.send(loadSubCollections(subCollections, req.query.format as string | undefined));
});
// Error Handling
// noinspection JSUnusedLocalSymbols
app.use(function (err: Error, req: Request, res: Response, next: NextFunction) {
const errorResponse = mapError(err);
res.status(errorResponse.status).send(errorResponse);
});
app.use("/public",express.static("public"));
// Start Application
app.listen(PORT, () => {
console.log(`⚡️[server]: Server is running at http://localhost:${PORT}`);
});
This diff is collapsed.
{
"name": "ogc3dcontainer",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "nodemon index.ts",
"build": "tsc --project ./",
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://gitlab.com/hanadiEbrahim/ogc3dcontainer.git"
},
"keywords": [],
"author": "",
"license": "ISC",
"bugs": {
"url": "https://gitlab.com/hanadiEbrahim/ogc3dcontainer/issues"
},
"homepage": "https://gitlab.com/hanadiEbrahim/ogc3dcontainer#readme",
"dependencies": {
"@types/cors": "^2.8.9",
"cors": "^2.8.5",
"express": "^4.17.1",
"ogc3dcontainerentitiesmodel": "https://gitlab.com/hanadiEbrahim/ogc3dcontainerentitiesmodel#master"
},
"devDependencies": {
"@types/express": "^4.17.9",
"@types/node": "^14.14.14",
"nodemon": "^2.0.6",
"ts-node": "^9.1.1",
"typescript": "^4.1.3"
}
}
{
"asset" : {
"version" : "0.0"
},
"properties" : {
"gml_id" : {},
"gml_parent_id" : {},
"citygml_target_uri" : {},
"citygml_feature_role" : {},
"citygml_feature_role_attr_name" : {},
"citygml_feature_role_attr_val" : {},
"gml_description" : {},
"gml_name" : {},
"citygml_creationDate" : {},
"citygml_terminationDate" : {},
"externalReference{}.externalObject.name" : {},
"externalReference{}.externalObject.uri" : {},
"externalReference{}.informationSystem" : {},
"citygml_generalizes_to{}.xlink_href" : {},
"citygml_relative_to_terrain" : {},
"citygml_relative_to_water" : {},
"citygml_appearance{}.xlink_href" : {},
"citygml_class" : {},
"citygml_class_codeSpace" : {},
"citygml_function{}" : {},
"citygml_function{}.codeSpace" : {},
"citygml_usage{}" : {},
"citygml_usage{}.codeSpace" : {},
"citygml_year_of_construction" : {},
"citygml_year_of_demolition" : {},
"citygml_is_movable" : {},
"citygml_outer_bridge_construction{}.xlink_href" : {},
"citygml_outer_bridge_installation{}.xlink_href" : {},
"citygml_interior_bridge_installation{}.xlink_href" : {},
"citygml_bounded_by{}.xlink_href" : {},
"citygml_level_of_detail{}" : {},
"citygml_interior_bridge_room{}.xlink_href" : {},
"citygml_consists_of_bridge_part{}.xlink_href" : {},
"citygml_address{}.xlink_href" : {},
"_xmax" : {
"minimum" : 512921.940871,
"maximum" : 513769.388881
},
"_xmin" : {
"minimum" : 512907.306878,
"maximum" : 513580.290288
},
"_ymax" : {
"minimum" : 5403214.62699,
"maximum" : 5404583.694081
},
"_ymin" : {
"minimum" : 5403199.963849,
"maximum" : 5404573.727775
},
"_zmax" : {
"minimum" : 242.71,
"maximum" : 294.42
},
"_zmin" : {
"minimum" : 239.700611,
"maximum" : 292.45
},
"_result" : {},
"longtitude" : {},
"latitude" : {},
"height" : {}
},
"geometricError" : 185.77424837369472,
"root" : {
"boundingVolume" : {
"box" : [ 4156301.4290609984, 671752.4978479487, 4775050.933565218, 1083.2974625029601, 0, 0, 0, 873.8011690623825, 0, 0, 0, 912.8078514207155 ]
},
"refine" : "ADD",
"content" : {
"boundingVolume" : {
"box" : [ 4156301.4290609984, 671752.4978479487, 4775050.933565218, 1083.2974625029601, 0, 0, 0, 873.8011690623825, 0, 0, 0, 912.8078514207155 ]
},
"url" : "data/data0.b3dm"
}
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment