You are here

protected function Proximity::getGeocodedAddress in CiviCRM Entity 8.3

Get the geocoded data.

Parameters

array $address: Address based on the format of CRM_Core_BAO_Address::addGeocoderData().

Return value

array An array of geocoded data based on the address.

See also

CRM_Core_BAO_Address::addGeocoderData()

1 call to Proximity::getGeocodedAddress()
Proximity::query in src/Plugin/views/filter/Proximity.php
Add this filter to the query.

File

src/Plugin/views/filter/Proximity.php, line 252

Class

Proximity
Filter handler for proximity.

Namespace

Drupal\civicrm_entity\Plugin\views\filter

Code

protected function getGeocodedAddress(array $address) {
  $address = array_filter($address);
  if (!\CRM_Core_BAO_Address::addGeocoderData($address)) {
    throw new \Exception('Unable to properly geocode address.');
  }
  return [
    'latitude' => $address['geo_code_1'],
    'longitude' => $address['geo_code_2'],
  ];
}