[GIS] Compute a bounding box of a set of coordinates

coordinate systemgeojsonpython

Sorry if this sounds naive but I have no background in GIS and have trouble finding relevant information.

I want to zoom/move a map to fit a set of POI. So: Given a set of coordinates (WGS 84 reference frame) I want to find the bounding box (without any libraries).

Is this just plain 2D rectangle math on the latitude/longitude? For example, I found this and several like it. Does this work? How does the curvature of the earth fit into this?

There is also GMSCoordinateBounds (which I'm not allowed to link to for some reason) in the Google Maps iOS SDK that does this. Do they also just do 2D math?

Best Answer

Assuming you're aiming to view your data on a static map, googlemaps or similar, then yes, the minX, minY, maxX and maxY will give you a 'bounding box' in planar or geodesic co-ordinates. The bounding box will not look rectrangular if you reproject it from a planar to geodesic representation or vice versa, but it will still bound your data. If you wanted to view your locations on a virtual globe (eg google maps or ceasium) then it would be problematic to zoom in on data sets which wrapped around the globe. In addition your bounding box would be composed of arcs on great circles. For a good discussion on WGS 84 see here.

Related Question