Leo T Abraham
Leo T Abraham

Reputation: 2437

How to zoom to the pointer in a google map

I have a google map in an iframe in which, I am passing the longitude and latitude.

What I want is,

I want show the map zoomed to the pointer corresponding to the longitude 
and latitude given.

Fiddle

In the given fiddle, user have to scroll the map to right, to see the marker. Instead I want to show the marker to the user, when the map loads with better zoom.

I will have similar maps like this with different longitude and latitude in different pages. I want to apply this all those maps.

Upvotes: 0

Views: 118

Answers (1)

Slyvain
Slyvain

Reputation: 1732

Your "ll" parameter is the one centering the map. If you give it the same value as the "q" parameter, your map will be centered on that point.

https://maps.google.co.in/maps?[]...q=38.89205,+1.35275&
[...]ll=38.89205,+1.35275&output=embed"

Here is a jsFiddle: http://jsfiddle.net/D4Y4r/

If you wish to zoom in, you can increase the value of the "z" parameter.

Quick edit: this page might provide you some insight on the URL parameters http://asnsblues.blogspot.in/2011/11/google-maps-query-string-parameters.html

Upvotes: 2

Related Questions