Answers to common GeoDirectory questions about maps. Click a question to open the answer.
For Google Maps directions, add the GD > Directions block or [<span></span>gd_post_directions] shortcode to your details page. See GD > Directions.
For Waze, use a GD > Post Badge that builds a Waze link from the listing’s coordinates:
[<span></span>gd_post_badge key="latitude" condition="is_not_empty" badge="Open in Waze" link="https://waze.com/ul?ll=%%latitude%%,%%longitude%%&navigate=yes" new_window="1"]
The badge only shows when the listing has a location, and %%latitude%% and %%longitude%% are filled in from the listing. The same idea works for other apps that accept coordinates in a link.
Yes. Change Maps API in GeoDirectory > Settings > General (it is an advanced setting, so show advanced settings first). Choose Google Maps API, OpenStreetMap API or Automatic. If no Google key is saved, GeoDirectory uses OpenStreetMap anyway.
Your listings keep the latitude and longitude they were saved with, so existing markers stay where they are. What changes is how new addresses are looked up. Google and OpenStreetMap sometimes name the same city or region differently, so after a switch you may get near duplicates of existing locations. With Location Manager you can merge those cities into one. If you have full street addresses, you can also export your listings and geocode them again in bulk.
Differences between the Google Maps and OpenStreetMap APIs explains the trade-offs, and you can also use Google for geocoding and OpenStreetMap for the map display.
GeoDirectory shows this message when Google refuses to geocode an address for your API key. It usually appears when you save a listing or move the map marker. Google denies the request for one of these reasons:
- The Geocoding API isn’t enabled for the key’s project in the Google Cloud Console.
- Billing isn’t set up on the Google Cloud project.
- The key’s restrictions don’t include your site, for example after a move from http to https or to a new domain.
The easiest fix is to create a new key with the Generate Key button at GeoDirectory > Settings > General, under Map Settings. Paste the key into Google Maps API KEY, click Verify and save. If your maps key is restricted by HTTP referrers, put a separate key in the Google Geocoding API Key setting (shown with the advanced settings). Get a Google API key walks through each step.
Clear your page cache afterwards so pages stop loading the old key.
Google returns REQUEST_DENIED when your API key is not allowed to use the Geocoding service. GeoDirectory shows the message when it tries to find an address on the map, for example when you set a location or add a listing.
Check these in the Google Cloud Console:
- The Geocoding API is enabled for the project, as well as the Maps JavaScript API and Places API.
- Billing is enabled on the project.
- The key restrictions allow your site. If the key is restricted by HTTP referrer, add your domain with and without www.
Then make sure the key is saved in GeoDirectory > Settings > General. Our guide Get a Google API key walks through creating a correctly configured key.
Google shows that message, and errors such as “Request denied” or “You must enable Billing on the Google Cloud Project”, when it refuses your API key. GeoDirectory sends the key you saved, so the fix is in your Google Cloud project:
- Link a billing account to the project that owns the key. Google needs billing on the project even when your use stays inside the free monthly credit.
- Make sure the Maps JavaScript API, Geocoding API and Places API are enabled for that project. The button next to the Google Maps API KEY field in GeoDirectory > Settings > General creates a key with the APIs GeoDirectory uses.
- If you restricted the key by website, add your domain to the allowed referrers.
- Check the Quotas page in Google Cloud for any daily limit you set that is now used up.
Your browser console names the exact problem, for example BillingNotEnabledMapError or RefererNotAllowedMapError. If you prefer not to use Google, set Maps API to OpenStreetMap under Map Settings on the same page (click Show Advanced first). See Get a Google API Key.
Not with a setting. On phones, Google Maps uses one finger to scroll the page and two fingers to move the map, and it shows the “use two fingers to move the map” message. It does this so a large map does not trap visitors who are trying to scroll past it. GeoDirectory keeps Google’s default behaviour.
If your map fills most of the screen on mobile, making it shorter on small screens gives visitors room to scroll the page and makes the two-finger gesture feel less awkward.
Both errors usually mean another plugin or your theme is loading Google Maps on the same page as GeoDirectory. Two copies of the Maps API conflict, and the address search on the add listing form can then fail with “InvalidValueError: not an instance of HTMLInputElement”.
- Remove the Google key from the theme or other plugin, or switch its maps off, on pages where GeoDirectory shows a map.
- Keep your key in GeoDirectory > Settings > General > Google Maps API KEY and use the Verify button there.
- If you also see ApiNotActivatedMapError, enable the Maps JavaScript API and Places API for the key’s project in the Google Cloud console.
If you use the separate Google Geocoding API Key setting, do not restrict that key by website, because it is used from the server. Get a Google API Key explains the setup.
Old versions of Marker Cluster loaded the cluster images from a Google Code address that no longer exists, so the clusters showed numbers with no background. Updating GeoDirectory and the Marker Cluster add-on fixes it.
If the images are still missing after updating, clear your site cache and any CDN or optimisation plugin cache. If you replaced the cluster images with your own, check that those image URLs still load and use https. How to Change the Marker Cluster Images shows where they are set.
The map shows “No Records Found” when none of your listings match what the map is asking for. Check these first:
- Every listing has a category. The map filters markers by category, so a listing with no category never gets a marker.
- The listing is published, not pending or draft.
- The listing has an address with a latitude and longitude. Open it in the editor and check the map pin is set.
- The map widget or block is set to the right post type, and its category setting includes the categories you used.
If the map itself does not load at all, that is a different problem, usually the Maps API key. See Maps have stopped working on my site.
Google returns REQUEST_DENIED when your API key is not allowed to make the request. GeoDirectory shows it as “Search was not successful for the following reason: REQUEST_DENIED” when someone searches a location, and as “Geocode was not successful for the following reason: REQUEST_DENIED” when an address is looked up on the add listing form. Both lookups use the Google Maps API KEY saved in GeoDirectory > Settings > General.
Open the project that key belongs to in the Google Cloud console and check:
- The Geocoding API and Places API are enabled for the project, alongside the Maps JavaScript API.
- Billing is enabled on the project.
- If the key is restricted to certain APIs, those APIs are in its list.
- If the key is restricted by website (HTTP referrer), your domain is on the list, including the www version if you use it.
Use the Verify button next to the key in the GeoDirectory settings to test it. Our Get a Google API Key guide walks through creating a key with everything already switched on.
Optimisation plugins that merge, combine or defer JavaScript can change the order the map files load in, or separate them from the settings GeoDirectory prints on the page. The map then fails to start, often with a Google Maps API key error even though your key is fine.
Keep the optimisation on and exclude the map scripts from it. In your plugin’s exclusion list, add:
maps.googleapis.com(the Google Maps API)geodirectory/assets(GeoDirectory’s own scripts, including the map files)
Clear the plugin’s cache and check a page with a map. If it still breaks, turn off script merging to confirm that setting is the cause. If you load maps on demand, also check that the lazy load placeholder still works.
For general advice on caching plugins, see GeoDirectory and caching compatibility.
When you pick an address from the OpenStreetMap suggestions, GeoDirectory fills the city from the address parts OpenStreetMap sends back. It uses the city first, then the city district, then the town. Small villages often come back with none of these, and then GeoDirectory falls back to the state district or the county. That is why you can get a regional name, such as a German Regierungsbezirk, instead of the village or municipality.
OpenStreetMap only gives the municipality as part of the one-line suggestion, so GeoDirectory can’t reliably pick it out. You have two options:
- Add a Google API key and use Google for geocoding while keeping OpenStreetMap for the maps. Google returns a locality for most addresses.
- If you use Location Manager, tidy up wrong cities afterwards by merging locations.
The differences between the Google Maps and OpenStreetMap APIs page explains what else changes between the two.
When a visitor opens a GeoDirectory map in full screen, GeoDirectory moves the map container to the top of the page and adds the class body_fullscreen to the body. The container gets a z-index of 50000. A theme header or mega menu with a higher z-index still shows on top.
Raise the map’s z-index only while it’s full screen, so your menu keeps its normal stacking the rest of the time. Add this in Appearance > Customize > Additional CSS:
body.body_fullscreen > .stick_trigger_container {
z-index: 999999;
}
If your header is still on top, use a number higher than your header’s z-index, or hide the header with body.body_fullscreen in front of its selector.