This module allows your businesses that list in Business Directory to have a Google Map for their address. You can map the address fields from any field you’ve added in the Manage Form Fields section. You can also choose the map type (satellite, hybrid, terrain, street view) and the size of the map, as well as markers to display.
The map can be displayed on any of the following views:
- The Directory (and List) Page (showing all visible listings)
- The Search Page (showing all listings in the results)
- The Detail Page (showing the current listing’s map only)
The files you download are in a ZIP that is a full plugin. The installation instructions are inside of it, and here as well:
Upload the ZIP as a plugin via the MANUAL process*. From the WordPress admin panel
- Go to Plugins → Add New
- Click on the Upload link, and then click on Browse Now to locate the ZIP file you just downloaded.
- Click OK once you find it on your local computer.
- Click the Install Now button to start the process.
- After the installation completes, click the Activate Plugin link to turn on the module.
*NOTE: If you are using a Mac, the file may be automatically unzipped when you download it. You can change the default setting in Safari to only download the ZIP file and not unpack it. To do this: 1. Open Safari, 2. Click Preferences, 3. Under the General tab, uncheck the option Open “safe” files after downloading.
Google Maps admin screen is broken into 3 sections. The top one is general settings:
General Settings–these settings control where you maps are allowed to show up in the directory
- Turn on Google Maps Integration: Activates or deactivates the map displays on the listing views. Must be on to show the maps for the listing’s address fields. On by default.
- Google Maps API Key (REQUIRED): Enter your Geocoding API key here from Google. See below for more details about getting and using one.
- Show listings map in categories?: Activates or deactivates the map that shows on the category page. On by default.
- Show listings map in View Listings?: Activates or deactivates the map that shows on the Directory/List page. On by default.
- Show listings map in search results?: Activates or deactivates the map that shows on the Advanced Search page. On by default.
- Current page listings to show on map: This allows you to control whether the map shows ALL listings in your directory or just the listings on the active page. If you have a LARGE directory, then changing this to "active page" will improve performance. Some large directories require too much processing to pull all markers on the map at once so this allows you to control that.
- Allow visitors to get directions to listings: Turning this on will show "Get directions" where the user can enter their current address and the map will display turn-by-turn directions and a route to get to that particular listing's location. Please note--Google's API requires that secure HTTP connections (https) are used, so if your site is not using SSL, you may see warnings about https redirects. This is not a bug with BD, but a problem where your site is not compatible with Google's API unless you make it fully secure (SSL).
- Allow visitors to manually adjust the location of their listings: Turning this on will allow users on the FRONT END only to manually move a marker to a physical location on a map. This is useful if you have clients with addresses in rural areas where Google Maps doesn't place the marker in the "proper" place.
The next section is about appearance of the maps:
Appearance–these settings control how your maps will appear in the directory
- Display Map Position: Allows you to control where the map appears in the listing pages. Choices: Above All Listings or Below All Listings. Default is Above All Listings
- Map Size: The dimensions of the Google Map to display, either Large (400×600), Small (200×300) or Custom Size. Default is Automatic If your map does not fit in the width of the map, use "custom" and set the size you want. Automatic allows mobile and desktop users to receive the proper sizing and is the recommended setting.
- Custom Map Size Width: The custom width of the Google Map to display. Only valid when Map Size “Custom” is selected
- Custom Map Size Height: The custom height of the Google Map to display. Only valid when Map Size “Custom” is selected
- Auto resize map when container is stretched: Turn this on to make your maps fully responsive on mobile displays where tablets and phones have wildly different sizes.
- Map Type: One of the following choices: Road Map, Satellite, Terrain or Hybrid. Road Map will display the labeled streets in a colored map. Satellite and Terrain will use the images from Google Earth. Hybrid overlays the two.
- Animate markers? Turns on basic Google Map animations for the markers where the business is located.
And the last section is regarding which fields to use for the map address information.
Field Options–these are the mappings of where Google Maps will pull its address data from using your listing fields defined under Manage Form Fields. You can map up to 5 different fields to use. Google Maps requires at least one to be mapped.
- Address: Which field in your list of form fields maps to the base address
- City: Which field in your list of form fields maps to the city
- State: Which field in your list of form fields maps to the state
- Country: Which field in your list of form fields maps to the country
- ZIP/Postal Code: Which field in your list of form fields maps to the postal code
Using an API Key for Google Maps
What is the API key?
API keys allow developers and site owners to track usage of Google’s services on their sites via Google’s APIs Console.
Most of Google’s free services are limited to a given number of views, page loads, etc. This means that when your site goes over those limits the services will stop working on your site.
By using an API key (coupled with “Automated Billing”) you can prevent any interruption due to usage: when you hit a given limit, Google will charge you for the extra usage while your site keeps working.
In the specific case of the Google Maps APIs, the limits are as follows:
- 25,000 map views per day.
- 2,500 geolocation requests per day.
- 5 requests (of any kind) per second.
Why do I need API keys for the Google Maps module?
Most sites shouldn’t need API keys at all since limits on Google Maps APIs are very reasonable. Because limits are enforced during 24-hour intervals, even if your site goes over the limit, it could be the case that the outage lasts at most until the next day.
The Business Directory – Google Maps module uses a special kind of cache to prevent unnecessary API usage but sometimes that’s not enough.
If, after enabling the module, some or all of your maps are not being displayed and you’ve been seeing a warning about failed requests on your WP backend for more than 24 hours, you definitely need an API key.
If your maps are not being displayed but you’re not seeing a warning on the backend, you probably don’t need an API key. Please double check your settings and, if the problem persists, contact us for assistance.
If you have shared hosting, READ THIS:
When your site is on shared hosting, as the name suggests, it is sharing the same physical server resources (such as memory, CPU, etc.) with several other sites. Because all of those sites are on the same server, most of the time they’re also sharing the same IP address, regardless of the domain names being different.
Google enforces limits by looking at the IP address of your server so your site could be denied access to Google APIs even if it is not the one abusing the APIs or hitting the limits on its traffic alone.
How do I get an API key from Google for use with the Google Maps module?
First, you’ll need a Google login, such as the one from a gmail.com account, and a credit card for billing.
- Visit Google Developers Console and enter your login information (if asked).
- If there are no projects listed, create a new one or select your current project.
- Go to “APIs & Auth → APIs” and make sure the following APIs are enabled:
- Google Maps Geocoding API. (NOTE: Don’t confuse this with Geolocation–they aren’t the same!)
- Maps Embed API (NOTE: If you require the directions feature, then Directions API should be enabled.)
- Go to “APIs & Auth → Credentials” and click “Create new Key”. Choose “Server key” as the key type. You can also add IP restrictions to your key (not recommended)
- Your new API key should be created. Take note of the API Key number (a long string of characters and numbers).
- (Optional) We suggest you set up automated billing for your project to avoid any outage because Google may require it. To do that, visit “Billing & settings” under your project’s name and click Enable billing.
- Log in to your site’s WP admin and visit Directory → Settings → Google Maps to enter your new API Key.
Google has a new process for getting an API key. Customers have to add billing information, and they also must select from among three different products:
If you will use the "Directions" feature (shown below) in the Maps module, you also need to select the "Directions API" option.
API Key References
- Google Developers Console Help
- Geocoding API usage limits
- Usage Limits for Google Maps API Web Services
Google Maps in action
Once you’ve defined the map fields and activated the module, you should see this appear on a single listing view:
This particular display is with the “Large Map” and “Roadmap” settings on. The fields “Address”, “City” and “State” are used to map the location of Apple Computer here.