ol-ext
ol-ext copied to clipboard
TouchCursor with different view projection
Hi everyone.
I am developing an Angular app with multiple ol layers. I would like to use the projection "EPSG:4326" for the map, but then the osm tiles are reprojected. Therefore I use the function useGeographic() of "ol/proj". In the description it says "Use geographic coordinates (WGS-84 datum) in API methods. This includes all API methods except those that interact with tile grids". This works very well. But when I use the touch cursor and try to move it, I get the following error message:
I noticed that the touch cursor does not work if the map has a projection other than "EPSG:3857".
Is there a way to use the touch cursor with a projection other than "EPSG:3857"?
This example seems to work for me using EPSG:4326 https://codepen.io/viglino/pen/eYVdwmg
You're right, it works with "EPSG:4326". I made a mistake when debugging the app. Nevertheless, the touch cursor does not work when using the method useGeographic(). So I forked your example, changed the projection and added the method. https://codepen.io/mika9999/pen/RwQKgMq
It seems useGeographic is experimental and TouchCursor doesn't calculate offset position in this case...
useGeographic was an experimental feature, but since ol version 6.13.0 it is officially included in the standard https://github.com/openlayers/openlayers/releases/tag/v6.13.0
It seems events on interactions doesn't take it into account and resolution is not set... making it impossible to calculate cursor offset.
This could be related to the problems I had with TargetControl. useGeographic() made the target stuck to coordinates 0,0. I also used Angular (if it has something to do with this).