Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

A custom overlay for the Google Maps API v3 that can display small photo thumbnails on the map.

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 README.md
Octocat-spinner-32 photo_overlay.js
README.md

Photo Overlay

A custom overlay for the Google Maps API v3 that can display small photo thumbnails on the map. Here's an example of what it looks like in the standard configuration (it's the thumbnails on the map):

Usage

// The constructor takes 4 parameters:
// * map: the map you want the overlay to be on
// * position: a lat/lng element
// * url: the URL of the thumbnail
// * title: text for the title element, displayed when you hover over it (optional)
function PhotoOverlay(map, position, photoUrl, title)

// Example initialization using a photo received from the Flickr API
// This makes the overlay appear on the map
var photoOverlay = new PhotoOverlay(map, new google.maps.LatLng(photo.latitude, photo.longitude), photo.url_sq, photo.title)

// You can add a listener to the click event of the overlay
google.maps.event.addListener(photoOverlay, 'click', function() {
    // Do something, like open an infowindow for example.
})

// Remove the overlay from the map like this:
photoOverlay.setMap(null)

To Do

Adding the overlay to the overlayImage MapPane and creating another transparent and clickable overlay that sits on the overlayMouseTarget pane to receive click events.

The scenario described above is how Google Maps' native markers are implemented. I'd like this custom overlay to work the same way. Currently the whole overlay is added to the overlayMouseTarget pane.

License

WTFPL

            DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
                    Version 2, December 2004

 Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>

 Everyone is permitted to copy and distribute verbatim or modified
 copies of this license document, and changing it is allowed as long
 as the name is changed.

            DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

  0. You just DO WHAT THE FUCK YOU WANT TO.
Something went wrong with that request. Please try again.