Add New Venue geolocation fails if WordPress Address uses .scot
WordPress Event Management, Calendars & Registration › Forums › Report A Bug › Add New Venue geolocation fails if WordPress Address uses .scot
This topic contains 4 replies, has 2 voices, and was last updated by Stephen Harris 8 years, 1 month ago.
-
AuthorPosts
-
August 24, 2016 at 10:37 am #23892
Hi Stephen, we have encountered an issue with Add New Venue failing to geolocate venue addresses when the WordPress Address uses .scot.
Users can enter Venue Location meta but the viewport and marker remain at 0,0 and the marker must be manually dragged into place.
Add New Venue successfully geolocates venue addresses when the WordPress Address is set to .com and Site Address remains .scot, so we have implemented this as a workaround.
Example Net traffic for .com:
GET https://maps.googleapis.com/maps/api/js/QuotaService.RecordEvent [HTTP/2.0 200 OK 63ms] GET https://maps.googleapis.com/maps-api-v3/api/js/26/1/geocoder.js [HTTP/2.0 200 OK 11ms] GET https://maps.googleapis.com/maps/api/js/GeocodeService.Search [HTTP/2.0 200 OK 89ms] GET https://csi.gstatic.com/csi [HTTP/2.0 204 No Content 40ms] GET https://maps.googleapis.com/maps/api/js/ViewportInfoService.GetViewportInfo [HTTP/2.0 200 OK 64ms] GET https://maps.googleapis.com/maps/gen_204 [HTTP/2.0 204 No Content 21ms] GET https://maps.googleapis.com/maps/api/js/StaticMapService.GetMapImage [HTTP/2.0 200 OK 189ms] GET https://maps.googleapis.com/maps/vt [HTTP/2.0 200 OK 80ms]
for .scot:
GET https://maps.googleapis.com/maps/api/js/QuotaService.RecordEvent [HTTP/2.0 200 OK 58ms] GET https://maps.googleapis.com/maps-api-v3/api/js/26/1/geocoder.js [HTTP/2.0 200 OK 11ms] GET https://maps.googleapis.com/maps/api/js/GeocodeService.Search [HTTP/2.0 200 OK 71ms] GET https://csi.gstatic.com/csi [HTTP/2.0 204 No Content 111ms] GET https://maps.googleapis.com/maps/api/js/GeocodeService.Search [HTTP/2.0 200 OK 61ms] GET https://csi.gstatic.com/csi [HTTP/2.0 204 No Content 112ms] GET https://maps.googleapis.com/maps/api/js/GeocodeService.Search [HTTP/2.0 200 OK 32ms] GET https://csi.gstatic.com/csi [HTTP/2.0 204 No Content 111ms]
scot appears not to generate calls to
https://maps.googleapis.com/maps/api/js/ViewportInfoService.GetViewportInfo
https://maps.googleapis.com/maps/gen_204
https://maps.googleapis.com/maps/vt
Help appreciated, thanks – David
SRUC WebmasterAugust 24, 2016 at 1:13 pm #23893Hi David,
I’ve just tested this on a .scot domain and it worked without any issue (I used a local VM and edited by hosts file – but the site url, which would be used by Google was a .scot domain – I checked this by changing the Google API key conditions just to make sure that Google was using the site url I expect it to).
With regards to the plug-in it just loads the Google Maps API (v3) and then uses the API. It doesn’t provide the site url (or domain) to Google, but Google will collect that information when using the maps API. In short – there’s nothing in the plug-in to fix here. All the urls listed above are automatically loaded by Google as part of its API.
My only thought would be that you have a Google maps key that is only valid for your .com domain (I’m assuming that the .com and .scot sites are actually one and the same). However, testing this, I see a grey ‘map’ and an error message.
Stephen HarrisAugust 24, 2016 at 2:04 pm #23895Hi Stephen, thanks for the quick reply.
The “Accept requests from these HTTP referrers (websites) (Optional)” field for the API key is empty. Like you say, if there is a referrer set here, and it doesn’t match the domain, then a grey box and an error is displayed in place of the map.
What we’re seeing here is that whereas changes to Venue Location meta fields in the Add New Venue screen are usually accompanied by an immediate refresh of the map centred on the location entered by the user, with the .scot domain used for WordPress Address, no refresh happens. The map remains centred on lat 0 lon 0, e.g. https://www.google.co.uk/maps/@0,0,9z
We are using WP Engine, who have a ton of caching and CDN stuff in place. Since WordPress Address ending .wpengine.com works but .scot does not, I’m going to ask their support for assistance here.
SRUC WebmasterSeptember 28, 2016 at 1:27 pm #24436Hi Stephen, I’ve resolved the issue. Posting this in case it helps anyone else.
Looking at the browser’s console log when adding a location via /edit.php?post_type=event&page=venues&action=create showed an “This API project is not authorized to use this API.” message.
Sure enough, the Google API Console for this project showed I had enabled the Google Maps JavaScript API https://console.developers.google.com/apis/api/maps_backend/ but not the Google Maps Geocoding API https://console.developers.google.com/apis/api/geocoding_backend/
Once the Google Maps Geocoding API was enabled, the issue disappeared and adding a location behaves as expected.
We encountered this issue on the live domain (.scot) but not when using the development domain – since the development domain predates Google’s API key rule, the “missing” API caused no issue.
However for new domains, both the Google Maps JavaScript API AND the Google Maps Geocoding API need to be enabled.
https://developers.google.com/maps/documentation/javascript/geocoding does mention this, but it’s not made clear simply from reading https://developers.google.com/maps/documentation/javascript/get-api-key
Regards, David
SRUC WebmasterOctober 2, 2016 at 12:48 am #24494Hi David,
Thanks for getting back to me. I hadn’t realised that the Maps API and Geocoding API were considered separate services.
Stephen Harris -
AuthorPosts