Embedding a map using Geofield & Google Map V3 API with Javascript

This is a brief synopsis of how to embed a Google map on a Drupal site using Javascript and Geofield Latitude & Longitude co-ordinates.

I'm not going to describe how to convert your location into geofield co-ordinates, merely how to render them out on a Google map.

Lets say you've used the Address Field module in conjunction with the Geofield module to create your locations geo-coordinates. These will be in a format of latitude & longitude which will look like: 54.592418, -0.1520028

To get this location showing up as a circle in the general area on a map using javascript and the Google Maps V3 API you would use something similar to this code.

See the link at the bottom of this post in the 'Related links' area for more detail:


You could always change the above code to use a precise location marker, different zoom parameters and that sort of thing. In order to embed the map all you need to do is insert this bit of html where you want it to appear:

Justin Chevallier

Justin Chevallier

Avid Drupal site builder & user for +10 years.

Add new comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.