1. A concise explanation of the problem you’re experiencing.
I found some countries/areas missing when trying to display all countries’ boundaries using polygons.
2. A minimal code example. If you’ve found a bug, this helps us reproduce and repair it.
My boundary data comes from NatureEarth(http://www.naturalearthdata.com/downloads/110m-cultural-vectors/110m-admin-0-countries/),I transformed the shape file into GeoJSON.Here is how I display the boundaries below:
var xhr = new XMLHttpRequest();
xhr.open("GET", 'ne_110_country.geojson', true);
xhr.onreadystatechange = function () {
if (xhr.readyState === 4 && xhr.status === 200) {
var data= JSON.parse(xhr.responseText);
data.features.forEach(function(el, i) {
el.geometry.coordinates.forEach(function(geometry_s){
var boundary = {};
geometry_s.forEach(function(coordinates, k) {
var positions= [];
coordinates.forEach(function(coordinate){
positions.push(coordinate[0],coordinate[1]);
});
if (boundary.positions) {
boundary.holes = boundary.holes || [];
boundary.holes.push({
positions: Cesium.Cartesian3.fromDegreesArray(positions)
});
} else {
boundary.positions = Cesium.Cartesian3.fromDegreesArray(positions);
}
});
viewer.entities.add({
polygon: {
hierarchy: boundary,
height: 1,
material: new Cesium.Color(1, 0, 0, .5),
outline: false
}
});
});
});
}
}
xhr.send(null);
3. Context. Why do you need to do this? We might know a better way to accomplish your goal.
I’m participating a project which needs to display countries our users traveled by his own data.Here is how we try to achieve this: Cover all countries that one didn’t go with dark color filled polygons.
4. The Cesium version you’re using, your operating system and browser.
****The version is 1.6.0.
It works fine with my mac's chrome and iPhones.But It comes out different results in android phones:missing polygons are different in different kind of phones.
Here how a Huawei Honor phone displays:
You can see that there is a missing area in Africa.
I just used a simple example to display the missing problems with android phones,it’s more complex in real situation.
For example:It comes different if you choose another way to load polygons:
var promise=Cesium.GeoJsonDataSource.load('ne_110_country.geojson');
promise.then(function(dataSource) {
viewer.dataSources.add(dataSource);
var entities = dataSource.entities.values;
for (var i = 0; i < entities.length; i++) {
var entity = entities[i];
entity.polygon.material = new Cesium.Color(1, 0, 0, .5);
entity.polygon.outline=false;
}
viewer.scene.requestRender();
});
You will see the Antarctic show very different in two coding ways.
I’m a beginner with cesium,it will be very grateful if some one could help me out.