I am working with GPS tracks (lat/lon values) and my goal is to compute the minimum bounding box for a small geospatial library I am working on. The datasets are not huge, maybe a couple of tens of thousands of points. I could not find an algorithm that deals with tracks/datasets crossing from -180 to 180 lat or lon. Does anybody have pointers to algorithms?

To sum it up very simply, what I am looking for is:

  • Input: (lat/long)* [possibly tens of thousands of GPS points, potentially crossing 180/-180 boundary)]
  • Output: (lower-left, upper-right) of the minimal box containing all points

The background for me is that I need the bounding boxes to initialize map viewers, in particular when there is more than one track displayed on a map.

  • I was working on that atm. Also cgal libraryhas a solution for it in its API – nickves Dec 22 '15 at 0:07
  • Thanks for your comments, @nickves. I did find many library functions in various languages/toolboxes, but I want to implement it myself, so I need an algorithm and not a library function. – dret Dec 22 '15 at 0:16
  • 1
    adding to my previous comment: i am not looking for the smallest possible rectangle, but for the minimum axis-aligned one (because it is supposed to be used as a viewport for map views). – dret Dec 22 '15 at 0:18
  • 1
    in that case; you're looking the for the BBox. its a parallelogram with opposite corners at xmin,ymin and xmax,ymax. – nickves Dec 22 '15 at 0:22

Browse other questions tagged or ask your own question.