Download the PHP package francoisvaillant/geolocator without Composer
On this page you can find all versions of the php package francoisvaillant/geolocator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download francoisvaillant/geolocator
More information about francoisvaillant/geolocator
Files in francoisvaillant/geolocator
Package geolocator
Short Description Geolocator is a simple tool to geolocate address or reverse. It is also able to determinate altitude.
License MIT
Informations about the package geolocator
Geolocator
Geolocator is a simple tool to geolocate address or reverse. It is also capable to determinate altitude.
It uses 3 Api :
- https://adresse.data.gouv.fr/api-doc/adresse
- https://nominatim.org/release-docs/develop/
- https://www.opentopodata.org/
Setup
namespaces
- \Francoisvaillant\Geolocator\
- \Francoisvaillant\Geolocator\Providers
All begin by a place
By default, we uses french Government "adresses Api". If you prefer (especially out of France), you can use NominatimApi by setting it as provider for your Place :
Get Coordinates from address
In order to geolocate an address, your have first to set it and setting City or ZipCode. City is often not enough. It's highly recommended to set city and zipCode before using geolocation.
Get address from coordinates
Get altitude from coordinates
uses OpenTopoData APi. See https://www.opentopodata.org/ for details and restrictions
If you host your own instance of OpenTopoData Api, please change AltitudeProvider :
What you can get :
Once you totally hydrated your Place whith ->geolocate() or ->reverse() (altitude is a bit different), you'll be able to get all the above informations (However depends on the provider) :
- city
- zipCode
- address
- inseeCode
- department code
- departement name
- region name
- latitude and longitude (degrees)
- latitude and longitude (lambert93)
Note that the geolocate() and reverse() return true or false if succeed or not. So you can use :
If you want to check all the response from Api after geolocate(), reverse() or findAltitude() :