Topic: Configuring Google Maps in Kete

Topic type:

In Kete, sites have the ability to include Google Maps within items extended fields. Here is how you set it up.

To use Google Maps, it take three steps:
  1. enable Google Maps use site wide
  2. create an Extended Field that stores a map value
  3. add that Extended Field to a Content Type (images, documents, etc.) or Topic Type (Place, Organization, etc.)
The first step varies depending on whether you are using Kete 1.2 or 1.3 and later. Follow the instructions for your version of Kete and skip the other version's instructions. Then follow the steps for creating a map Extended Field and adding it to Content Type or Topic Type.
Note: Google maps functionality is only available from Kete 1.2 and later. Kete 1.3 is configured differently than Kete 1.2, if you are upgrading you'll need to update to the new configuration style.

 

Google Maps Usage Conditions

Be aware that Google Maps use has usage limits for free use of 25,000 map loads per day (and it has to be for 90 concecutive days). According to this blog post by Google, only .35% of sites are ineligible for free use so you are probably fine.

Enabling Maps in Kete 1.3 and later

As a site administrator with tech administrator privileges, do the following.

  1. Scroll to the bottom of any page and find the Administrator's Toolbox
  2. Click reconfigure site
  3. Click System
  4. Set Enable Maps to true, read the information for it THOROUGHLY!
  5. (optional) set Default Latitude and Default Longitude to where you would maps to be centered on for new location fields. Make sure to use valid coordinates in the proper format! You can come back and update this later, too.
  6. Fill out the setting accordingly and click Save
  7. Click Restart Server
See the steps linked to in Browse by Map for how to set up individual map or map with address extended fields.

Browse by Map

In Kete 1.3 and later, 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.

A more detailed example of this is covered in http://old.kete.net.nz/documentation/topics/show/267-how-can-i-configure-support-for-extracting-geotags-from-uploaded-images-in-kete.

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.

Enabling Maps in Kete 1.2

Note: this requires command line access to the machine (or virtual machine) that hosts your Kete site like you had when you installed Kete.
  1. 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.
  2. 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.

Creating an Extended Field that has a map value

  1. Login to your Kete site as an site administrator, click the "extended fields" link in the Administrators Toolbox.
  2. Create a new extended field there selecting one of the following for ftype:
    • 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.

Add Extended Field to a Content Type or Topic Type

Once you have an extended field (e.g. Location) that has an ftype of Location on Map or Location on map with address, you can then add to either a topic type or a content type to have the form and display of items of that type provide a map.

  1. As a site administrator, click on either the content types or the topic types link in the Administrator's Toolbox
  2. In the list of topic types or content types, click Edit next to the type you want to add the field to
  3. Under Availalable Form Fields, check the box (optional or required) that is appropriate for your new field and submit the form by clicking the button
  4. Your map field will now show up as a map widget in the form for adding or editing items of that type and once map data has been entered, a map with the location represented as a "pin" will show up on the display page for items with map data.

You can have multiple maps on each item (for topics like "5 Best Cafe's in Wellington", each with their own pinpointed location). They must be individual extended fields though. Just add more extended fields and assign them to that topic/content type.

When browsing or searching, results with map data will now be available to "view on map", as well.

Discuss This Topic

There are 0 comments in this discussion.

join this discussion

Creative Commons Attribution-Share Alike 3.0 New Zealand License
Configuring Google Maps in Kete by Kieran P is licensed under a Creative Commons Attribution-Share Alike 3.0 New Zealand License