PHP code example of cowegis / contao-geocoder
1. Go to this page and download the library: Download cowegis/contao-geocoder library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
cowegis / contao-geocoder example snippets
use Cowegis\ContaoGeocoder\Provider\Geocoder;
final class MyService
{
private $geocoder;
public function __construct(Geocoder $geocoder)
{
$this->geocoder = $geocoder;
}
public function geocode(string $address) : \Geocoder\Location
{
return $this->geocoder
// Optional use a specific geocoder. Otherwise the default provider is used
->using('foo')
->geocodeQuery(\Geocoder\Query\GeocodeQuery::create($address))
->first();
}
}
composer al for Nominatim support
composer r