leaflet

How to create a LatLngBounds around a LatLng point with a distance in meters?


I would like to create a square (LatLngBounds) around a central point (LatLng) at X meters.


Solution

  • Use the L.LatLng.toBounds() method, e.g.

    var center = L.latLng(40,-3);
    var bounds = center.toBounds(500);
    

    or

    var bounds = L.latLng(40,-3).toBounds(500)