-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CRITICAL UPDATE - Switching Reverse-Geocoder for the GPS
Hello Everyone 🎆 , Today , Im giving this big update to Switch of the Google Maps API to the GeoPy API. WHY ?✈️ As you may notice , Google has changed the way how to use Google Maps as an API. So , I don't want to pay for a basic features as the GPS , so I'm switching of Geocoders with a totally new API more complete and cool tools and FREE 🍐 . Go check GeoPy's Github Page here 👍 : https://github.com/geopy/geopy Thank you to read this , 💞 🌃 🌝 .
- Loading branch information
1 parent
1be853f
commit 085a7a6
Showing
4 changed files
with
144 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: UTF-8 -*- | ||
|
||
#AIDES: https://github.com/geopy/geopy | ||
#AIDES: https://pypi.org/project/geopy/ | ||
#AIDES: https://geopy.readthedocs.io/en/stable/index.html?highlight=reverse | ||
|
||
import geopy.geocoders #--> sudo pip install geopy | ||
from geopy.geocoders import Nominatim #Nominatim Service | ||
|
||
#--- | ||
#Cette blibliothèque permet de travailler avec du contenue contenant des accents | ||
import unidecode #--> sudo pip install unicode | ||
|
||
#unaccented_location = unidecode.unidecode(location.address) | ||
#--- | ||
|
||
geolocator = Nominatim(user_agent="GPS-SWAGG") #Utilisation des Services de Reverse-Geocoding de Nominatim, https://nominatim.openstreetmap.org/reverse.php?format=html | ||
#coordonees_GPS = str(Decimal_latitude) +","+ str(Decimal_longitude) | ||
location = geolocator.reverse("47.2224326667, -0.729606666667") #Envoie aux Services de Nominatim les coordonées GPS et reception de la Réponse | ||
|
||
unaccented_location = unidecode.unidecode(location.address) #On Retire les Accents de la Réponse de l'API | ||
print("\n") #Saut de ligne | ||
print(unaccented_location) #Affichage de la Réponse (sans accents) | ||
print("\n") #Saut de Ligne | ||
#Potsdamer Platz, Mitte, Berlin, 10117, Deutschland, European Union | ||
|
||
print((location.latitude, location.longitude)) #Affichage des coordonées du Lieu indiqué | ||
#(52.5094982, 13.3765983) | ||
|
||
print("\n") | ||
#print(location.raw) | ||
|
||
Ville = location.raw['address']['town'] | ||
Numero_Maison = location.raw['address']['house_number'] | ||
Rue = location.raw['address']['road'] | ||
Code_Postal = location.raw['address']['postcode'] | ||
Pays = location.raw['address']['country'] | ||
|
||
print(Ville) | ||
print(Numero_Maison) | ||
print(Rue) | ||
print(Code_Postal) | ||
print(Pays) | ||
#{'place_id': '654513', 'osm_type': 'node', ...} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters