2

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?

2

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.

  • Thank you for your answer. If I'm understanding correctly the standard interactive Google Maps is a "static map" in your sense? I.e. a map that is fit into a rectangle. Like when I zoom completely out of Google Maps it still shows a rectangle of the world and not a globe. I see why rectangle bounding boxes makes sense in that case. And from testing Google's builtin bounding box calculations it seems to match up. Sorry, maps/geo is a new world for me :) – tombardey Jun 20 '17 at 11:33
  • Glad to be of help. There's a lot of terminology out there. I probably over complicated things by distinguishing 'static' vs 'googlemaps or similar'. By 'static' I meant can't be panned or zoomed, no responsive generalisation, if you do zoom in you just see the pixels - essentially just a 'dumb image'. 'googlemaps or similar' was an attempt to refer to 'slippy maps' without using another domain specific term... I was just trying to check you weren't dealing with continents on a globe, which is quite unlikely anyway. Feel free to edit answer to add clarity for future readers! – RoperMaps Jun 20 '17 at 21:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.