Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-10115

Google Geocoding does not notify the user when the website has hit the 25 000 query limit.

    Details

    • Type: Improvement
    • Status: Done/Fixed
    • Priority: Minor
    • Resolution: Incomplete
    • Affects Version/s: 4.1.2, 4.6.24, 4.7.14
    • Fix Version/s: None
    • Component/s: Core CiviCRM
    • Labels:
    • Versioning Impact:
      Patch (backwards-compatible bug fixes)
    • Documentation Required?:
      None
    • Funding Source:
      Needs Funding

      Description

      When running the cron for geocoding it will not notify when it has hit the query limit.

      Also, if it hits the query limit with thousands more contact records to go... it'll keep sending requests to Google for to geocode addresses, every time getting the OVER_QUERY_LIMIT response. This could be handled better.

      The idea is to get rid of the eval() in BatchUpdate.php, or at least fall back to it, and check the return value. If the return value of a geocoding request was OVER_QUERY_LIMIT then we'll exit the loop so we don't hit Google's servers (potentially thousands of times for the remaining contacts) and always get OVER_QUERY_LIMIT back.

      For this I set up some consts at the beginning of the Google.php geocoding class and return those, because true and false didn't cut it anymore.

      The formatting function for geocoding addresses is called from a couple of other places, but the return value is never checked so there's no problem there.

      krimson@hbddc1093:/home/prod_ienet/default_www/sites/all/modules/contrib/civicrm/CRM$ grep -R ".geo.::format(" *
      Contact/BAO/ProximityQuery.php: eval( $config->geocodeMethod . '::format( $proximityAddress );' );
      Core/BAO/Address.php: eval( $config->geocodeMethod . '::format( $params );' );
      Utils/Address/BatchUpdate.php: $geocodingResult = CRM_Utils_Geocode_Google::format($params, true);
      Utils/Address/BatchUpdate.php: eval( $config->geocodeMethod . '::format( $params, true );' );

      I've added BatchUpdate.php and Google.php with the new code.

        Attachments

        1. BatchUpdate.php
          11 kB
          Jeroen Bensch
        2. Google.php
          6 kB
          Jeroen Bensch

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                jeroen Jeroen Bensch
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: