You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In my project all vectorlayers should be created by a factory class and then added to olcesium, it is confusing to see that layers defined in the same class then added to map at once can be seen both in openlayers and cesium, but if the layers were created elsewhere(like factory class), they can't be loaded in cesium, like the example below:
layer doesn't show in cesium, but can be seen in openlayers:
// use factory class to create vectorlayerexportdefaultclassFactoryClass{publicstaticgetLayer(){let_layer: any=newVectorLayer({source: newVectorSource({format: newGeoJSON(),url: 'some url'})});return_layer;}}// a class initialize openlayers and olcesiumexportclassA{this.map=newMap({target: "map",layers: [],view: newView({center: fromLonLat([0,0]),zoom: 12,}),controls: [],})this.integratedMap=newOLCesium({map: this.map});this.map2d=this.integratedMap.getOlMap();letlayer=FactoryClass.getLayer();this.map2d.addLayer(layer);// doesn't show in cesium }
however this works both in openlayers and cesium:
exportclassA{this.map=newMap({target: "map",layers: [],view: newView({center: fromLonLat([0,0]),zoom: 12,}),controls: [],})this.integratedMap=newOLCesium({map: this.map});this.map2d=this.integratedMap.getOlMap();let_layer: any=newVectorLayer({source: newVectorSource({format: newGeoJSON(),url: 'some url'})});this.map2d.addLayer(_layer);// show correctly in openlayers and cesium}
why does this happen? how can i fix this so that i can use factory class to create vectorlayers and make them both shown in openlayers and cesium?
The text was updated successfully, but these errors were encountered:
Hi @Irresistiblea , OL-Cesium detects and then transform the type of layer by using instanceof. Your application must be duplicating some OpenLayers classes so the layers are not recognized.
It looks like a packaging problem on your side, which is not caused by OL-Cesium.
I will keep your issue opened so that we add some section to the documentation that explains how one gets in that situation.
In my project all vectorlayers should be created by a factory class and then added to olcesium, it is confusing to see that layers defined in the same class then added to map at once can be seen both in openlayers and cesium, but if the layers were created elsewhere(like factory class), they can't be loaded in cesium, like the example below:
layer doesn't show in cesium, but can be seen in openlayers:
however this works both in openlayers and cesium:
why does this happen? how can i fix this so that i can use factory class to create vectorlayers and make them both shown in openlayers and cesium?
The text was updated successfully, but these errors were encountered: