pAkY88
pAkY88

Reputation: 6294

iOS and Maps: How to intercept a touch gesture, get the coordinates and retrieve the country name

I am developing a game in which the user has to select a country on a world map.

I was thus wondering:

  1. what's the best approach to show an interactive map? I found this framework/component on the Web http://mousebird.github.com/WhirlyGlobe/ but I am also evaluating MapKit, MapBox and Google Maps frameworks. In your opinion and from your own experience, what would be the best choice?

  2. Given some GPS coordinates, how can I retrieve the country name? (I'm interested only in the country name, nothing more)

  3. Is there any sample code or tutorial in which such an application is implemented?

Thanks!

Upvotes: 2

Views: 3788

Answers (2)

iDev
iDev

Reputation: 1042

In Google Map SDK for iOS You have to try with this Delegate Method.

It is giving you coordinate where user tapped.

- (void)mapView:(GMSMapView *)mapView
didTapAtCoordinate:(CLLocationCoordinate2D)coordinate
{
    NSLog(@"You tapped at %f,%f", coordinate.latitude, coordinate.longitude);
}

With this particular coordinates you can find country.

I think you have to check this . It will help you.

Upvotes: 3

incanus
incanus

Reputation: 5128

You should also check out MapBox. The iOS SDK supports full, configurable interactivity. There is an example app for converting a tap into the name/flag of the country tapped.

https://github.com/mapbox/mapbox-ios-example

Upvotes: 0

Related Questions