Out of Memory GeoJson Polygon over pole

I am working with rendering geojson polygon over the pole.

const viewer = new Cesium.Viewer("cesiumContainer");
viewer.dataSources.add(Cesium.GeoJsonDataSource.load(
  
    {
  "type": "Polygon",
  "coordinates": [
    [
      [
        162.54547592697853,
        64.21170721414221
      ],
      [
        165.40682429653052,
        66.23744654139226
      ],
      [
        173.14331481439808,
        69.5865572641851
      ],
      [
        -179.3014465682426,
        71.3258282120596
      ],
      [
        -178.63295937932804,
        71.55534775152034
      ],
      [
        -172.14768792938744,
        72.8558285132589
      ],
      [
        -168.02242672817235,
        73.11377249420599
      ],
      [
        -160.4206094117684,
        74.02717362396251
      ],
      [
        -148.95508294803247,
        74.37875259970912
      ],
      [
        -147.6262698308168,
        74.38030078278418
      ],
      [
        -141.44085852243217,
        73.95588146178899
      ],
      [
        -136.46761059170333,
        73.88550606011712
      ],
      [
        -134.13554745292546,
        73.5425150344817
      ],
      [
        -124.64965674137802,
        72.71008316375602
      ],
      [
        -118.46103875493714,
        71.20472814931408
      ],
      [
        -116.03093421752781,
        70.82482109175771
      ],
      [
        -108.52301320265362,
        68.67660444595882
      ],
      [
        -101.83183113797456,
        65.22964721928031
      ],
      [
        -101.63407468660192,
        65.16160581029851
      ],
      [
        -99.64005641529577,
        63.5406439800342
      ],
      [
        -98.3941688807834,
        62.941764909544375
      ],
      [
        -97.1873225485642,
        61.50323595139824
      ],
      [
        -97.04583907913228,
        61.41451774837451
      ],
      [
        -96.9443321666731,
        61.28277950207905
      ],
      [
        -89.45384535180987,
        55.34672288562576
      ],
      [
        -84.70267193087905,
        52.55045602108068
      ],
      [
        -81.33104919827356,
        50.19379557492561
      ],
      [
        -76.00620510198316,
        47.74402125665213
      ],
      [
        -75.0480179512583,
        47.24967945776138
      ],
      [
        -72.73649996597861,
        45.98392296191541
      ],
      [
        -71.36824697767995,
        45.57209221150613
      ],
      [
        -68.48767037478274,
        44.630096642318286
      ],
      [
        -63.78255616598904,
        42.85952352851585
      ],
      [
        -62.09847554878624,
        42.57035190170464
      ],
      [
        -56.87927492049979,
        41.49653794958728
      ],
      [
        -54.923073020630184,
        41.0224997352702
      ],
      [
        -54.57875807348841,
        40.93490117512159
      ],
      [
        -52.753268974868945,
        40.86770723924209
      ],
      [
        -49.97266200843409,
        40.70960868978451
      ],
      [
        -45.71214328562465,
        40.335475897918414
      ],
      [
        -45.24549682879038,
        40.28469139949006
      ],
      [
        -41.86365483797073,
        40.6088095802375
      ],
      [
        -39.013831717879896,
        40.803531175758614
      ],
      [
        -38.302995701287,
        40.84102948947251
      ],
      [
        -35.91223558409243,
        40.93490117512158
      ],
      [
        -34.380955718959015,
        41.314899084522175
      ],
      [
        -30.18640768164415,
        42.23194857461754
      ],
      [
        -29.471608549183603,
        42.37058171607389
      ],
      [
        -26.708437491591788,
        42.85952352851585
      ],
      [
        -24.187409297489268,
        43.84520199908957
      ],
      [
        -21.288797035275447,
        44.873457046735155
      ],
      [
        -17.754493691602267,
        45.9839229619154
      ],
      [
        -16.273664709781002,
        46.806936678402536
      ],
      [
        -14.135403110931081,
        47.92000808180145
      ],
      [
        -12.727837410931174,
        48.6065357327788
      ],
      [
        -10.391035972744202,
        49.66998520732305
      ],
      [
        -9.159944459307273,
        50.1937955749256
      ],
      [
        -8.949640141464029,
        50.350939471117265
      ],
      [
        -8.629380980931511,
        50.48237359347103
      ],
      [
        -7.082661441954102,
        51.585942953648434
      ],
      [
        -6.712967710864034,
        51.83909139907549
      ],
      [
        -4.492374716708066,
        52.67045287870477
      ],
      [
        -2.9184029683329986,
        53.21677184066798
      ],
      [
        -2.6988248251169313,
        53.29026364144825
      ],
      [
        -1.4358111136284997,
        54.043144147665416
      ],
      [
        -1.2500609184832716,
        54.150519773417265
      ],
      [
        1.9437532732010876,
        55.16492818286429
      ],
      [
        2.403334162197254,
        55.23202508050019
      ],
      [
        3.866110063730641,
        55.71272143331583
      ],
      [
        4.668526470280811,
        55.92818016595535
      ],
      [
        4.856938218130977,
        56.02204880385676
      ],
      [
        9.174290524885349,
        57.2263949696669
      ],
      [
        10.56150896395717,
        57.41560955163457
      ],
      [
        13.826588422167154,
        57.794381609355725
      ],
      [
        15.516111211507482,
        58.24378078753353
      ],
      [
        16.82852633121306,
        58.28204616265416
      ],
      [
        17.782137885876196,
        58.451868905800964
      ],
      [
        20.021595521201526,
        58.817027322551425
      ],
      [
        21.616379173997306,
        59.049190573615036
      ],
      [
        22.254588585607948,
        59.13578155802215
      ],
      [
        26.037104619808577,
        59.07037488785225
      ],
      [
        28.075123520231006,
        59.29462092582629
      ],
      [
        29.655148588035313,
        59.444783264736266
      ],
      [
        32.098532590994225,
        59.44598189898302
      ],
      [
        36.23938598053336,
        59.34360332535319
      ],
      [
        38.387599070994156,
        58.99468855879219
      ],
      [
        41.10042861581576,
        58.918465725973576
      ],
      [
        42.558682497176406,
        58.853801066688135
      ],
      [
        43.45982158712651,
        58.62715961284813
      ],
      [
        48.39471794736826,
        58.086244806026656
      ],
      [
        51.01834685731699,
        57.71243848425285
      ],
      [
        56.380852322626,
        56.19794063936588
      ],
      [
        58.01694714209234,
        55.97474808684974
      ],
      [
        61.63339921845284,
        54.879017397419844
      ],
      [
        62.70050898871616,
        54.28124399863344
      ],
      [
        72.58009143171435,
        50.53086193701502
      ],
      [
        82.56413037698454,
        47.75545495764592
      ],
      [
        92.64362487048341,
        46.049456505754165
      ],
      [
        102.77865028139574,
        45.47376438804345
      ],
      [
        112.91367569230808,
        46.049456505754165
      ],
      [
        122.99317018580683,
        47.7554549576459
      ],
      [
        132.97720913107713,
        50.53086193701504
      ],
      [
        142.8567915740753,
        54.28124399863346
      ],
      [
        152.6719459780428,
        58.88702285528293
      ],
      [
        162.54547592697853,
        64.21170721414221
      ]
    ]
  ]
}

, {
  stroke: Cesium.Color.HOTPINK,
  fill: Cesium.Color.PINK,
  strokeWidth: 3,
  markerSymbol: '?'
}));

consistent error:

Error: out of memory

CesiumWidget.prototype.showErrorPanel@https://sandcastle.cesium.com/CesiumUnminified/Cesium.js:241389:21 CesiumWidget/this._onRenderError@https://sandcastle.cesium.com/CesiumUnminified/Cesium.js:241109:16 Event.prototype.raiseEvent@https://sandcastle.cesium.com/CesiumUnminified/Cesium.js:20811:22 tryAndCatchError@https://sandcastle.cesium.com/CesiumUnminified/Cesium.js:238243:26 Scene4.prototype.render@https://sandcastle.cesium.com/CesiumUnminified/Cesium.js:238296:23 CesiumWidget.prototype.render@https://sandcastle.cesium.com/CesiumUnminified/Cesium.js:241461:19 render2@https://sandcastle.cesium.com/CesiumUnminified/Cesium.js:240884:20 FrameRequestCallbackrender2@https://sandcastle.cesium.com/CesiumUnminified/Cesium.js:240885:34 FrameRequestCallbackrender2@https://sandcastle.cesium.com/CesiumUnminified/Cesium.js:240885:34 FrameRequestCallback*render2@https://sandcastle.cesium.com/CesiumUnminified/Cesium.js:240885:34

It is not unlikely that this is unrelated to GeoJSON. You might want to try to disable the globe:

const viewer = new Cesium.Viewer("cesiumContainer", {
  globe: false // Disable the globe
});

If this “resolves” the error, then it is unrelated to the GeoJSON, and most likely the same as this one:

Thanks for the suggestion, but unfortunately I get same out of memory error.

I have two different sandcastle polygons that fail over the north pole. (with globe disabled):

const viewer = new Cesium.Viewer("cesiumContainer", {
  globe: false // Disable the globe
});
viewer.dataSources.add(Cesium.GeoJsonDataSource.load(
  
    {
  "type": "Polygon",
  "coordinates": [
    [
      [
        162.54547592697853,
        64.21170721414221
      ],
      [
        165.40682429653052,
        66.23744654139226
      ],
      [
        173.14331481439808,
        69.5865572641851
      ],
      [
        -179.3014465682426,
        71.3258282120596
      ],
      [
        -178.63295937932804,
        71.55534775152034
      ],
      [
        -172.14768792938744,
        72.8558285132589
      ],
      [
        -168.02242672817235,
        73.11377249420599
      ],
      [
        -160.4206094117684,
        74.02717362396251
      ],
      [
        -148.95508294803247,
        74.37875259970912
      ],
      [
        -147.6262698308168,
        74.38030078278418
      ],
      [
        -141.44085852243217,
        73.95588146178899
      ],
      [
        -136.46761059170333,
        73.88550606011712
      ],
      [
        -134.13554745292546,
        73.5425150344817
      ],
      [
        -124.64965674137802,
        72.71008316375602
      ],
      [
        -118.46103875493714,
        71.20472814931408
      ],
      [
        -116.03093421752781,
        70.82482109175771
      ],
      [
        -108.52301320265362,
        68.67660444595882
      ],
      [
        -101.83183113797456,
        65.22964721928031
      ],
      [
        -101.63407468660192,
        65.16160581029851
      ],
      [
        -99.64005641529577,
        63.5406439800342
      ],
      [
        -98.3941688807834,
        62.941764909544375
      ],
      [
        -97.1873225485642,
        61.50323595139824
      ],
      [
        -97.04583907913228,
        61.41451774837451
      ],
      [
        -96.9443321666731,
        61.28277950207905
      ],
      [
        -89.45384535180987,
        55.34672288562576
      ],
      [
        -84.70267193087905,
        52.55045602108068
      ],
      [
        -81.33104919827356,
        50.19379557492561
      ],
      [
        -76.00620510198316,
        47.74402125665213
      ],
      [
        -75.0480179512583,
        47.24967945776138
      ],
      [
        -72.73649996597861,
        45.98392296191541
      ],
      [
        -71.36824697767995,
        45.57209221150613
      ],
      [
        -68.48767037478274,
        44.630096642318286
      ],
      [
        -63.78255616598904,
        42.85952352851585
      ],
      [
        -62.09847554878624,
        42.57035190170464
      ],
      [
        -56.87927492049979,
        41.49653794958728
      ],
      [
        -54.923073020630184,
        41.0224997352702
      ],
      [
        -54.57875807348841,
        40.93490117512159
      ],
      [
        -52.753268974868945,
        40.86770723924209
      ],
      [
        -49.97266200843409,
        40.70960868978451
      ],
      [
        -45.71214328562465,
        40.335475897918414
      ],
      [
        -45.24549682879038,
        40.28469139949006
      ],
      [
        -41.86365483797073,
        40.6088095802375
      ],
      [
        -39.013831717879896,
        40.803531175758614
      ],
      [
        -38.302995701287,
        40.84102948947251
      ],
      [
        -35.91223558409243,
        40.93490117512158
      ],
      [
        -34.380955718959015,
        41.314899084522175
      ],
      [
        -30.18640768164415,
        42.23194857461754
      ],
      [
        -29.471608549183603,
        42.37058171607389
      ],
      [
        -26.708437491591788,
        42.85952352851585
      ],
      [
        -24.187409297489268,
        43.84520199908957
      ],
      [
        -21.288797035275447,
        44.873457046735155
      ],
      [
        -17.754493691602267,
        45.9839229619154
      ],
      [
        -16.273664709781002,
        46.806936678402536
      ],
      [
        -14.135403110931081,
        47.92000808180145
      ],
      [
        -12.727837410931174,
        48.6065357327788
      ],
      [
        -10.391035972744202,
        49.66998520732305
      ],
      [
        -9.159944459307273,
        50.1937955749256
      ],
      [
        -8.949640141464029,
        50.350939471117265
      ],
      [
        -8.629380980931511,
        50.48237359347103
      ],
      [
        -7.082661441954102,
        51.585942953648434
      ],
      [
        -6.712967710864034,
        51.83909139907549
      ],
      [
        -4.492374716708066,
        52.67045287870477
      ],
      [
        -2.9184029683329986,
        53.21677184066798
      ],
      [
        -2.6988248251169313,
        53.29026364144825
      ],
      [
        -1.4358111136284997,
        54.043144147665416
      ],
      [
        -1.2500609184832716,
        54.150519773417265
      ],
      [
        1.9437532732010876,
        55.16492818286429
      ],
      [
        2.403334162197254,
        55.23202508050019
      ],
      [
        3.866110063730641,
        55.71272143331583
      ],
      [
        4.668526470280811,
        55.92818016595535
      ],
      [
        4.856938218130977,
        56.02204880385676
      ],
      [
        9.174290524885349,
        57.2263949696669
      ],
      [
        10.56150896395717,
        57.41560955163457
      ],
      [
        13.826588422167154,
        57.794381609355725
      ],
      [
        15.516111211507482,
        58.24378078753353
      ],
      [
        16.82852633121306,
        58.28204616265416
      ],
      [
        17.782137885876196,
        58.451868905800964
      ],
      [
        20.021595521201526,
        58.817027322551425
      ],
      [
        21.616379173997306,
        59.049190573615036
      ],
      [
        22.254588585607948,
        59.13578155802215
      ],
      [
        26.037104619808577,
        59.07037488785225
      ],
      [
        28.075123520231006,
        59.29462092582629
      ],
      [
        29.655148588035313,
        59.444783264736266
      ],
      [
        32.098532590994225,
        59.44598189898302
      ],
      [
        36.23938598053336,
        59.34360332535319
      ],
      [
        38.387599070994156,
        58.99468855879219
      ],
      [
        41.10042861581576,
        58.918465725973576
      ],
      [
        42.558682497176406,
        58.853801066688135
      ],
      [
        43.45982158712651,
        58.62715961284813
      ],
      [
        48.39471794736826,
        58.086244806026656
      ],
      [
        51.01834685731699,
        57.71243848425285
      ],
      [
        56.380852322626,
        56.19794063936588
      ],
      [
        58.01694714209234,
        55.97474808684974
      ],
      [
        61.63339921845284,
        54.879017397419844
      ],
      [
        62.70050898871616,
        54.28124399863344
      ],
      [
        72.58009143171435,
        50.53086193701502
      ],
      [
        82.56413037698454,
        47.75545495764592
      ],
      [
        92.64362487048341,
        46.049456505754165
      ],
      [
        102.77865028139574,
        45.47376438804345
      ],
      [
        112.91367569230808,
        46.049456505754165
      ],
      [
        122.99317018580683,
        47.7554549576459
      ],
      [
        132.97720913107713,
        50.53086193701504
      ],
      [
        142.8567915740753,
        54.28124399863346
      ],
      [
        152.6719459780428,
        58.88702285528293
      ],
      [
        162.54547592697853,
        64.21170721414221
      ]
    ]
  ]
}

, {
  stroke: Cesium.Color.HOTPINK,
  fill: Cesium.Color.PINK,
  strokeWidth: 3,
  markerSymbol: '?'
}));

&&:

const viewer = new Cesium.Viewer("cesiumContainer", {
  globe: false // Disable the globe
});
viewer.dataSources.add(Cesium.GeoJsonDataSource.load(
  
    {
  "type": "MultiPolygon",
  "coordinates": [
    [
      [
        [
          180,
          83.25950690025758
        ],
        [
          -77.54606454110618,
          87.68319474532885
        ],
        [
          -54.45042043002852,
          86.2863475031227
        ],
        [
          -63.20304152543611,
          85.54631268465184
        ],
        [
          -222.1026149467653,
          89.37026701682173
        ],
        [
          -161.43883829272139,
          85.19275823532868
        ],
        [
          -218.03532463166172,
          85.87995692342048
        ],
        [
          -151.62826997546102,
          82.31512984802572
        ],
        [
          -150.7539304307993,
          82.09961945258823
        ],
        [
          -212.38848112354353,
          82.50456390120775
        ],
        [
          -164.7562696979832,
          80.45227990645046
        ],
        [
          -156.21295008248757,
          79.14916834325732
        ],
        [
          -204.03243721150378,
          79.33366078005612
        ],
        [
          -167.622747983219,
          78.08521650465674
        ],
        [
          -152.76042660105514,
          76.4700973668721
        ],
        [
          -190.8545412901319,
          76.56253728993656
        ],
        [
          -160.97619614125065,
          75.76145763168945
        ],
        [
          -146.35711039460526,
          74.57701299402288
        ],
        [
          -169.8387882459129,
          74.61720393478964
        ],
        [
          -143.37165449431149,
          74.04633332852202
        ],
        [
          -132.80858416718385,
          73.37058377284146
        ],
        [
          -124.0543989274302,
          72.21768663256343
        ],
        [
          -118.5981052707071,
          71.22551999772281
        ],
        [
          -115.2399015548967,
          70.4425737451865
        ],
        [
          -108.22353701422752,
          68.14868472450655
        ],
        [
          -102.72413557577528,
          65.59332443613364
        ],
        [
          -99.44421193646815,
          63.38820143924294
        ],
        [
          -98.46730704855258,
          62.798027310210344
        ],
        [
          -96.9905025617414,
          61.3254108894901
        ],
        [
          -89.47095591748581,
          55.39606629400612
        ],
        [
          -81.32745225999341,
          50.24945081549908
        ],
        [
          -72.71720243032952,
          46.0450309167551
        ],
        [
          -63.75073717847342,
          42.924845690508924
        ],
        [
          -54.53636658293164,
          41.00289097422089
        ],
        [
          -45.1934738280272,
          40.353594975912884
        ],
        [
          -35.85058107312277,
          41.00289097422089
        ],
        [
          -26.63621047758099,
          42.924845690508924
        ],
        [
          -17.66974522572488,
          46.0450309167551
        ],
        [
          -9.059495396061005,
          50.24945081549908
        ],
        [
          -7.145921825539038,
          51.45881078775737
        ],
        [
          -3.2254774438814295,
          53.06924203790599
        ],
        [
          -2.039816867831219,
          53.67903888207141
        ],
        [
          2.99338855372105,
          55.38017517782369
        ],
        [
          8.881488584761692,
          56.97527588143632
        ],
        [
          12.747641293678498,
          57.60010962622077
        ],
        [
          15.037826158383524,
          58.0834510897931
        ],
        [
          15.319997189606402,
          58.10571235810616
        ],
        [
          21.892579720925895,
          58.92768658250511
        ],
        [
          23.90911739625648,
          58.97136893064065
        ],
        [
          29.385890543954282,
          59.317981804069795
        ],
        [
          36.24102428804649,
          59.177944950511716
        ],
        [
          36.591604397138255,
          59.139253011405806
        ],
        [
          42.97393984936437,
          58.6935105508758
        ],
        [
          50.30429542663162,
          57.65173882423579
        ],
        [
          55.496570379181996,
          56.40734711108107
        ],
        [
          56.830713263871985,
          56.164347144604086
        ],
        [
          61.7155320955932,
          54.68200953099131
        ],
        [
          62.11961523452482,
          54.49581901559338
        ],
        [
          72.08049025985967,
          50.77351363155182
        ],
        [
          82.13042769407996,
          48.019081374737105
        ],
        [
          92.26660386553775,
          46.32609025694799
        ],
        [
          102.4539354588937,
          45.75481022476736
        ],
        [
          112.64126705224966,
          46.32609025694799
        ],
        [
          122.77744322370745,
          48.01908137473711
        ],
        [
          132.82738065792773,
          50.77351363155182
        ],
        [
          142.7882556832626,
          54.49581901559339
        ],
        [
          152.70956017915475,
          59.06728617058024
        ],
        [
          162.7316340087465,
          64.35196515298844
        ],
        [
          167.30536286197847,
          66.90877717483653
        ],
        [
          173.45760698583183,
          69.30359321049433
        ],
        [
          180,
          71.1055963906343
        ],
        [
          180,
          83.25950690025758
        ]
      ]
    ],
    [
      [
        [
          180,
          83.25950690025758
        ],
        [
          180,
          71.1055963906343
        ],
        [
          180.80323586850608,
          71.32683555898079
        ],
        [
          180.90367116828935,
          71.34860691874697
        ],
        [
          192.61106843492007,
          73.14821102702082
        ],
        [
          215.77007592928283,
          74.79224045870843
        ],
        [
          205.27988278365734,
          74.81312401600415
        ],
        [
          227.70511000306374,
          76.90586362122865
        ],
        [
          210.9319589003332,
          76.9566371317354
        ],
        [
          229.5265885156461,
          79.32757482640729
        ],
        [
          210.43099521964604,
          79.42288046540294
        ],
        [
          221.60053696493708,
          81.53088561903049
        ],
        [
          199.66892770902888,
          81.7252482018079
        ],
        [
          202.8288553637403,
          82.86739168712315
        ],
        [
          180,
          83.25950690025758
        ]
      ]
    ]
  ]
}

, {
  stroke: Cesium.Color.HOTPINK,
  fill: Cesium.Color.PINK,
  strokeWidth: 3,
  markerSymbol: '?'
}));

I tried out both sandcastles, and could not reproduce an Out Of Memory Error until now.

For further analysis, it might be helpful to provide additional details: On which browser do you observe the error? Are there any specific actions that help to ‘provoke’ the error (like a certain pattern of zooming/panning that causes the error to occur more quickly)?

(My link to that other issue was only a first guess, based on the description until now. But beyond that (if it is related to GeoJSON in particular), maybe someone from the CesiumJS core team can chime in here with further ideas…)

I resolved this issue by adding the following points, between the extreme longitudes:

[
-180.0,
90.0
],
[
180.0,
90.0
]

This is a geojson.io image, but cesuim ceased to crash by adding these two points

Great to see that the issue was resolved.

But I’m still a bit curious what might have caused the issue. I started the sandcastles and opened the ‘Memory’ tab of the browser tools, and did see the memory increasing during the interaction, but it was also decreasing before any OOME occurred (so this seemed to be normal GC behavior).

Maybe someone (@jjhembd ?) wants to have a short look at the sandcastles. If the issue can be reproduced elsewhere, it should be tracked in Issues · CesiumGS/cesium · GitHub .

Hi @algo-rithm, I can’t reproduce the error. What version of Cesium are you using? We fixed some issues with large polygons over the poles in the 1.110 and 1.111 releases.