Jomaar
Jomaar

Reputation: 84

Geo Lat/Lng normalize in Javascript

Hello I have the problem that i use leaflet and I dont boundbox the map. Now if an user is drag the map and going out of the normal -180 to 180 lng or -90 to 90 lat my markers dont shown at the new location.

The marker will requested from an api I have written. Where I use the boundbox coordinates. The problem now is, that I send something like:

lat_min:-23.563987128451217
lat_max:70.61261423801925
lon_min:-343.828125
lon_max:136.40625

to my script and I don't know how i can normalize the coordinates correct to pass the degrees.

EDIT 24.10.2016 01:33 UTC

My MySQL use between:

geolat: {
  $between: [lat_min, lat_max]
},
geolon: {
  $between: [lon_min, lon_max]
},

Thank you for your hints and tips.

Upvotes: 1

Views: 1019

Answers (1)

TrickOrTreat
TrickOrTreat

Reputation: 911

Dude leaflet itself provides wrapLatLng which can be used as map.wrapLatLng(latLngPoint), this returns normalized form of latitude longitude how we need.

Upvotes: 0

Related Questions