public function Geolocation::dump in Geolocation Field 8
Same name and namespace in other branches
- 8.2 src/Plugin/Geocoder/Dumper/Geolocation.php \Drupal\geolocation\Plugin\Geocoder\Dumper\Geolocation::dump()
File
- src/
Plugin/ Geocoder/ Dumper/ Geolocation.php, line 21
Class
- Geolocation
- Provides a geolocation geocoder dumper plugin.
Namespace
Drupal\geolocation\Plugin\Geocoder\DumperCode
public function dump(Address $address) {
$data = $address
->toArray();
$lat = $data['latitude'];
$lng = $data['longitude'];
unset($data['latitude'], $data['longitude'], $data['bounds']);
return [
'lat' => $lat,
'lng' => $lng,
'lat_sin' => sin(deg2rad($lat)),
'lat_cos' => cos(deg2rad($lat)),
'lng_rad' => deg2rad($lng),
'data' => $data,
];
}