在Python 3和Pandas中,我有一个带地址的数据框:
Application.Current.Dispatcher.InvokeAsync(new Action(() =>
{
// Your code which is to run after the items are rendered
}), DispatcherPriority.ContextIdle);
完整地址由“logradouro”(街道,大道等),“numero_logradouro”(地点编号),“补充”(地址补充),“bairro”(邻里)和“municipio”(城市)列组成)
示例,地址:“R AURELIO VALPORTO,51,LOJA A,MARECHAL HERMES,RIO DE JANEIRO”,创建链接:https://www.google.com/maps/place/R.+Aur%C3%A9lio+Valporto,+51+-+LOJA+A+-+Mal.+Hermes,+Rio+de+Janeiro+-+RJ,+21555-560/@-22.8588275,-43.3725532,17z/data=!3m1!4b1!4m5!3m4!1s0x9963aae3b2d379:0x2d6d007bdaa4b68c!8m2!3d-22.8588275!4d-43.3703592
请问,我可以访问Google Maps API(Google街景)发送这些完整的地址,并接收每个地址的属性和链接的图像以及地址的更多地理位置(经度和纬度)吗?
我的目的是使用这些数据创建一个数据框,如果可能的话,创建一个包含图像的文件夹。地址来自巴西
答案 0 :(得分:0)
我找到了这个解决方案:
import googlemaps
import google_streetview.api
# Insert your key
gmaps = googlemaps.Client(key='')
# Geocoding an address
geocode_result = gmaps.geocode('R JORGE RUDGE, 108, CASA 23, VILA ISABEL, RIO DE JANEIRO')
lat = geocode_result[0]['geometry']['location']['lat']
lng = geocode_result[0]['geometry']['location']['lng']
# Define parameters for street view api
params = [{
'size': '600x300', # max 640x640 pixels
'location': str(lat)+","+str(lng),
'heading': '0;90;180;270',
'pitch': '-0.76',
'key': '' # insert
}]
# Create a results object
results = google_streetview.api.results(params)
# Download images to directory 'downloads'
results.download_links('downloads')