getsmap / smap-responsive

A JavaScript framework for simple creation of web maps with responsive design supporting a range of different browsers and devices
GNU General Public License v3.0
14 stars 12 forks source link

Wrap longitude #262

Open johanlahti opened 7 years ago

johanlahti commented 7 years ago

When panning the world east or westwards the map repeats itself to imitate a turning globe. However, the longitude coordinate does not reset at 180 or 0 degrees (expected behaviour in Leaflet). Thus, the after one panning to the east the longitude will be 180< deg and to the west <-180 deg. Apart from weird-looking coordinates (e.g. long==-129381723) it gives problems on e.g. getFeature requests to WMS/WFS services.

The solution is to call .wrap() on all LatLng objects before handling them: http://leafletjs.com/reference.html#latlng-wrap