Commit 7c336d76 authored by Sven Schneider's avatar Sven Schneider
Browse files

added a HFT pointcloud demo and the point cloud data

parent 8ce45e4a
Pipeline #5248 passed with stages
in 36 seconds
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Pointcloud Demo at HFT</title>
<!-- <link rel="stylesheet" href="css/myCesiumStyle.css">
<link rel="stylesheet" href="css/legend.css">
<link rel="stylesheet" href="css/index.css" media="screen">
<link rel="stylesheet" href="css/form_joeStyle.css" media="screen"> -->
<link
href="https://cesium.com/downloads/cesiumjs/releases/1.69/Build/Cesium/Widgets/widgets.css"
rel="stylesheet"
/>
<!-- <link
href="css/my_button.css"
rel="stylesheet"
/> -->
<script
src="https://code.jquery.com/jquery-2.2.4.min.js"
integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44="
crossorigin="anonymous"
></script>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/jquery-cookie/1.4.1/jquery.cookie.min.js"
integrity="sha256-1A78rJEdiWTzco6qdn3igTBv9VupN3Q1ozZNTR4WE/Y="
crossorigin="anonymous"
></script>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.8.3/modernizr.min.js"
integrity="sha256-0rguYS0qgS6L4qVzANq4kjxPLtvnp5nn2nB5G1lWRv4="
crossorigin="anonymous"
></script>
<script src="https://cesium.com/downloads/cesiumjs/releases/1.81/Build/Cesium/Cesium.js"></script>
<link
rel="stylesheet"
href="https://use.fontawesome.com/releases/v5.1.1/css/all.css"
integrity="sha384-O8whS3fhG2OnA5Kas0Y9l3cfpmYjapjI0E4theH4iuMD+pLhbf6JI0jIMfYcK3yZ"
crossorigin="anonymous"
/>
</head>
<body>
<script src="HFT.js"></script>
<style>
@import url(templates/bucket.css);
</style>
<div id="cesiumContainer" class="canvas fullSize">
<div id="loadingOverlay">
<h1>Loading...</h1>
</div>
<div id="toolbar">
</div>
<script src="https://cpwebassets.codepen.io/assets/common/stopExecutionOnTimeout-1b93190375e9ccc259df3a57c1abc0e64599724ae30d7ea4c6877eb615f89387.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.6/js/bootstrap.min.js"></script>
</body>
</html>
$(function () {
// specifiy credentials and assets from Cesium ION account
Cesium.Ion.defaultAccessToken =
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJiYjY5ZTAxNy03YTc0LTQyZTYtYjJlMC0xYzYwNTAzNDQ0ZjUiLCJpZCI6MjkwNCwiaWF0IjoxNjM1NDEzOTI0fQ.Xhmt0sD4Dda4Q46FBYew4wPbqlJ4T8U9n1nNNwGyH7o";
// setting up Cesium Viewer
var viewer = new Cesium.Viewer("cesiumContainer", {
imageryProvider: new Cesium.IonImageryProvider({ assetId: 3 }), //3 bing maps with labels // use Sentinel2 imagery as default assetID:3954
/////////////////////////////////////////
// Note the next 3 lines specify that the Cesium Terrain should be used. ION account is needed
// For a 'flat' Earth the z-offsets below for each of the tilesets needs to be adjusted
// comment the next 3 lines to remove the Cesium terrain (Resulution approx. 30m)
/////////////////////////////////////////
terrainProvider: new Cesium.CesiumTerrainProvider({
url: Cesium.IonResource.fromAssetId(1),
}),
});
viewer.scene.globe.enableLighting = true; // set lighting to true
// define a function to zoom to the tileset (invoke later)
var zoomAll = function (tileset) {
return new Promise(function (resolve, reject) {
if (!tileset) {
reject("Tileset is undifined");
}
viewer.camera.viewBoundingSphere(
tileset.boundingSphere,
new Cesium.HeadingPitchRange(0, -0.5, 400)
);
viewer.camera.lookAtTransform(Cesium.Matrix4.IDENTITY);
resolve();
});
};
//////////////////////////// load 3d building tiles or OSM 3d Buildings ///////////////////////
// here is the switch to switch between different 3d buildings
const LOAD_3DTILES = true;
if (LOAD_3DTILES) {
// load 3d Tile set of SToeckach.
var tileset = viewer.scene.primitives.add(
new Cesium.Cesium3DTileset({
url: Cesium.IonResource.fromAssetId(656401),
})
);
//////// important value. to find the correct value trail and error is needed for a perfect fit
const BUILDIG_TILESET_HEIGHT_OFFSET = 54;
tileset.readyPromise.then(function (tileset) {
var height = BUILDIG_TILESET_HEIGHT_OFFSET;
var cartographic = Cesium.Cartographic.fromCartesian(
tileset.boundingSphere.center
);
var surface = Cesium.Cartesian3.fromRadians(
cartographic.longitude,
cartographic.latitude,
0.0
);
var offset = Cesium.Cartesian3.fromRadians(
cartographic.longitude,
cartographic.latitude,
height
);
var translation = Cesium.Cartesian3.subtract(
offset,
surface,
new Cesium.Cartesian3()
);
// now shift / translate the tileset by the translation vector defined above
tileset.modelMatrix = Cesium.Matrix4.fromTranslation(translation);
//return zoomAll(tileset); // zoom or rather go to the translated tileset
});
}
/////////////////////////////////////////////////////////////////////
// Alternatively, instead of using the Stoeckach LOD1 Building 3d Tiles,
// use OSM Buildings from Cesium ION assets - in this case set LOAD_3DTILES variable in Line 41 to 'false'
////////////////////////////////////////////////////////
else {
var osmBuildings = Cesium.createOsmBuildings();
osmBuildings.readyPromise
.then(function (osmBuildings) {
viewer.scene.primitives.add(osmBuildings);
})
.otherwise(function (error) {
console.log(error);
});
// now zoom to target and set camera view angle to some oblique angle: use '-Cesium.Math.PI_OVER_TWO' to look down nadir.
// if you use '+Cesium.Math.PI_OVER_TWO', you look into space.
viewer.camera.setView({
destination: Cesium.Cartesian3.fromDegrees(
9.172183958234173,
48.78029680030391,
20000
),
orientation: {
heading: 0.0,
pitch: -Cesium.Math.PI_OVER_TWO, // set an oblique viewing angle
roll: 0.0,
},
});
}
tileset.style = new Cesium.Cesium3DTileStyle({
show: false
});
////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////
// HFT PointCloud Tileset.
////////////////////////////////////////////////////////////////////////////////////
const PCOFFSET = 0;
var HFTBuildingsPC = viewer.scene.primitives.add(
new Cesium.Cesium3DTileset({
url: Cesium.IonResource.fromAssetId(655879),
})
);
HFTBuildingsPC.readyPromise.then(function (HFTBuildingsPC) {
var height = PCOFFSET;
var cartographic = Cesium.Cartographic.fromCartesian(
HFTBuildingsPC.boundingSphere.center
);
var surface = Cesium.Cartesian3.fromRadians(
cartographic.longitude,
cartographic.latitude,
0.0
);
var offset = Cesium.Cartesian3.fromRadians(
cartographic.longitude,
cartographic.latitude,
height
);
var translation = Cesium.Cartesian3.subtract(
offset,
surface,
new Cesium.Cartesian3()
);
// now shift / translate the tileset by the translation vector defined above
HFTBuildingsPC.modelMatrix = Cesium.Matrix4.fromTranslation(translation);
return zoomAll(HFTBuildingsPC); // zoom or rather go to the translated tileset
});
HFTBuildingsPC.style = new Cesium.Cesium3DTileStyle({
color: "color('blue',0.3)",
// color: "color('red')" ,
pointSize: 3
});
///////////////////////////// innenhof PC
var HFTInnehof = viewer.scene.primitives.add(
new Cesium.Cesium3DTileset({
url: Cesium.IonResource.fromAssetId(656854),
})
);
HFTInnehof.style = new Cesium.Cesium3DTileStyle({
// color: "color('blue',0.3)",
// color: "color('red')" ,
pointSize: 3
});
});
\ No newline at end of file
{
"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_appearance{}.xlink_href" : {},
"citygml_class" : {},
"citygml_function{}" : {},
"citygml_usage{}" : {},
"citygml_year_of_construction" : {},
"citygml_year_of_demolition" : {},
"citygml_roof_type" : {},
"citygml_measured_height" : {},
"citygml_measured_height_units" : {},
"citygml_storeys_above_ground" : {},
"citygml_storeys_below_ground" : {},
"citygml_storey_heights_above_ground" : {},
"citygml_storey_heights_above_ground_units" : {},
"citygml_storey_heights_below_ground" : {},
"citygml_storey_heights_below_ground_units" : {},
"citygml_outer_building_installation{}.xlink_href" : {},
"citygml_interior_building_installation{}.xlink_href" : {},
"citygml_bounded_by{}.xlink_href" : {},
"citygml_level_of_detail{}" : {},
"citygml_interior_room{}.xlink_href" : {},
"citygml_consists_of_building_part{}.xlink_href" : {},
"citygml_address{}.xlink_href" : {},
"citygml_class_codeSpace" : {},
"citygml_function{}.codeSpace" : {},
"citygml_relative_to_terrain" : {},
"citygml_relative_to_water" : {},
"citygml_roof_type_codeSpace" : {},
"citygml_usage{}.codeSpace" : {}
},
"geometricError" : 0,
"root" : {
"boundingVolume" : {
"box" : [ 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1 ]
},
"refine" : "ADD"
}
}
\ No newline at end of file
{
"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_level_of_detail{}" : {},
"citygml_bounded_by{}.xlink_href" : {}
},
"geometricError" : 396711.76592209144,
"root" : {
"boundingVolume" : {
"box" : [ 4633165.434450356, -228558.3942693551, -3336252.087495386, 2346678.7596468395, 0, 0, 0, 4262894.157088595, 0, 0, 0, 3416844.927609143 ]
},
"refine" : "ADD",
"content" : {
"boundingVolume" : {
"box" : [ 4633165.434450356, -228558.3942693551, -3336252.087495386, 2346678.7596468395, 0, 0, 0, 4262894.157088595, 0, 0, 0, 3416844.927609143 ]
},
"url" : "data/data0.b3dm"
}
}
}
\ No newline at end of file
{
"asset" : {
"version" : "0.0"
},
"properties" : {
"gml_id" : {},
"citygml_target_uri" : {},
"gml_description" : {},
"gml_name" : {},
"citygml_city_object_member{}.xlink_href" : {},
"citygml_appearance_member{}.xlink_href" : {},
"gml_feature_member{}.xlink_href" : {}
},
"geometricError" : 0,
"root" : {
"boundingVolume" : {
"box" : [ 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1 ]
},
"refine" : "ADD"
}
}
\ No newline at end of file
{
"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_appearance{}.xlink_href" : {},
"citygml_level_of_detail{}" : {},
"citygml_address{}.xlink_href" : {},
"citygml_relative_to_terrain" : {},
"citygml_relative_to_water" : {}
},
"geometricError" : 554746.0922003174,
"root" : {
"boundingVolume" : {
"box" : [ 4647182.957770776, 941418.2842070983, -241538.5984202819, 3106476.1574063054, 0, 0, 0, 4747588.411081147, 0, 0, 0, 10543251.98452883 ]
},
"refine" : "ADD",
"content" : {
"boundingVolume" : {
"box" : [ 4647182.957770776, 941418.2842070983, -241538.5984202819, 3106476.1574063054, 0, 0, 0, 4747588.411081147, 0, 0, 0, 10543251.98452883 ]
},
"url" : "data/data0.b3dm"
}
}
}
\ No newline at end of file
{
"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_appearance{}.xlink_href" : {},
"citygml_level_of_detail{}" : {},
"citygml_opening{}.xlink_href" : {},
"citygml_relative_to_terrain" : {},
"citygml_relative_to_water" : {}
},
"geometricError" : 6220640.393693003,
"root" : {
"boundingVolume" : {
"box" : [ 4152655.4193076184, 1207518.2101985747, -452149.9848242649, 4450963.161384763, 0, 0, 0, 8645554.853694515, 0, 0, 0, 10967180.788356729 ]
},
"refine" : "ADD",
"content" : {
"boundingVolume" : {
"box" : [ 4152655.4193076184, 1207518.2101985747, -452149.9848242649, 4450963.161384763, 0, 0, 0, 8645554.853694515, 0, 0, 0, 10967180.788356729 ]
},
"url" : "data/data0.b3dm"
}
}
}
\ No newline at end of file
{
"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_level_of_detail{}" : {},
"citygml_opening{}.xlink_href" : {}
},
"geometricError" : 3133391.787350238,
"root" : {
"boundingVolume" : {
"box" : [ 4345930.077932538, -478080.35152594314, -2840829.4380748877, 4039135.2092558476, 0, 0, 0, 5145724.965101182, 0, 0, 0, 6154616.651056409 ]
},
"refine" : "ADD",
"content" : {
"boundingVolume" : {
"box" : [ 4345930.077932538, -478080.35152594314, -2840829.4380748877, 4039135.2092558476, 0, 0, 0, 5145724.965101182, 0, 0, 0, 6154616.651056409 ]
},
"url" : "data/data0.b3dm"
}
}
}
\ No newline at end of file
{
"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_level_of_detail{}" : {},
"citygml_opening{}.xlink_href" : {}
},
"geometricError" : 3850475.765483168,
"root" : {
"boundingVolume" : {
"box" : [ 4653278.7459433405, -198976.08881537674, -3091330.147480038, 3179055.9297861834, 0, 0, 0, 2563062.1838500174, 0, 0, 0, 4882747.018296868 ]
},
"refine" : "ADD",
"content" : {
"boundingVolume" : {
"box" : [ 4653278.7459433405, -198976.08881537674, -3091330.147480038, 3179055.9297861834, 0, 0, 0, 2563062.1838500174, 0, 0, 0, 4882747.018296868 ]
},
"url" : "data/data0.b3dm"
}
}
}
\ No newline at end of file
{
"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_appearance{}.xlink_href" : {},
"citygml_level_of_detail{}" : {},
"citygml_opening{}.xlink_href" : {},
"citygml_relative_to_terrain" : {},
"citygml_relative_to_water" : {}
},
"geometricError" : 4794745.619712457,
"root" : {
"boundingVolume" : {
"box" : [ 4236011.84854161, 1174707.3335270765, -452829.51998172514, 4282762.646826001, 0, 0, 0, 8579955.582078673, 0, 0, 0, 10965864.725552153 ]
},
"refine" : "ADD",
"content" : {
"boundingVolume" : {
"box" : [ 4236011.84854161, 1174707.3335270765, -452829.51998172514, 4282762.646826001, 0, 0, 0, 8579955.582078673, 0, 0, 0, 10965864.725552153 ]
},
"url" : "data/data0.b3dm"
}