-
Notifications
You must be signed in to change notification settings - Fork 329
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Polygons are not rendered #350
Comments
Are you using terrain? |
No, I am not using terrain. In any case, I just tested it with a terrain, and the polygon is not rendered either. |
Yyou are not setting any style so maybe this is the reason why nothing is showing up. |
OpenLayers uses a default style when one is not defined. I.e. the above code does render a trapezoid. In any case, I will set a style and test if that way it works in 3D mode. Thanks for the suggestion. |
At the beginning of OL3-Cesium, it was not possible to retrieve the OL3 default style (OL3 internal). |
Unfortunately, I have just tested setting a style, but polygons are still not rendered. |
Strange. Have you compared with what is done in the vectors example? |
In fact, polygons are rendered fine in the vectors example. I will debug that one and update this ticket with any findings. |
Ok, I have identified the cause. I am first creating the map, and then creating an unmanaged vector layer referencing the map. But the map does not reference the layer. Calling map.addLayer() makes the polygons to appear in the 3D map. The reason I am doing it this way is that it seems easier to add and remove the layer when necessary. I have reproduced the same in the vectors sample, just by removing the vectorLayers from the creation of the map object, and referencing the map object in the creation of vectorLayers instead (moving its declaration to after that of the map). Again, that is fixed if I call map.AddLayer(). Now, the question is, is this by design, and my code was not doing things right (it always should add the layer on the definition of the map or call map.addLayer(), even if it works in OpenLayers without it), or is this just a case that is not being handled by ol3-cesium at the moment? |
It is a limitation/design decision of OpenLayers: unmanaged layers are considered internal and are not made discoverable. As a consequence there is no way for OL3-Cesium to detect them and synchronize them automatically. You should either not use unmanaged layers or you could synchronize them yourself (you may want to use the low level facilities from OL3-Cesium for this). |
Thanks a lot. I have amended the code on my side; feel free to close this issue if you feel ol3-cesium works as intended/designed, or leave it open if you would like it to keep track of it. |
Added a limitation section to the README.md pointing to this issue. |
@jmgomezpoveda could you please share the code which is working for you , Im still having the same issue |
@AhammadAliPK following the original code snippet, the fix would be as follows:
|
Thanks , It is working fine, but the problem is when we load 3D as default view , it's not adding the layer . But when we switch 2D and then switch to 3D back and it's working fine. |
I have created a vector layer, which is visible in OpenLayers (2D mode). However, when I enable the 3D mode (Cesium), the polygons are not visible.
I am creating the vector layer as:
The text was updated successfully, but these errors were encountered: