1. Home
  2. Docs
  3. Property Hive – Cor...
  4. Maps, Co-ordinates and Geocoding

Maps, Co-ordinates and Geocoding

Choosing a Map Provider

In Property Hive you can choose the map provider used to display maps throughout your site and the backend of WordPress. By default this will be Google, however we understand that sites with high traffic may begin to incur costs after a certain number of map views.

As a result, as of version 1.4.70 of Property Hive you can now choose an alternative map provider. Currently the only other supported map provider is OpenStreetMap however other map providers (i.e. MapBox) will be added at a later date.

To choose your map provider simply navigate to 'Property Hive > Settings > General > Map':

Please note that Geocoding requests (i.e obtaining co-ordinates for properties and radial search) will still use the Google Geocoding service for now so a Google Geocoding API Key may still need to be present for these to still work.

Using Google Maps

Back in July 2018, Google got stricter with their Google Maps API usage. We wrote about this here.

In short, it meant that an API key with the right permissions would always be required when doing anything relating to maps or geocoding.

Within Property Hive there are a number of places that we use maps or geocoding. To name a couple:

  • The [property_map] shortcode
  • Automatically obtaining the co-ordinates for a property when entered into Property Hive
  • The Map Search add on
  • The Radial Search add on
  • The Property Import add on when importing properties using a format that doesn't provide the co-ordinates so we have to go off and obtain them ourselves.

If you're experiencing issues with any of the above there are 2 things to check:

  1. That you have a Google Maps API key entered in WordPress under 'Property Hive > Settings > General > Map'. Keys can be obtained here.
  2. If you're using any of the geocoding functionality, that the API key entered has not only the JavaScript API enabled, but also the separate Geocoding API library. To do this, visit your API console and navigate to 'Libraries'. Do a search for 'Geocoding', click into the library and click the 'Enable' button.

Debugging Maps Not Displaying Correctly

If you've having issues with maps not displaying or showing errors, by far the best way to debug this is view the console. In most browsers you can do this by pressing F12 then navigate to 'Console' where you will likely see an error relating to the maps.

It could be that the API is missing or invalid, or maybe Google Maps is being included multiple times on the page. Either way, by checking the console you should right away what the cause of the map not displaying is.

Debugging Geocoding Not Working

Geocoding not working is slightly more difficult to debug but in 99.9% of cases it's because of a missing API key or an API key that doesn't have the Geocoding library enabled as mentioned higher up this page.

A quick way to test this is to visit a link like so:

https://maps.googleapis.com/maps/api/geocode/xml?address=london&sensor=false&region=gb&key={your-key-here}

If the key isn't valid you'll get an error message displayed.

Was this article helpful to you? No 1 Yes

How can we help?