Polygons missing in android phones.

60 views
Skip to first unread message

Hm Jing

unread,
Aug 14, 2019, 11:34:53 PM8/14/19
to cesium-dev
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:

ed5cfce1a766ef80cd32fa1117970bc5.png

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.

b7d87f98d23e86063fa83a1835e105ad.png43f781388632271aac9491c83a5a3c17.png



I'm a beginner with cesium,it will be very grateful if some one could help me out.




Hm Jing

unread,
Aug 15, 2019, 2:15:49 AM8/15/19
to cesium-dev
The attachment is what geometry file I use.
ne_110_country.geojson

Omar Shehata

unread,
Aug 16, 2019, 11:43:37 AM8/16/19
to cesium-dev
Are you able to put together a subset of this GeoJSON that shows the issue? Perhaps just a few of those missing countries in Africa? 

I'm unable to reproduce this because running the GeoJSON you provided shows this error in Cesium:

An error occurred while rendering.  Rendering has stopped.
undefined
DeveloperError: normalized result is not a number
Error
    at
new DeveloperError (https://cesiumjs.org/releases/1.57/Source/Core/DeveloperError.js:43:19)
    at
Function.Cartesian3.normalize (https://cesiumjs.org/releases/1.57/Source/Core/Cartesian3.js:421:19)
    at
Ellipsoid.geodeticSurfaceNormalCartographic (https://cesiumjs.org/releases/1.57/Source/Core/Ellipsoid.js:353:27)
    at
Ellipsoid.cartographicToCartesian (https://cesiumjs.org/releases/1.57/Source/Core/Ellipsoid.js:390:14)
    at
Object.PolygonGeometryLibrary.subdivideRhumbLine (https://cesiumjs.org/releases/1.57/Source/Core/PolygonGeometryLibrary.js:212:31)
    at createGeometryFromPositions
(https://cesiumjs.org/releases/1.57/Source/Core/PolygonOutlineGeometry.js:90:60)
    at
Function.PolygonOutlineGeometry.createGeometry (https://cesiumjs.org/releases/1.57/Source/Core/PolygonOutlineGeometry.js:555:36)
    at createPolygonOutlineGeometry
(https://cesiumjs.org/releases/1.57/Source/Workers/createPolygonOutlineGeometry.js:16:39)
    at createGeometry
(https://cesiumjs.org/releases/1.57/Source/Workers/createGeometry.js:47:40)
    at callAndWrap
(https://cesiumjs.org/releases/1.57/Source/Workers/createTaskProcessorWorker.js:20:31)


Do you not get this error? Here it is in a hosted Sandcastle in CesiumJS 1.57

Hm Jing

unread,
Aug 18, 2019, 10:08:16 PM8/18/19
to cesium-dev
1、That error that seems come from the geometry of the Antarctica occurred if scene3DOnly is not true.
2、The missing areas can't be predicted while every country can disappear if you change the order of the countries or add some other geometries.
Reply all
Reply to author
Forward
0 new messages