Note: This software is no longer actively maintained and has several known issues. I hope that it still contains some good ideas that may help in your Google Maps projects.
TPhoto allows you to embed alternate aerial photographs inside your Google Maps. The added photos pan and zoom along with the main map view, without interfering with any clicks on the map.
To use TPhoto, you supply the lat/lng of the top left and bottom right corners of your image.
Warning! Version 2 of TPhoto is not compatible with version 1 of Google Maps. When using TPhoto v2, you must change the 'v=1' string to 'v=2' in the URL that calls the Google Maps API code into your page. As Google Maps v2 is still in testing, TPhoto 2.0 is subject to change as the API code evolves.
The technique of defining the size and initial zoom level of your image in TPhoto v1 is no longer available in v2. You must now define the Lat/Lng of the top left and bottom right corners of your image. Also, TPhoto no longer works with the deprecated GMap() object. GMap2() is required.
|2.05||Bugfix. Thanks to Tom Dvorak for spotting the problem.|
|2.04||Bugfix. Thanks to Chris Smith for spotting the problem.|
|2.03||Removed support for GMap() object. GMap2() is now required.|
|Modified some internals to use documented GMap methods.|
|Removed TPhoto branding from map. Please provide a link to this page when and where it's convenient for you.|
|2.01||Added support for GMap2() object. Many thanks to Mike Williams for spot-on suggestions.|
|Changed documentation to suggest GLatLng points instead of GPoint points where appropriate. Either still works.|
|2.00||Removed support for harder technique of defining only one anchor Lat/Lng.|
Constructor Description TPhoto() Creates a new photo instance. Takes no parameters.
The extension adds two methods to the GMap object:
GMap Method Description addTPhoto(photo) Adds the given photo to the map. removeTPhoto(photo) Removes the given photo from the map.
...and one externally useful TPhoto method:
Method Description setOpacity(percentOpacity) Defines the desired opacity of the embedded image. percentOpacity is a number between 0 and 100 inclusive.
Property Description id (required) Specifies an id for the photo object. This id must be unique for each image you embed. The id is exposed to the DOM, so you can dynamically adjust its style if you choose. src (required) The path and filename of the desired image. anchorTopLeft (required) The lat/long where the top left corner of the image will be anchored to the map. Takes a GLatLng object. (usage of GPoint objects for Lat/Lng is deprecated, but still works.) anchorBottomRight (required) The lat/long where the bottom right corner of the image will be anchored to the map. Takes a GLatLng object. (usage of GPoint objects for Lat/Lng is deprecated, but still works.) percentOpacity A number between 0 and 100 inclusive determining the opacity of the image. Default 100.
The extension works in Windows IE6 and Firefox. I don't have other browsers or operating systems to test on.
Other combinations that reportedly work: Win Opera 8, Mac Safari 2, Linux Firefox. Please send feedback on other OS/browser combinations.
Q: How do I get my image to match up with
Most importantly, the image needs to be in the correct projection. Everywhere I've read says Google's Keyhole imagery is in Mercator, and it seems close, but I and other people have found that it seems to diverge from Mercator in places. Your mileage may vary. Once you have the your imagery in the correct projection, matching the image to the map is a matter of getting the corners anchored in the right places.
Q: How much does it cost?
The TPhoto extension is free for non-commercial use. If this extension saves you some development time, please consider sending some cash my way — there's a PayPal button below.
If you wish to use TPhoto in a commercial application, I ask for a US $20 "license" fee per site. I call it a license for lack of a better word, but there's no fine print or legalese. The $20 grants you the right to use TPhoto on one commercial site. Please include the domain name of the site you wish to license in the Paypal comments.
Email: tmangan via gmail.com. Feedback is appreciated.
The TPhoto extension and this documentation are copyright ©2005-2006 by Tom Mangan. Neither the extension nor this documentation is affiliated with Google.