Skip to content
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

WMTS layer with custom EPSG projection fails in Cesium #771

Closed
bampakoa opened this issue Jul 15, 2020 · 3 comments
Closed

WMTS layer with custom EPSG projection fails in Cesium #771

bampakoa opened this issue Jul 15, 2020 · 3 comments

Comments

@bampakoa
Copy link
Contributor

bampakoa commented Jul 15, 2020

Hi,

I am trying to render a WMTS layer from URL http://geoportal.cuzk.cz/WMTS_ORTOFOTO/WMTService.aspx using the projection EPSG:5221 (here are the specs of the projection). The layer is correctly rendered in OpenLayers but that is not the same for Cesium. However, network requests seem to fire and respond correctly. I can actually see the tiles in the responses of the network tab.

I have put in place an example of what I am trying to achieve here:

  • I have dumbed the capabilities file locally so that I can pass tileMatrixSet and extent properties in the source layer.
  • I am using proj4 to define the EPSG projection and register it with OpenLayers.
  • I also apply a transformation between 4326 and 3857 projections.

After some debugging I came to the conclusion that the tileLayerToImageryLayer function returns null because the 5221 projection fails to pass the isCesiumProjection function here.
Alternatively, I tried to add an if statement so that I can check whether the source is of type WMTS, before the check here and create the provider inside my statement. In this scenario, Cesium reported logs in the console that it could not find tile coordinates.

I have searched through the repository about similar problems and I think that Cesium cannot handle custom projections but I am not 100% sure. I would appreciate it if you could help me.

Thanks!

@gberaudo
Copy link
Member

Hi @bampakoa, CesiumJS does not support projections other than EPSG:4326 and EPSG:3857.

There was this PR: CesiumGS/cesium#7502 which is stalled and only focused in adding local projection support to the 2D and columbus views (so not the 3D globe we use in OL-Cesium).

Your OpenLayers map is using the default EPSG:3857 projection. However, there is some special support in OpenLayers for client side raster reprojection. So what you see in 2D is the result of the internal (and I guess blurry) reprojection by OpenLayers of your EPSG:5221 layer.

I did some experiments in exposing the raster reprojection capabilities of OpenLayers in OL-Cesium but there were cases not working and I did not pursue. There was also some help from @samuel-girard who ported the code to newer OL-Cesium version (see #690).

For low traffic you can do on-the-fly server side reprojection to EPSG:3857; for higher traffic you may prefer to pre-generate the tiles.

Then you need to handle the substitution of the layer in the RasterSynchronizer. It is not very well documented but this behaviour is a core feature of OL-Cesium. I can improve that documentation.

@bampakoa
Copy link
Contributor Author

@gberaudo thanks very much for your feedback. I have some questions though regarding your comments:

CesiumJS does not support projections other than EPSG:4326 and EPSG:3857.

How does the WMS example work with a custom projection? Does it use another technique than client side reprojection?

Your OpenLayers map is using the default EPSG:3857 projection. However, there is some special support in OpenLayers for client side raster reprojection. So what you see in 2D is the result of the internal (and I guess blurry) reprojection by OpenLayers of your EPSG:5221 layer.

So, the result of the client side raster reprojection is not actually supported in Cesium?

There was also some help from @samuel-girard who ported the code to newer OL-Cesium version (see #690).

I tried to apply the changes of this PR in my code with no luck. Do you think it should work anyway?

It is not very well documented but this behaviour is a core feature of OL-Cesium. I can improve that documentation.

If you could provide some sort of documentation, that would be awesome!

@wangxiaofengx
Copy link

Old iron, I also want to know how to load the EPSG:4526 projection. I converted the "bbox" parameter when loading the WMS service, and the graphics can be loaded, but there will be offsets. I don’t know how to load the WMTS service. I hope you can publish it when you find a solution. Thank you very much!

@bampakoa bampakoa closed this as not planned Won't fix, can't repro, duplicate, stale Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants