TypeError: Cannot set property 'geometry' of undefined
See original GitHub issueI’m rendering Cesium with Angular-Cesium. But this problem also occured when just running Cesium.js, which is Why I’m also posting here.
I’m rendering a kml stream and updating it every 1.5 seconds. Sometimes, it loads perfectly, no errors, and sometimes I get the error below. this is with no code changes. Also, If I set the interval to 10 seconds, It seems to solve the problem as far as I can tell… But of course, I’m trying to get an interval of 1.5 seconds.

My code is really simple, here is my Angular code. Notice the AfterViewInit hook.
export class GlobeComponent implements OnInit, AfterViewInit {
cesiumViewer;
options;
kml$;
constructor(private viewersManager: MapsManagerService,
private globeService: GlobeService) {}
ngOnInit() {
// console.log(this.cesiumViewer);
}
ngAfterViewInit() {
const viewer = this.viewersManager.getMap('main-map').getCesiumViewer()
this.options = {
camera: viewer.scene.camera,
canvas: viewer.scene.canvas
};
this.kml$ = new Cesium.KmlDataSource(this.options);
viewer.dataSources.add(
this.kml$
);
setInterval(() => {
this.kml$.load('http://..../rest/kml/accept/all', this.options);
}, 1500);
}
}
Issue Analytics
- State:
- Created 6 years ago
- Comments:14 (8 by maintainers)
Top Results From Across the Web
Google Maps: Cannot read property 'geometry' of undefined
Im getting an error when trying to show markers on a map, from a JSON feed. Im getting alot of adresses, and then...
Read more >TypeError: Cannot set property 'geometry' of undefined
TypeError : Cannot set property 'geometry' of undefined ... I am trying to set the colour of an entity using ColorMaterialProperty.
Read more >TypeError: Cannot set property 'geometry' of undefined - Support
This error is happening in 2.30 from, at least, september 2020. Cannot check in play since the build is from late may Build...
Read more >Intermittent error: "TypeError: Cannot set property 'geometry' of ...
Intermittent error: "TypeError: Cannot set property 'geometry' of undefined" ... Hello,. From the code you posted, everything looks fine. Is there ...
Read more >Cannot set property 'geometry' of undefined - Esri Community
"Cannot set property 'geometry' of undefined" and the form fails to submit. Depending on the browser, sometimes there is no message and the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I’m not sure which is the right fix. It seems dangerous for the batch to be directly manipulating the
geometryInstances. I’m not sure from reading it whether the batch code was written with the awareness that the array is actually being shared or not. @mramato any recollections here?Alternatively we could change
packCombineGeometryParametersto just discardcreateGeometryResultsfor which we no longer have ageometryInstances. I guess they are correlated by index in the arrays. Maybe it needs to be smarter than that, since presumably adding new entities duringCREATINGcould happen to, or we could delete then add and end up referencing the wrong geometry instance. This goes back to the danger of directly manipulatingPrimitive.geometryInstancesexternally from the batch, I guess.