[GIS] Get latitude and longitude from just the name of a company, its city and country of location, no physical address

geocodingpythonsoftware-recommendations

I have been trying to find the latitude and longitude of a list of company-names. For example, the addresses look like this-(1Mobility India Pvt Ltd Pune Maharashtra India), (21st Century Software Solutions Pvt Ltd Visakhapatnam Andhra Pradesh).

I am geocoding using python and I know how to geocode if I am given the complete set of addresses.

For that I use geocoders package from GoogleV3. Using this package however I am able to recover only the latitude and longitude of the city and not the exact location of the company within the city. In Google maps online , however, I can recover the exact lat long for the company.

Does anyone have any experience about which python package to use for batch geocoding when only company names are given or any other way to batch geocode with just names?

Best Answer

Use the google maps API (requires api key)

from urllib.request import urlopen, Request
from bs4 import BeautifulSoup

# use the google map api
import json


url = 'https://maps.googleapis.com/maps/api/geocode/json?address=Braman+Municipal+Utilities'
jsonurl = urlopen(url)

text = json.loads(jsonurl.read())
print ( text['results'][0]["formatted_address"])
print ( text['results'][0]["geometry"]['location']["lat"])
print ( text['results'][0]["geometry"]['location']["lng"])
Related Question