1) Get your google maps API key at http://www.google.com/apis/maps/signup.html 2) At Admin -> Customizations -> Add Fields, add this setting field: googlemapskey 3) At Admin -> Customizations -> Add Fields, add these link fields (as text): lat, long 4) Copy your key into the admin panel where the googlemapskey field has been added (should be at the bottom of Admin -> Settings -> General if I recall). 5) In your wrapper template, change your <body> tag to this: <body onload="load()" onunload="GUnload()"> 6) Place this where you want to show the map (presumably your 'link details' template):
<IF {LINKLAT} and {LINKLONG}> <script src="http://maps.google.com/maps?file=api&v=2&key={GOOGLEMAPSKEY}" type="text/javascript"></script> <script type="text/javascript">
//<![CDATA[
function load() { if (GBrowserIsCompatible()) { var map = new GMap2(document.getElementById("map")); map.setCenter(new GLatLng({LINKLAT}, {LINKLONG}), 13); } }
Suppose you have fields requesting an address for each link, and want to automatically map the address without needing to manually determine the latitude/longitude. This becomes problematic. Here's an option though with these disclaimers: - I gather it may not work for non-American addresses - It requires purchase for commercial use - It slows down page loads (though a more complex hack could fix that)
9) If you don't already have address fields, create link fields address1, city, state, zip.
10) Fill in your geocoder username and password at the top of this code, and also set the address according to the fields you have (if different). Finally replace the code from step 6 of post 1 with this:
Comments on Google Maps Integration
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
1) Get your google maps API key at http://www.google.com/apis/maps/signup.html
2) At Admin -> Customizations -> Add Fields, add this setting field: googlemapskey
3) At Admin -> Customizations -> Add Fields, add these link fields (as text): lat, long
4) Copy your key into the admin panel where the googlemapskey field has been added (should be at the bottom of Admin -> Settings -> General if I recall).
5) In your wrapper template, change your <body> tag to this:
<body onload="load()" onunload="GUnload()">
6) Place this where you want to show the map (presumably your 'link details' template):
7) Type in lattitude and longitude values for the desired links. Example lat and long: 37.4419, -122.1419
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
Suppose you have fields requesting an address for each link, and want to automatically map the address without needing to manually determine the latitude/longitude. This becomes problematic. Here's an option though with these disclaimers:
- I gather it may not work for non-American addresses
- It requires purchase for commercial use
- It slows down page loads (though a more complex hack could fix that)
8) Create an account with http://geocoder.us
9) If you don't already have address fields, create link fields address1, city, state, zip.
10) Fill in your geocoder username and password at the top of this code, and also set the address according to the fields you have (if different). Finally replace the code from step 6 of post 1 with this: