Sandcastle.addToolbarButton('ROOF MODEL', function(){
try{
var positionOnEllipsoid = Cesium.Cartesian3.fromDegrees(18.070008205824664, 59.323336434606304);
var modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(positionOnEllipsoid);
viewer.entities.suspendEvents();
viewer.entities.removeAll();
var url = 'http://127.0.0.1:4001//wordpress/wp-content/plugins/lftgly/datasources/gltf/model/ID_0.gltf';
var height = 0; //height above ellipsoid in meters;
var positions = [Cesium.Cartographic.fromDegrees(18.070008205824664, 59.323336434606304, height)];
var promiseTerrainHeight = Cesium.sampleTerrain(viewer.terrainProvider, 11, positions);
Cesium.when(promiseTerrainHeight, function(updatedPositions) {
// positions[0].height and positions[1].height have been updated.
// updatedPositions is just a reference to positions.
height = positions[0].height;
console.log("height = " + positions[0].height);
var position = Cesium.Cartesian3.fromDegrees(18.070008205824664, 59.323336434606304, height);
var heading = Cesium.Math.toRadians(0);
var pitch = 0;
var roll = 0;
var orientation = Cesium.Transforms.headingPitchRollQuaternion(position, heading, pitch, roll);
var modelTerrain =
viewer.entities.add({
name : url,
position : position,
orientation : orientation,
model : {
uri : url,
minimumPixelSize : 128
}
});
viewer.trackedEntity = modelTerrain;
viewer.entities.resumeEvents();
Cesium.when(modelTerrain.readyPromise).then(function(){
//modelTerrain.addEventListener;
});
});
} catch(error){
var strMessage = '...an error occurred adding Cesium Model (terrain): ' + error.message;
console.log(strMessage);
}
});
Hi,I have been struggling several weeks to convert a model I have in ESRI shape file format to glTF and visualize it properly on Cesium!
...What is the best streamlined process to convert and visualize models from shape files?
...if the model is already georeferenced it should be possible to upload it without having to specify position and orientation, but I could not figure out how to do so!
If the exported multipatch is in a projected coordinate system, such as a building stored in a UTM zone, then a KML file containing the coordinates as WGS84 will also be created in the output folder
"how did you get that?" - ESRI's ArcGIS software calculated that coordinate; when exporting the multipatch .shp to COLLADA .dae, ESRI includes a .kml
I could only find one reference in ESRI ArcGIS help regarding that exported KML containing an origin point coordinate for the model
If the exported multipatch is in a projected coordinate system, such as a building stored in a UTM zone, then a KML file containing the coordinates as WGS84 will also be created in the output folder
On Saturday, December 24, 2016 at 5:25:17 PM UTC-5, Left Gully wrote: