3

Pulling my hair out a little! I'm trying to set up the mapping feature on CiviCRM. I've got a google API for the geocoding, I've enabled longitude/latitude/parsing in the localisation section, and I've got the geocoding scheduled task set to: geocode=1, and I've executed the task. I'm not getting any longitudes or latitudes in any of my contacts (it works if I add them manually). What am I missing? And does it matter all our contacts are based in the UK?

Cheers.

  • Is there anything in the job log? On the scheduled jobs screen to the right of the geocode task there's a link to view the log. – Demerit Jan 29 at 16:46
  • So if I have: geocoding=1, parse=0 and execute this task then in the log I get told: Full message: Finished execution of Geocode and Parse Addresses with result: Success (Addresses Evaluated: 2 Addresses Geocoded: 0 Street Addresses Parsed: 2 ). which obviously doesn't seem right! – Andrew Metheven Jan 29 at 21:06
  • It's possible the parsing setting in localisation is confusing it somehow. That might only be available for US addresses? I'd try turning the parsing setting off, and then also trying it with some of the optional parameters like start and end just to see if that works. – Demerit Jan 29 at 22:17
  • Good though - unfortunately I get "Finished execution of Geocode and Parse Addresses with result: Failure, Error message: Error: You need to enable Street Address Parsing under Administer > Localization > Address Settings." Damned if you do, damned If you don't ;) – Andrew Metheven Jan 29 at 22:35
  • Weird. It really does seem like it's doing geocoding = 0 and parse = 1 even though you've set it otherwise. Are you able to run the job using one of the other cron methods, e.g. cv, url ? It is also possible to run it from the api explorer at /civicrm/api. Choose Job entity and geocode as the action. – Demerit Jan 29 at 22:40
5

I worked it out! Many of my contacts weren't given a country (must have been forgotten in a profile). I checked what the difference was between the handful that were working and the lots which weren't and spotted the missing country - as soon asI updated the contacts that were missing a country it started finding the longitude and latitude. Thanks for the help!

  • Note that you can specify a default country in Administer menu » Localization » Languages, Currency, Location. – Jon G - Megaphone Tech Jan 30 at 15:55
  • I found the same thing, and default country was already configured. The country is displayed on contact records, but if you edit, you see that the country is not in fact set. Fortunately for me, most important addresses are added through a drupal webform, and once I added the country field to the webform, it picked up the default. It is a bit clunky though: we only have one country enabled as an option. I had to set the missing country for existing contacts, and they were geocoded on the next job run. – ginkgoMZD Jun 22 at 1:10
1

Google needs a credit card on file I believe even if you don't exceed the monthly credit amount.

  • Except he says it works when he adds contacts manually, so the google setup part must be right, but yes in general you are correct. – Demerit Jan 29 at 20:53
  • I'm fairly confident I've got this set up right - I've set up a paying account with a credit card with google and got an API from there. – Andrew Metheven Jan 29 at 21:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.