GeolocationGeocoderV3.php in Geolocation Field 8.3
File
src/Plugin/Geocoder/Dumper/GeolocationGeocoderV3.php
View source
<?php
namespace Drupal\geolocation\Plugin\Geocoder\Dumper;
use Drupal\geocoder\DumperBase;
use Geocoder\Location;
class GeolocationGeocoderV3 extends DumperBase {
public function dump(Location $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,
];
}
}