Topic: Configuring Google Maps in Kete
Topic type: Topic
In Kete, sites have the ability to include Google Maps within items extended fields. Here is how you set it up.
- Go and sign up for a Google API Key. It's free (for non-commercial sites, commercial sites must pay license fee) and simple. Go to http://code.google.com/apis/maps/signup.html and put the URL of the website that'll have the Google Maps. Agree to the terms and sign up, then copy the key you get on the next page.
- Copy config/google_map_api.yml.example to config/google_map_api.yml , open it and replace the Key there with the one you got when you signed up in step 1, and save the file.
- Go to you Kete setup (assumes you've pre configured this site), and when logged in as an admin, click the "extended fields" link in the Administrators Toolbox. Create a new extended field there selecting one of the following:
- Location on map (lat/lng coordinates)
This will just display a map on the item show pages pin pointing the location selected when adding/editing the item - Location on map with address
This will display a map like the previous option but will also display the address of the location pinpointed above the map.
- Location on map (lat/lng coordinates)
- Add that Extended Field to a topic or other content type.
- The google map will now be present when someone creates an item of the type that map is associated with.
You can have multiple maps on each item (for topics like "5 Best Cafe's in Wellington", each with their own pinpointed location). Just add more extended fields and assign them to that topic/content type.
By default, the Google Map will zoom (to the country level) on the ISP the user is access the internet from (it's the closest we can get at the moment). When the location cannot be retrieved, it uses a set of default coords and zoom level, found in the google_map_api.yml configuration file. If you want to change these, you can get the coords of the desired default location by creating an item as described above, saving it, and copying them from the items show page into their respective fields in the configuration file. For the zoom level, it starts at 1 (from the most zoomed out level) and increases by one every time you press the + button on the Google Map.
Browse by Map
As of Kete 1.3, you can view search results as pin points on a map, which when clicked, pop up a bubble contain the items information (title, description etc). To activate this feature, when you create a google map extended field, and simply you set it's xml element name to dc:coverage, and Kete does the rest.
Note: The above extended field creation will only apply if you haven't set it up yet. If you have setup google maps before, but without the xml element name, you can add it by editing the map extended field, but you must rebuild zebra to make these changes take effect.


