Java - Generate internal bounding boxes starting from a bigger geographic bounding box

449 Views Asked by At

I need a way to generate internal bounding boxes (e.g. 1x1km squares) starting from a bigger geographic bounding box.

For example, starting from London bounding box, I want to get all the 1x1km bounding boxes within that geographic area.

Formats:

  • a geographic bounding box is represented by 2 points, the bottom left point and the upper right point that delimit the geographic area;
  • a point is represented by a [lat, lng] pair.

Is there a Java library implementing that feature or even just an algorithm? I also tried Java JTS, but it seems useless for that purpose.

Thanks in advance.

1

There are 1 best solutions below

0
On BEST ANSWER

Your requirements are contradictionary:

Either you have a lat,lon grid where all cells have same longitudial Span and latiudinal span. or you have a meter based grid, where all cells have meter based coordinates, using an coordinate transformation. E.g UTM.

Both at the same time is not possible, especially for the longitude coordinate component.

The simplest approach is to use lat, lon units.
You have to implement that for yourself.