vue-leaflet/Vue2Leaflet

2 Markers don't shortest path

Pakinwet opened this issue · 2 comments

Description

I put marker pins to Japan and USA but result is around the world. I don't know why not directly Japan to USA?

Expected Results

Screen Shot 2563-10-07 at 13 50 50

Browsers Affected

  • Chrome

Versions

  • Leaflet: ^1.7.1
  • Vue: ^2.6.11
  • Vue2Leaflet: ^2.5.2
mikeu commented

Hi @Pakinwet , thanks for the feedback! Have you built the same map in Leaflet (without Vue2Leaflet), and seen different behaviour? I haven't worked much with trying to make maps cross the antimeridian, but my first thought is that this is how the underlying Leaflet map works by default.

If you put together a sample application showing what you've tried, we might be able to provide a little more help. For example, what longitude did you provide for USA? What wrapping settings have you chosen for the map and the CRS? What logic did you put in to try to display the shortest distance between your two points?

Thanks a lot for your fast help.
For now I solved my issue with handle longitudes outside the [-180..180] range.
Ref: https://stackoverflow.com/questions/40532496/wrapping-lines-polygons-across-the-antimeridian-in-leaflet-js