How To Add Google Maps To Your Review Site
« Review Foundry User Manual
Tutorial Table Of Contents
Obtain Review Foundry »
Google monitors your access to its Google Map interface. There is no upper limit to the number of times per day that you can request mapping information (though geocoding is restricted to 50,000 requests per day). But you do need to send along a Google Maps API developer key with every map request (or rather Review Foundry does). So you need a key. The key can be applied for on this page: Sign Up for the Google Maps API.
Once you have the API key, visit the Configure > Google Maps page in the admin area of Review Foundry. Load your API key. The key itself only works for the domain you specified when applying for the key. So if you intend to test the Google Map feature on a local PC using localhost as the domain name, you will run into problems. You can only expect things to work when the server name on which Review Foundry is installed matches the domain name that Google has encoded into your key. This is somewhat of a pain, and since I develop on a local machine I must actually upload pages with a Google Map on them to an external site in order to test them. So keep this domain dependence in mind when testing the Google Maps feature yourself.
Because Google Maps depends upon accurate latitude and longitude data in order to construct maps, any of the Item, Member, or Supplier branches that will be using this feature require 4 new columns to be added to the respective Item, Member, or Supplier table. These columns are to be named latitude, longitude, geo_accuracy (a measure of the precision associated with the other two coordinates), and the geo_status_code (basically an error code if geocoding cannot be performed by Google). These 4 columns should be added in the standard way (going through the Database > Columns > Add Column interface), using the following column definitions:
LATITUDE COLUMN --------------- Column Name: latitude Column Type: FLOAT Column Size/Precision: 12,6 Not Null: No Column Position: AFTER country_id Form Display: Latitude Form Type: TEXT Form Size/Length: 12 Form Regex: ^(\-?\d+\.\d+|)$ Hide on Public Add/Modify Forms: Yes LONGITUDE COLUMN ---------------- Column Name: longitude Column Type: FLOAT Column Size/Precision: 12,6 Not Null: No Column Position: AFTER latitude Form Display: Longitude Form Type: TEXT Form Size/Length: 12 Form Regex: ^(\-?\d+\.\d+|)$ Hide on Public Add/Modify Forms: Yes GEO_ACCURACY COLUMN ------------------- Column Name: geo_accuracy Column Type: ENUM Column Values: 0 1 2 3 4 5 6 7 8 Not Null: No Column Position: AFTER longitude Form Display: Geo Accuracy Form Type: SELECT Form Values 0 1 2 3 4 5 6 7 8 Hide on Public Add/Modify Forms: Yes GEO_STATUS_CODE COLUMN ---------------------- Column Name: geo_status_code Column Type: ENUM Column Values: 200 400 500 601 602 603 604 610 Not Null: No Column Position: AFTER geo_accuracy Form Display: Geo Status Code Form Type: SELECT Form Values SUCCESS BAD_REQUEST SERVER_ERROR MISSING_QUERY UNKNOWN_ADDRESS UNAVAILABLE_ADDRESS UNKNOWN_DIRECTIONS BAD_KEY Hide on Public Add/Modify Forms: Yes
If you are familiar with the meaning of Review Foundry column attributes you will see that both the latitude and longitude columns are floating point values with 6 decimal precision, and the geo_accuracy and geo_status_code columns are integer-valued. In practice the geo_accuracy can have a value from 0 (meaning the coordinate data is totally meaningless, to 8, which represents (supposedly) a location accuracy that is good to a few inches). Finally, the geo_status_code value currently has 8 possible values as seen above. These 4 values will be supplied by Google when you use Review Foundry to geocode your record(s), which we will cover shortly.
Go ahead and add those columns to any of the tables for which you hope to add Google Maps. If you are using the Supplier table to represent businesses, for example, then you need to add the 4 columns to that table.
Once you have obtained your Google Maps API key and added the requisite columns to your Item, Member, or Supplier table, you can then elect to add maps to the corresponding branch of your Review Foundry installation. You are not likely to want to add Google Maps to any of the Member pages, but the other two branches are fair game.
All Google Maps configuration (excepting specified color styling) is done from the Configure > Google Maps page. If you wished to add Google Maps to all facets of the Supplier branch you would enable the following variables:
gmaps_find_enabled_item gmaps_detail_enabled_item gmaps_search_enabled_item
The first of these variables allows a Google Map to be displayed on a listing of Suppliers in a Yellowpage. In practice, unless you have organized your Yellowpages into tight geographic locations, you should not bother adding Google Map capability (a map that covers an entire contintent is more of a hindrance than a convenience).
The second variable allows a Google Map to be placed on the Supplier Detail pages, where reviews appear. Because only a single location is mapped, it makes sense to offer this option (users can hide the Google Map if they have no use for it).
The final option is to allow a Google Map to be displayed on pages that contain search results. However, only searches that involve a proximity search can have a Google Map on them. Proximity searches are those that return results with locations that are less than X miles from a supplier zipcode or postcode. Offering a Google Map for search results that might be separated by a thousand miles or more just does not make sense.
The Geocoder.pm module which powers Google Maps in Review Foundry must be purchased separately from the main program if you intend to use it (this module confers specialized functionality that only webmasters of geographically-related websites are likely to need).
The alternative is to hand-enter latitude and longitude coordinates and a geo_accuracy value yourself for each record. You can do this, perhaps, if you want to test the Google Maps functionality before investing in the module. Of course, support for Review Foundry's Google Maps functionality is reserved for those who have purchased the module.
Next Section: GEOCODING LOCATIONS
Copyright © 2004 Random Mouse Software. All Rights Reserved.