I'd like to make a Geographic Bounding box Calculation in iOS. It can be aprox.
Input Parameters:
Current Location (Example: 41.145495, −73.994901)
Radius In Meters: (Example: 2000)
Required Output:
MinLong: (Example: 41.9995495)
MinLat: (Example: −74.004901)
MaxLong: (Example: 41.0005495)
MaxLat: (Example: −73.004901)
Requirement: No Network Call
Any Ideas? Mapkit / CoreLocation does not seem to offer this type of thing?
Any other Geographic SDK that i could use?
Thanks
I think you can use standard MapKit functions: MKCoordinateRegionMakeWithDistance, this will return a MKCoordinateRegion, which is really just a center point (lat, lon) and the spans in the latitudal and longitudal direction in degrees. Add/subtract half of the span from the latitude and longitude respectively and you have the values you're looking for.
By the way: this is only representative for the longitude for small spans, in the order of a couple of kilometers. To quote Apple:
I know I'm a bit late to the party, but I just built a class
GTBoundingBox
that might (or might not) help:https://github.com/wpearse/ios-geotools