ol-ext icon indicating copy to clipboard operation
ol-ext copied to clipboard

TouchCursor with different view projection

Open Mika9999 opened this issue 2 years ago • 6 comments

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:

image

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"?

Mika9999 avatar May 13 '22 08:05 Mika9999

This example seems to work for me using EPSG:4326 https://codepen.io/viglino/pen/eYVdwmg

Viglino avatar May 13 '22 09:05 Viglino

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

Mika9999 avatar May 16 '22 11:05 Mika9999

It seems useGeographic is experimental and TouchCursor doesn't calculate offset position in this case...

Viglino avatar May 20 '22 08:05 Viglino

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

Mika9999 avatar May 23 '22 06:05 Mika9999

It seems events on interactions doesn't take it into account and resolution is not set... making it impossible to calculate cursor offset.

Viglino avatar May 23 '22 07:05 Viglino

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).

juhakip avatar Jul 07 '22 05:07 juhakip