-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a3a53de
commit 658cb5f
Showing
2 changed files
with
23 additions
and
7 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 |
---|---|---|
@@ -1,17 +1,34 @@ | ||
#!/home/nik/github/try/python/latitude/bin/python | ||
|
||
import argparse | ||
|
||
# | ||
# Args | ||
# | ||
argParser = argparse.ArgumentParser() | ||
argParser.add_argument('--check', dest='check', help='String to check against known good') | ||
argParser.add_argument('--debug', dest='debug', default=False, action='store_true', help='Debug mode for various things') | ||
argParser.add_argument('address') | ||
|
||
|
||
|
||
args = argParser.parse_args() | ||
|
||
print(f"You entered an address off >>>{args.address}<<<") | ||
|
||
|
||
# importing geopy library and Nominatim class | ||
from geopy.geocoders import Nominatim | ||
|
||
# calling the Nominatim tool and create Nominatim class | ||
loc = Nominatim(user_agent="Geopy Library") | ||
|
||
# entering the location name | ||
getLoc = loc.geocode("172 hartford street natick ma") | ||
getLoc = loc.geocode(args.address) | ||
|
||
# printing address | ||
print(getLoc.address) | ||
|
||
# printing latitude and longitude | ||
print(f"Latitude = {getLoc.latitude}\n") | ||
print(f"Longitude = {getLoc.longitude}\n") | ||
print(f"Latitude = {getLoc.latitude:.6f}") | ||
print(f"Longitude = {getLoc.longitude:.6f}") |
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