public function GeocoderApiEnpoints::reverseGeocode in Geocoder 8.2
Same name and namespace in other branches
- 8.3 src/Controller/GeocoderApiEnpoints.php \Drupal\geocoder\Controller\GeocoderApiEnpoints::reverseGeocode()
1 string reference to 'GeocoderApiEnpoints::reverseGeocode'
File
- src/
Controller/ GeocoderApiEnpoints.php, line 253
Class
- GeocoderApiEnpoints
- Class GeocoderApiEnpoints.
Namespace
Drupal\geocoder\ControllerCode
public function reverseGeocode(Request $request) {
$latlng = $request
->get('latlng');
$geocoders_ids = $request
->get('geocoder');
$geocoders = explode(',', $geocoders_ids);
$format = $request
->get('format');
if (isset($latlng)) {
$latlng = explode(',', $request
->get('latlng'));
$options = $this
->setGeocodersOptions($request);
$dumper = $this
->getDumper($format);
$geo_collection = $this->geocoder
->reverse($latlng[0], $latlng[1], $geocoders, $options);
if ($geo_collection && $geo_collection instanceof AddressCollection) {
$this
->getAddressCollectionResponse($geo_collection, $dumper);
}
}
return $this->response;
}