1. A concise explanation of the problem you’re experiencing.
I need to load all countries JSON File in GeoJsonDataSource.load.How can I get this source file? Can you please provide the all counties JSON file?
I have downloaded the ne_10m_admin_0_countries2.json file from forums support but I am getting the below error in console.
An error occurred while rendering. Rendering has stopped.
undefined
DeveloperError: normalized result is not a number
Error
at new DeveloperError (http://localhost/Cesium-1.58/Source/Core/DeveloperError.js:43:19)
at Function.Cartesian3.normalize (http://localhost/Cesium-1.58/Source/Core/Cartesian3.js:421:19)
at Ellipsoid.geodeticSurfaceNormalCartographic (http://localhost/Cesium-1.58/Source/Core/Ellipsoid.js:353:27)
at Ellipsoid.cartographicToCartesian (http://localhost/Cesium-1.58/Source/Core/Ellipsoid.js:390:14)
at Object.PolygonGeometryLibrary.subdivideRhumbLine (http://localhost/Cesium-1.58/Source/Core/PolygonGeometryLibrary.js:212:31)
at createGeometryFromPositions (http://localhost/Cesium-1.58/Source/Core/PolygonOutlineGeometry.js:90:60)
at Function.PolygonOutlineGeometry.createGeometry (http://localhost/Cesium-1.58/Source/Core/PolygonOutlineGeometry.js:555:36)
at createPolygonOutlineGeometry (http://localhost/Cesium-1.58/Source/Workers/createPolygonOutlineGeometry.js:16:39)
at createGeometry (http://localhost/Cesium-1.58/Source/Workers/createGeometry.js:47:40)
at callAndWrap (http://localhost/Cesium-1.58/Source/Workers/createTaskProcessorWorker.js:20:31)
2. A minimal code example. If you’ve found a bug, this helps us reproduce and repair it.
/This is my current code/
var viewer = new Cesium.Viewer(‘cesiumContainer’);
var highlightedEntity;
var highlightColor = Cesium.Color.YELLOW.withAlpha(0.6);
var normalColor = Cesium.Color.SLATEGREY.withAlpha(0.6);
//A property that returns a highlight color if the entity is currently moused over, or a default color otherwise.
function createCallback(entity){
var colorProperty = new Cesium.CallbackProperty(function(time, result){
if(highlightedEntity === entity){
return Cesium.Color.clone(highlightColor, result);
}
return Cesium.Color.clone(normalColor, result);
}, false);
return new Cesium.ColorMaterialProperty(colorProperty);
}
var promise = Cesium.GeoJsonDataSource.load(’…/…/SampleData/ne_10m_admin_0_countries2.json’);
promise.then(function(dataSource) {
viewer.dataSources.add(dataSource);
//Get the array of entities
var entities = dataSource.entities.values;
for (var i = 0; i < entities.length; i++) {
var entity = entities[i];
entity.polygon.material = createCallback(entity);
}
}).otherwise(function(error){
//Display any errrors encountered while loading.
window.alert(error);
});
var scene = viewer.scene;
var handler = viewer.screenSpaceEventHandler;
handler.setInputAction(function(movement) {
var pickedObject = scene.pick(movement.endPosition);
if (Cesium.defined(pickedObject) && pickedObject.id instanceof Cesium.Entity) {
highlightedEntity = pickedObject.id;
} else{
highlightedEntity = undefined;
}
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
3. Context. Why do you need to do this? We might know a better way to accomplish your goal.
-
I want to highlight the country when hovering over the county and appears the country name also.
-
I need to load all countries JSON File in GeoJsonDataSource.load.How can I get this source file? Can you please provide the all counties JSON file?
-
I have downloaded the ne_10m_admin_0_countries2.json file from forums support but I am getting the below error in console.
-
Is it possible to set URL on click of any country? How can I achieve this? Which Parameter do we need to pass in the JSON Data?
4. The Cesium version you’re using, your operating system and browser.
- **Cesium Version: 1.58
- Browser: Google Chrome
- Operating System: Windows**