Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Call Google Maps with Url from Objective-C

i call the url of googlemaps to show a position to a given lat and long. How can i mark this position on the map with a pin ?

 NSString *latlong = [NSString stringWithFormat:@"%@,%@", einBetrieb.lat, einBetrieb.lng];
 NSString *url = [NSString stringWithFormat: @"http://maps.google.com/maps?ll=%@",
      [latlong stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];

Regard Caglar

like image 394
user389431 Avatar asked Dec 20 '25 17:12

user389431


1 Answers

Try this url:

NSString *url = [NSString stringWithFormat: @"http://maps.google.com/maps?q=%@", [latlong stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];

That should get you what you want. Replace the "ll" with a "q"

like image 80
gabaum10 Avatar answered Dec 22 '25 08:12

gabaum10



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!