2

I want to generate latitude and longitude automatically for CiviCRM contact when the address is present.

How to achieve this?

4

You need to enable Mapping and Geocoding from civicrm/admin/setting/mapping?reset=1

  • Enter your API Key or Application ID. An API Key is required for the Google Maps API. Refer to developers.google.com for the latest information.

  • Save the form and you should be able to see latitude and longitude based on your contact's address. Note that it displays when you click on inline edit and load the address form as shown below.

enter image description here

Also see https://docs.civicrm.org/user/en/latest/initial-set-up/mapping/

2

Welcome to Stackexchange. Take a look at the docs about geocoding and mapping. If you're using Google then you need an API key for geo coding requests. To get Google API key you can find information here.

Once you have api key navigate CiviCRM >> Administer >> System Settings >> Mapping and Geocoding and set the API key there.

After enabling the mapping provider, you may need to use this script to generate latitude/longitude information for existing contact addresses.

  • Navigate to CiviCRM >> Administer >> Localization >> Address Settings. Update Address Editing section with Latitude, Longitude, and Street Address Parsing enabled enter image description here

    • Enable cron job 'Geocode and Parse Addresses' by navigating to CiviCRM >> Administer >> System Settings >> Scheduled Jobs. With geocoding=1 and parse=0/1 in the Geocoding Parameters.

You can also use CiviCRM Geocoder extension which provides additional information about the address.

HTH

Pradeep

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.