How to calculate geography restriction frame in iOS?

I would like to make a Geographic Limiter field in iOS. It could be aprox.

Input Options:

Current location (example: 41.145495, -73.994901)

Radius in meters: (Example: 2000)

Required Conclusion:

MinLong: (Example: 41.9995495)

MinLat: (Example: -74.004901)

MaxLong: (Example: 41.0005495)

MaxLat: (Example: -73.004901)

Requirements: No network call

Any ideas? Mapkit / CoreLocation doesn't seem to offer this kind of thing?

Any other geographic SDK I could use?

thank

+5
source share
2 answers

, MapKit: MKCoordinateRegionMakeWithDistance, MKCoordinateRegion, (lat, lon) . / , , .

CLLocationCoordinate2D centerCoord = CLLocationCoordinate2DMake(41.145495, −73.994901);
MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance(centerCoord, 2000, 2000);

double latMin = region.center.latitude - .5 * startRegion.span.latitudeDelta;
double latMax = region.center.latitude + .5 * startRegion.span.latitudeDelta;
double lonMin = region.center.longitude - .5 * startRegion.span.longitudeDelta;
double lonMax = region.center.longitude + .5 * startRegion.span.longitudeDelta;
, , . quote Apple:

latitudeDelta​​STRONG >
( ) . , , 111 (69 ) .

longitudeDelta​​STRONG >
( ) . , , . , 111 (69 ) , 0 .

+4
0

All Articles