2

I have google maps added to UIWebview. I want to zoom the map to destination location. Destination location is passed programmatically.

How do I do it? I tried setting parameter z=10 while loading google maps url but it doesn't zoom at particular point.

Please help

Thanks

iOSDev
  • 3,617
  • 10
  • 51
  • 91

2 Answers2

2

Why you dont use MapKit?

It uses google map to provide the map.

http://developer.apple.com/library/ios/#documentation/MapKit/Reference/MapKit_Framework_Reference/_index.html

if you really want to use google maps inside an webview you will need to do something like that:

http://maps.google.com/maps?q=24.197611,120.780512&z=10

where q=latitude,longitude

and you will need to know the latitude and longitude of the point you want to zoom

for more informations you can look at:

http://mapki.com/wiki/Google_Map_Parameters

ggrana
  • 2,335
  • 2
  • 21
  • 31
  • In that case, I guess I won't be able to add get directions, as I need get directions as well :( – iOSDev Mar 27 '12 at 02:18
  • If you talk more about what you want to do, maybe I can help you more than that. I really believe if you use the mapkit you will can do what you want. – ggrana Mar 27 '12 at 02:25
  • I want to highlight destination and set zoom level. And also from my start location I would have get directions to destination. – iOSDev Mar 27 '12 at 04:02
  • 1
    Yeah, I highly recommend you to use mapkit, it is not hard to work with it, and I believe you will get a better user experience. If you have any question how to work with mapkit you can post a question and I will try to help you. – ggrana Mar 27 '12 at 04:25
0

I solved it with by adding certain parameters to the google maps url:

http://maps.google.com/?saddr=%@&daddr=%1.6f,%1.6f&ll=%@&sll=%@&sspn=0.015&output=embed&z=15

iOSDev
  • 3,617
  • 10
  • 51
  • 91