PHP code example of juskiewicz / geolocation
1. Go to this page and download the library: Download juskiewicz/geolocation 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/ */
juskiewicz / geolocation example snippets php
$streetName = 'Maltańska';
$streetNumber = '1',
$postalCode = '61-131',
$locality = 'Poznań',
$country = 'Polska',
$address = new Address(
null,
$streetName,
$streetNumber,
$postalCode,
$locality,
$country
);
$geolocation = new Geolocation('YOUR_GOOGLE_MAPS_API_KEY', 'pl', 'pl');
$coordinates = $coordinates = $geolocation->getCoordinatesByObject($address);
// Współrzędne
$latitude = $coordinates->getLatitude();
$longitude = $coordinates->getLongitude();
$tablica = $coordinates->toArray();
php
$address = "Maltańska 1, 61-131 Poznań, Polska";
$geolocation = new Geolocation('YOUR_GOOGLE_MAPS_API_KEY', 'pl', 'pl');
$coordinates = $geolocation->getCoordinatesByString($address);
php
$latitude = 51.8990865;
$longitude = 17.7863699;
$coordinates = new Coordinates($latitude, $longitude);
$geolocation = new Geolocation('YOUR_GOOGLE_MAPS_API_KEY','pl', 'pl');
$address = $geolocation->getAddress($coordinates);