0

I want to create a rectangle around a center point, of x by y miles. So for example:

makeRectangle(pointer, 10, 5);

I ultimately want the bounds, so:

makeBounds(pointer, 10, 5) is fine

However, everything seems to be created in terms of creating edge points, which I'm not clear on how to do with lat longs.

1 Answers1

0

A simple approach would be to use twice the L.Circle workaround.

Creating 2 circles (one for your horizontal distance, one for the vertical) and reading their bounds, you retrieve longitudes and latitudes respectively.

The drawback is that L.Circle is not exact vertically (it does not account for geodesy), and once you move your longitudes vertically, the horizontal distance is no longer exact at those new latitudes.

But as a first approach and for small distances, this method might already be enough for your need.

ghybs
  • 47,565
  • 6
  • 74
  • 99