1

I have read the longitude & latitude of the current location in obj-c. Now, how can I view the current location in the Google map, using that locations's longitude and latitude?

Can anyone give me some example code which helps me to do this?

Naveed
  • 41,517
  • 32
  • 98
  • 131
Kiran
  • 1,289
  • 3
  • 15
  • 25

2 Answers2

2

You don't need to use longitude & latitude of the current location to show user location. The following line will do so.

mapView.showsUserLocation = YES;
Sarah
  • 1,595
  • 3
  • 25
  • 34
0

Here is an example of the method you can use with the map view:

 [googleMap setRegion:MKCoordinateRegionMake(location, coordSpan];

googleMap will be you MKMapView object and the location would be a CLLocationCoordinate2D (The lat. & lon. values) struct and coordSpan would be a MKCoordinateSpan struct (Specifies how large the viewing area is).

Update: This can be used for custom latitude and longitude valuesThe suggestion of using

mapView.showsUserLocation = YES;

Would be the easiest direct way if your just concerned with the users exact location.

avizzini
  • 789
  • 1
  • 7
  • 17
  • I assume your using interface builder. So in your view add a MKMapView object, then create a connection to an IBOutlet in your view controller class. In the example above you could make it IBOutlet MKMapView *googleMap; Once the connection is made you can use the method up above. – avizzini May 16 '11 at 14:29