How to get a place's longitude and latitude?

legaulph at gmail.com legaulph at gmail.com
Mon Feb 24 12:16:49 EST 2020


Try something like

import requests
import json

url =
"https://nominatim.openstreetmap.org/search.php?q=city+country&format=json&l
imit=1"
result = requests.get(url)
dataobj = result.json()
x = dataobj[0]['lat'] + "," + dataobj[0]['lon']
print(x)



-----Original Message-----
From: Python-list <python-list-bounces+legaulph=gmail.com at python.org> On
Behalf Of Aakash Jana
Sent: Monday, February 24, 2020 11:08 AM
To: Souvik Dutta <souvik.viksou at gmail.com>
Cc: python-list at python.org
Subject: Re: How to get a place's longitude and latitude?

You might use webscraping with requests and beautiful soup to scrape up some
website for that gives such utility


On Mon, 24 Feb 2020, 9:36 pm Souvik Dutta <souvik.viksou at gmail.com wrote:

> Hi guys I want to make a program that kinda sends an sos message with 
> the measures of longitude and latitude (which is super inconvenient) 
> to someone. How can I do that I mean how can I get the longitude and
latitude?
> Any help would be appreciated.
> --
> https://mail.python.org/mailman/listinfo/python-list
>
--
https://mail.python.org/mailman/listinfo/python-list



More information about the Python-list mailing list