Wednesday, 26 January 2011

How to add a Google map to your photography site

I recently (well not that recently, but I'm just catching up with a lot of things), received an email asking how I had got Google Maps on my websites. The maps I am talking about are like this one on Images Of Essex and this at Images of Suffolk.

Step 1 - Create the Galleries

The first thing you need to do is to actually create the galleries you will be linking your map to.
Fortunately both websites are Foliopic sites.  Foliopic have a great system where you can keyword your images and search for the image, the URL for this search can then be used as a gallery.

For example keywording all our images and issuing a search for Orford gives this search: which can be used as an Orford gallery.
Other hosting sites may have a similar system, or you will just have to create galleries for each area

Step 2 - Create The Map

I used to automatically generate the API code for me.  It is worth registering with the site as this allows you to save maps and you will be coming back to this time & time again as you add new points to the map.

To add galleries, pick a point on the map then give it a name so you can change it later if you need to.

In the code box paste in something like:

<b><a href=""><b>Orford </b>Gallery</a></b>

and change

to the url for your gallery and Orford to the name of the gallery

Repeat the above process for each gallery then save the map.

Step 3 Get your own api key:

To use Google maps you need to have your own API key.  This is simple enough, go to to sign up and then copy the key.

In Mapmaker click the Get Javascript button then paste your Google Api key in here

<!-- //Change the following line to use your own key available from -->

<script src="" type="text/javascript"></script>

Now you can copy all the javascript ready to paste it onto your site.

Step 4 Create a new page

These instructions are specific to Foliopic
Create a new page and click on the source button so you can see the HTML that makes up the page.
Delete all the HTML that is there currently and paste in the HTML from mapmaker.

Remove this block from the top:

<div style="background-color: #fff2cc;">
&amp;title&gt;Simple Google map&lt;/title&gt;

And this from the bottom

<style type="text/css">
div#popup {
border:1px solid #999999;

<div id="map" style="width:600px;height:450px"></div>

Step 5 - Styling your map:

Add the following to your css file.

/************** MAP *******************/
#popup {
border:1px solid #999999;

#popup a

#popup a:hover

No comments: