You are here

public function NominatimRoadFirstFormattingBase::format in Geolocation Field 8.2

Same name and namespace in other branches
  1. 8.3 modules/geolocation_leaflet/src/NominatimRoadFirstFormattingBase.php \Drupal\geolocation_leaflet\NominatimRoadFirstFormattingBase::format()

Reverse geocode an address.

Intended return subject to available data:

[
  'organization',
  'address_line1',
  'address_line2',
  'postal_code',
  'sorting_code',
  'dependent_locality',
  'dependent_locality_code',
  'locality',
  'locality_code',
  'administrative_area',
  'administrative_area_code',
  'country',
  'country_code',
  'formatted_address',
];

Parameters

array $atomics: Address components.

Return value

array||null Address or NULL.

Overrides NominatimCountryFormattingBase::format

1 call to NominatimRoadFirstFormattingBase::format()
Brazil::format in modules/geolocation_leaflet/src/Plugin/geolocation/GeocoderCountryFormatting/Brazil.php
Reverse geocode an address.
1 method overrides NominatimRoadFirstFormattingBase::format()
Brazil::format in modules/geolocation_leaflet/src/Plugin/geolocation/GeocoderCountryFormatting/Brazil.php
Reverse geocode an address.

File

modules/geolocation_leaflet/src/NominatimRoadFirstFormattingBase.php, line 16

Class

NominatimRoadFirstFormattingBase
Alternative street formatting base class.

Namespace

Drupal\geolocation_leaflet

Code

public function format(array $atomics) {
  $address_elements = parent::format($atomics);
  if ($atomics['houseNumber'] && $atomics['road']) {
    $address_elements['addressLine1'] = $atomics['road'] . ' ' . $atomics['houseNumber'];
  }
  return $address_elements;
}