I've got several nodes with location information attached. I am using the Gmap output form views to show the results on a map. Drupal is so great sometimes, I'm literally shocked at how little time it took to get that solution up and running!

At the moment the map is using the default centring and zoom no matter what the results are. I'm pretty sure I have just missed an option or setting somewhere, but can someone point me in the right direction to re centre and zoom based on the pins from the results?

I've had a search on here and Google and can't see this question having been asked. Probably because an available option is staring me right in the face!


2 Answers 2


I just noticed someone talking about the macro behaviour for autozoom. I added behavior=+autozoom to my [gmap] macro in the Gmap views settings and the few tests I have done so far suggest it works


The answer left by author of the post is wrong, he created a bicycle instead of using default function that allows to do it in a simple way.

Right way it is to use gmap_simple_map function(gmap.module in D7) and pass arguments into the function.

An example:

gmap_simple_map($latitude, $longtitude, $markername, $info, $zoom, $width, $height, $autoshow, $map);

gmap_simple_map('37.275376', '12.87876', '', '', 5, '500px', '200px', false, array());

P.S.: To use default saved marker you have to left $markername empty, set width and height like in css. Oops, be careful with css styles, dont set display: none for gmap block, it can cause the block empty or the grey map.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.