Dynamic Google Maps in Drupal Geolocation Field

Standard Geolocation Field in Drupal 7 allows displaying of content only as a static image, using static Google Maps API. This solution is very limited: users can't scroll the map, zoom it nor change display type. I've implemented a patch which allows you to replace this image with dynamic, scrollable and zoomable map, which you know from many sites (including http://maps.google.com :) ).

Here is how static Google Map - without my patch - looks like:

Static Google Map

The new google map is similair to the following:

As you see, you can click and move the second map around or zoom it if you wish. You could even change map type to satellite or hybrid if you wish. Static map does not allow any of these operations.

The patch is published in Drupal Issue Queue and awaiting review. It adds new formatter type - Dynamic Google Map - that can be selected instead to old, static google map when editing content type display preferences (Structure - Content types - select content type and then Manage Display).

To link with Google Maps API, I've attached some JavaScript to new element returned by hook_field_formatter_view.

Comments (1)

I was doing some work with these modules, and attempted to switch to dynamic. It broke the display and ended up rendering nothing. Then I found this article and notice it's broken here as well. Have you got any thoughts? adam(at)konnektnow(dot)com

Do you have any questions?

Ask us!