HOW TO add Google Map API key?

Discuss everything related to Medical Appointment. All versions. Any questions related to the Medical Appointment developing or using should be posted to this forum.

Moderators: alexandrleonenko, Milton

Site Admin
Site Admin
Posts: 6176
Joined: Jan 7th, '09, 23:18

HOW TO add Google Map API key?

Postby administrator » Nov 28th, '12, 16:30

There is a Google Maps module in the last version (2.1.1), that requires using of Google Maps API Key.

The Static Maps API uses an API key to identify your application.
API keys are managed through the Google APIs console. To activate the Static Maps API and create your key:

1. Visit the APIs console at and log in with your Google Account.
2. Click the Services link from the left-hand menu, then activate the Static Maps API service.
3. Once the service has been activated, your API key is available from the API Access page, in the Simple API Access section.

google_api_key_inside.png (40.93 KiB) Viewed 4607 times

4. Static Maps API applications use the Key for browser apps.
5. Enter generated key on your Modules » Google Maps » Google Maps Settings page

google_api_key.png (11.05 KiB) Viewed 4616 times

REMEMBER: Google has changed API2 (deprecated) to API3.
To fix this issue with retrieving address coordinates manually do following (fixed in v2.2.0 or higher):

1. Open include/classes/DoctorAddresses.class.php, find there UpdateCoordinates() class
2. API code with following:

Code: Select all

$address = urlencode($address);
$url = ''.$address.'&sensor=false';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_PROXYPORT, 3128);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$response = curl_exec($ch);
$response_a = json_decode($response);
$latitude = $response_a->results[0]->geometry->location->lat;
$longitude = $response_a->results[0]->geometry->location->lng;

You may also read Google API Tutorial:

Return to “ApPHP Medical Appointment / uDoctorAppointment Talk {developers/users}”