Hi.. i am new Cesium user..
i face a problem, after i generated the 3D object from ContextCapture i got a json file also with Cesium file, because i choose Cesium format options for the output. after that i open it in web browser and i see the object is moving, not stay still on the map when i zoom with mouse and change the angle. it seems like not generated by WGS84 and i found when it generated in Cesium Output the reference coordinate is "Earth Center Earth Fixed", its fix format i cannot change it to WGS84.
anyone know how can i deal with this problem ?
It sounds like the tileset is below the surface. You can see whether that is the case by setting viewer.scene.globe.depthTestAgainstTerrain = true. Depending on how far below the surface it is you may be able to adjust the height of the tileset like this Sandcastle example: https://cesiumjs.org/Cesium/Apps/Sandcastle/?src=3D%20Tiles%20Adjust%20Height.html&label=3D%20Tiles.
Earth Center Earth Fixed and WGS84 (in Cartesian coordinates) are basically equivalent, so that shouldn’t be the issue.
If setting the height doesn’t work, feel free to send me the tileset and I can see what might be the problem.
Thank you so much for your kind response…
it seems you are right. it is because of the height of the tileset…
i already set the height but nothing changed. do you know why ? did i miss something ?
here is my tileset
Thanks for sending over the tileset. I think the problem is the version of Cesium bundled in that Context Capture output doesn’t support the modelMatrix property.
To fix that you’ll need to copy a newer version of Cesium into your project. Download the latest Cesium release here: https://github.com/AnalyticalGraphicsInc/cesium/releases. Then get the Build/Cesium folder and replace the Cesium/App/Cesium folder in your project.
After that, use the following code in main.js:
tileset.readyPromise.then(function(tileset) {
var height = 200.0; // Set this to anything
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());
tileset.modelMatrix = Cesium.Matrix4.fromTranslation(translation);
});
``
perfectly great. That is solved my problem.
Thank you so much for your help.
Hi Sean,
i face another problem that is i want to load a large file (about 80MB) of geojson format in cesium.
i have loaded it and it made the web loading very very slow.
i need your suggestions to make the loading fast enough. do you have any ?
Thank You
Is loading the main issue or is it also performance? You could try splitting the geojson into multiple geojsons and load them individually. One step further is to convert it to 3D Tiles. I’m not sure about the state of open source tools for that, but we are working on our own tilers. Check out https://groups.google.com/d/msg/cesium-dev/xLkYIuku9hA/t_AxUBepAgAJ if you want us to try converting it.
I’m not sure what to recommend for speeding up that process . An alternate solution is to convert geojson to 3D Tiles, if you send me that data I could try experimenting
the performance is fine. just loading run very slow. its because loading geojson file that i attach on it.
i have checked the link that you give me but i still cant get the way how to convert it into 3D tiles.
here is my geojson file. i wonder how to convert it into 3D tiles. maybe you can share the step to do it…
Thanks in advance
The idea behind that link is we are working on 3D Tiles conversion for data sources like GeoJSON and are asking to convert others’ data to help improve our tools. All that code is closed-source so I can’t recommend an exact procedure if you want to convert it yourself.
I will have a go at converting your GeoJSON file and send you the tileset it produces.
Here is the tileset: https://drive.google.com/open?id=0BwZiE_1SDr-XbW12RXR3RlZ3NzQ
It’s not perfect - some buildings weren’t able to process but I didn’t look much into why. The buildings are also not aligned exactly with the imagery. But for a rough conversion it seems pretty good and loads fast.
Thank you so much Sean…
it loads faster than before…
i have put it in my localhost and it works and loads perfectly.
but, i have an issue. i add the tileset to my website and somehow it cant be loaded…
the tileset cant appear even i already put the script as same as i put it in my localhost…
i wonder why… is there anything that i miss ?
I’m not sure… Do you see any errors in the browser’s console?
Try validating your newroads.json file with this site:
http://geojsonlint.com
Hi
a quick question about 3D tiles.
Do they support surfaces identification? aka facades for the buildings?
I see they are of LOD2 (root types and details) but would it be possible to click on individual surfaces as well, similar to GeoJSON's?
Thanks
Hello,
i have exactly the same problem. I replaced cesium with the new version but i can not understand where in the main.js file i should copy the code.
here is my main.js code
// Get your own Bing Maps API key at https://www.bingmapsportal.com, prior to publishing your Cesium application:
Cesium.BingMapsApi.defaultKey = 'Al2VHpX7Fw7ooj66DNPJ_8LJSYU20ZRNSGze3Ejf-6Dv6OfAhnjh6vuSSDsGvW1y';
// Construct the default list of terrain sources.
var terrainModels = Cesium.createDefaultTerrainProviderViewModels();
// Construct the viewer with just what we need for this base application
var viewer = new Cesium.Viewer('cesiumContainer', {
timeline:false,
animation:false,
vrButton:true,
sceneModePicker:false,
infoBox:true,
scene3DOnly:true,
terrainProviderViewModels: terrainModels,
selectedTerrainProviderViewModel: terrainModels[1] // Select STK high-res terrain
});
// No depth testing against the terrain to avoid z-fighting
viewer.scene.globe.depthTestAgainstTerrain = false;
// Add credit to Bentley
viewer.scene.frameState.creditDisplay.addDefaultCredit(new Cesium.Credit(‘Cesium 3D Tiles produced by Bentley ContextCapture’, ‘Resources/logoBentley.png’, ‘http://www.bentley.com/’));
// Bounding sphere
var boundingSphere = new Cesium.BoundingSphere(Cesium.Cartesian3.fromDegrees(22.73182731, 37.98228101, 94.3943674), 42.96957873);
// Override behavior of home button
viewer.homeButton.viewModel.command.beforeExecute.addEventListener(function(commandInfo) {
// Fly to custom position
viewer.camera.flyToBoundingSphere(boundingSphere);
// Tell the home button not to do anything
commandInfo.cancel = true;
});
// Set custom initial position
viewer.camera.flyToBoundingSphere(boundingSphere, {duration: 0});
/*---------------------------------------------------------------------------------**//**
* @bsimethod
+---------------+---------------+---------------+---------------+---------------+------*/
// Functions to adapt screen space error and memory use to the device
var isMobile = {
Android: function() {
return navigator.userAgent.match(/Android/i);
},
BlackBerry: function() {
return navigator.userAgent.match(/BlackBerry/i);
},
iOS: function() {
return navigator.userAgent.match(/iPhone|iPad|iPod/i);
},
Opera: function() {
return navigator.userAgent.match(/Opera Mini/i);
},
Windows: function() {
return navigator.userAgent.match(/IEMobile/i);
},
any: function() {
return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
}
};
// Add tileset. Do not forget to reduce the default screen space error to 1
var tileset = viewer.scene.primitives.add(new Cesium.Cesium3DTileset({
url: '../Scene/Production_3.json',
maximumScreenSpaceError : isMobile.any() ? 8 : 1, // Temporary workaround for low memory mobile devices - Increase maximum error to 8.
maximumNumberOfLoadedTiles : isMobile.any() ? 10 : 1000 // Temporary workaround for low memory mobile devices - Decrease (disable) tile cache.
}));
Yes 3D Tiles supports surface identification, though in a more generic way. Any triangle in the tile can be uniquely identified if that’s desired. Our work-in-progress GeoJSON outputs 3D Tiles with surface identification of facades, etc.
Place the code right at the end of the file, after the var tileset
section.
i have checked in that website and it doesnt have any problem..
newroads.json still can be loaded..
but, i wonder why my tileset can not be loaded in website.
var model = viewer.scene.primitives.add(new Cesium.Cesium3DTileset({
url: '../App/Resources/model/tileset.json',
maximumScreenSpaceError : isMobile.any() ? 8 : 1, // Temporary workaround for low memory mobile devices - Increase maximum error to 8.
maximumNumberOfLoadedTiles : isMobile.any() ? 10 : 1000 // Temporary workaround for low memory mobile devices - Decrease (disable) tile cache.
}));
My model stands on the air. If i reduce the value at 0.0 its still on the air.
var height = 200.0; // Set this to anything
i try to use negative values but things get worse.