WebDNA Google Map Mashup
This module renders a Google map with pinpoints for found records.
- Go to http://code.google.com/apis/maps/signup.html to get a (free) key to use the Google API.
- googlemap.inc needs to be customized using the key you get from the above link
- Your database will need to have a field called "LL" which contains the latitude and longitude coordinates in the format of "40.187334,-76.182181". I've provided a script to generate the LL coordinates.*
- The following code on this page needs these variables:
- mapquery: The entire search string including db=yourdatabase
- ballooncontent: The balloon content, as html within the founditems loop. (Any quote marks will be escaped via a convertchars table on the googlemap.inc file.)
- initlat: latitude for the default map's center
- initlon: longitude for the default map's center
- zoomlvl: zoom level of the default map
- In the gglmap div, you can change the width, height and border style to suit
- More instructions are on the Geocode page.
-
NOTE: in Internet Explorer, the map div cannot be inside a table or it doesn't render correctly.
*Or you can write your own script to go through your database and fetch the coordinates from Google maps. Google has an api to do this, but I found it easier to just scrape them based on the address and zip code, using [raw][tcpconnect][/raw], [raw][tcpsend][/raw] and [raw][middle][/raw] to extract the values and write them to the database. You will have to adjust your address if Google can't find it, or tweak the final LL value to make the marker point exactly where you want it. If you prefer to have separate long. and lat. fields, go right ahead. I found it simpler to combine them into one.
Example database editing and geocoding page: Edit and Geocode
|