Problem with Google maps and addresses

(7 posts) (2 voices)

Tags:

  1. xerxes42, Member

    Hi

    I'm having trouble with addresses in Google maps. In the report we get street and city by:
    "select concat(street,',',city)"

    We have a Google Maps API key so it shouldn't an issue with the number of requests we send. In the current report it's about 800 addresses that we want to put on a map.

    Error in apache log:

    default-error_log:[Tue Oct 30 10:04:57 2012] [error] [client 172.30.29.59] PHP Fatal error: Call to undefined function Ext_GoogleError() in /srv/www/sites/mydbr/extensions/googlemaps/googlemaps.php on line 128, referer: http://dhap.sec.intra/mydbr/index.php?m=5

    Debug from browser:

    <div class="dbrReportTitle">REPORT NAME</div><div><div id="map1" style="margin-left:auto;margin-right:auto;border:thin solid black; width:800px; height:600px">Generating the map...</div></div><script type="text/javascript">//<![CDATA[
    var ext_gm_map1=GM_initMap(1,0,0,0);var ext_gm_points1 = new Array();
    Fatal error: Call to undefined function Ext_GoogleError() in /srv/www/sites/mydbr/extensions/googlemaps/googlemaps.php on line 128

    On the reports that uses coordinates the Google maps integration works fine but we don't have coordinates for all our addresses yet.

    Brgds

  2. myDBR Team, Key Master

    There seems to be a bug which prevents myDBR showing the error returned from Google. We'll fix this.

    --
    myDBR Team

  3. myDBR Team, Key Master

    Fixed. You can run the updater and rerun the report to see which error Google returns. Beware that if the address is unknown to Google Maps, it returns no results for the address.

    --
    myDBR Team

  4. xerxes42, Member

    Hi

    The new build handles the error correctly. But the response we get is no response from Google. The interesting thing is if I do a manual test with the URL and add the address I get the result.

    One of the addresses that we want to map is "Vaaralankulma 22 G,VANTAA". If I do a manual test with the URL from googlemaps.php:
    http://maps.googleapis.com/maps/api/geocode/json?address=Vaaralankulma%2022%20G,VANTAA&sensor=true

    I get a result within one second so the address exists.

    Another thing I wondered about is why the google maps extension doesn't uses the Google API key when one is specified? Since we have a API key and can make 100000 geocodings per day and we want to use it.
    I've tested the same address with the Google Geocoding API and the following URL:
    "https://maps.google.com/maps/geo?key=GOOGLE_API_KEY&output=json&q=Vaaralankulma%2022%20G,VANTAA&sensor=true"

    And that returns the information as well.

    Brgds

  5. myDBR Team, Key Master

    Google's geocoding server limits the answers if it thinks that too many queries are performed too fast. myDBR tries to compensate this by adding delay to the queries if it does not get answer from Google. Also, if myDBR get's no result from Google it will try again few times.

    The no answer situation can happen with any address so this is why you may get successful result if you make the same query separately.

    myDBR's Google Maps extension does not have the support for Google Maps API for Business requests as the authentication was changed from Google API key to client id+signature when Google went from API v2 to v3. The API key is no loger used in v3 API (the old v2 API has been deprecated).

    Adding a support for Google Maps API for Business is quite straightforward so we can take a look at it (or you can add it yourself). This should also help with your problems as Business requests are prioritized.

    In general, if you do a lot of queries based on the addresses, you would be better off if you store the latitude / longitude alongside the addresses. Not only can you avoid using the geocode services, but maps will perform better also.

    --
    myDBR Team

  6. xerxes42, Member

    Hi

    Thanks for the clarifications.

    It would be very nice if there was native support in MyDBR for using Google Maps API for Business. I don't have the time or php skills to build this myself.

    We are building an integration to use with our ETL tool so we can use the Google Maps API for Business to get coordinates when we import addresses from other sources so the bulk of our reports with maps will use coordinates within a couple of weeks. But it would still be nice to be able to use the API for Business on the occasions that we only have the address available to myDBR.

    Brgds

  7. myDBR Team, Key Master

    You can try with the latest build which has some improvements to Google Maps, including support for the Maps API for Business.

    To enable the Maps API for Business support add following entry into your user/defaults.php with your client ID and private key:

    $mydbr_defaults['chart']['google_maps_business'] =
    array('client_id' => 'clientID', 'private_key' => 'vNIXE0xscrmjlyV-12Nj_BvUPaw=');

    --
    myDBR Team


Reply

You must log in to post.