Google Map not working, or is it just me?
Permalink
I've used the Google Map block hundreds of times, but there seems to be a problem with it I've noticed in the last couple days.
It's now not returning the latitude and longitude from an address. It just defaults to 0,0. Its definitely not the API key because I have an old map working on a site, and then the new map fails to look up a correct address (both with the same API key).
Maybe Google updated something. Any ideas folks?
It's now not returning the latitude and longitude from an address. It just defaults to 0,0. Its definitely not the API key because I have an old map working on a site, and then the new map fails to look up a correct address (both with the same API key).
Maybe Google updated something. Any ideas folks?
jQuery had an update recently (June 30th)... Maybe Google just shifted to the newer framework.
I don't think that's it. There's some XML data pulled from Google's servers to obtain the latitude and longitude, and this is where it's coming back with 0,0. I think it's the actual lookup process.
To FIX that just add a file /application/blocks/google_map/controller.php
and write the following code inside that controller file
This code will basicly prevent loading the google map api in edit mode which is what causes the problem of loading the locations list
and write the following code inside that controller file
<?php namespace Application\Block\GoogleMap; use Concrete\Block\GoogleMap\Controller as GoogleMapBlockController; use Loader; use Page; class Controller extends GoogleMapBlockController{ public function registerViewAssets($outputContent = '') { $this->requireAsset('javascript', 'jquery'); $c = Page::getCurrentPage(); if (!$c->isEditMode()) { $this->addFooterItem( '<script defer src="https://maps.googleapis.com/maps/api/js"></script>' ); }
Viewing 15 lines of 17 lines. View entire code block.
This code will basicly prevent loading the google map api in edit mode which is what causes the problem of loading the locations list
Even if I try this fix, it doesn't work. It only shows a few ! ! ! !.
I get this error in Developertools:
You have included the Google Maps API multiple times on this page. This may cause unexpected errors.
Google Maps API error: MissingKeyMapErrorhttps://developers.google.com/maps/documentation/javascript/error-me...
Google Maps API warning: NoApiKeyshttps://developers.google.com/maps/documentation/javascript/error-me...
Maybe this could help to solve this problem.
I get this error in Developertools:
You have included the Google Maps API multiple times on this page. This may cause unexpected errors.
Google Maps API error: MissingKeyMapErrorhttps://developers.google.com/maps/documentation/javascript/error-me...
Google Maps API warning: NoApiKeyshttps://developers.google.com/maps/documentation/javascript/error-me...
Maybe this could help to solve this problem.
Google Map API now requires an API Key for new applications, so just get an api key from the google api console, and alter my previous code to
$this->addFooterItem( '<script defer src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY"></script>' );
The current problem has been answered very thoroughly in another thread:
http://www.concrete5.org/community/forums/usage/google-maps-not-wor...
http://www.concrete5.org/community/forums/usage/google-maps-not-wor...