Closed simod closed 11 months ago
I am also encountering this problem now, and I would like to ask how you resolved it.
In my case it was because I was using useGeographics() in openlayers to write in degrees to operate on a 3857 map. Removing it and using proper transformation from degrees did the job
@simod Thanks for your response. If I want to load MVT on Cesium, do I need to convert the MVT service to the 3857 coordinate system? My underlying data is in latitude and longitude, and the published service is also in the 4326 coordinate system. Could you please advise on at which stage this conversion should be done? Below is my code.
const webGLlayer = new VectorTileLayer({ title: "line", style: new Style({ stroke: new Stroke({ color: 'red', width: 2, }), }), source: new VectorTileSource({ format: new MVT(), url: serviceUrl, projection: 'EPSG:4326' }) }) const ol2d = new olMap({ layers: [tileImage, webGLlayer], target: 'cesiumContainer', view: new View({ projection: 'EPSG:4326', center: [113.241212,23.14085], zoom: 12, maxZoom: 19, minZoom: 1 }) }) const ol3d = new OLCesium({ map: ol2d, sceneOptions: { mapProjection: new Cesium.GeographicProjection() } }) ol3d.setEnabled(true)
@simod Hello, I have tried several methods of coordinate transformation, but I still cannot solve the problem. Could you please take the time to look at my code and tell me where I should make the corrections? Or could you please share your relevant code? I would be very grateful.
@RunBoo I see you are using 4326 in the OL View too, so it doesn't need any transformation I think. What is the problem you encounter? Like do the layers disappear when you switch to 3D? Your code seems ok and I don't have any to share as I just do const "cs = new OLCesium({map: map})". By default OLCesium is 3857 so I'd doublecheck that your sceneOptions really does its job properly.
@simod The issue I encountered is that I can load MVT on a 2D map, but not on a 3D map. If it is not possible to convert OLCesium coordinates to 4326, is there any way to load 4326 data services on a 3857 map?
@RunBoo no no, I'm not saying that Cesium can't work on 4326. It's just that I don't know. But if I were you is there the place I'd look first. :)
@simod Thank you for your suggestion. I have tried debugging to locate the problem, but when the coordinate system is 4326, I cannot access the classes related to OLCesium. Therefore, I am not sure how to determine if sceneOptions are taking effect. I will try other methods.
Hi, I'm creating VectorTileLayers which display on the OL map but when switching to the Cesium one they disappear. I also have WKT layers that display correctly. With some debugging I see that this line https://github.com/openlayers/ol-cesium/blob/v2.16/src/olcs/AbstractSynchronizer.ts#L116, is executed correctly for all layers including the VT ones, they just don't appear.
Any suggestion?
Thanks in advance