将经度和纬度值配对到列表

时间:2019-06-07 15:36:32

标签: foursquare nominatim

我已经使用Nominatin软件包和Foursquare API来获取经度和纬度对,如下所示。我想将结果输出到两个不同的列中进行处理:     Lng = [59.922816,........]     纬度= [10.700466,........]

from geopy.geocoders import Nominatim

addresses = ['Nobels gate 32, N-0268 Oslo', 'Akershus Festning, 0015 Oslo', 
'Frederiks gate 2, 0164 Oslo', 'Universitetsgata 13, Oslo', 'Tøyengata 53, 
0578 Oslo', 'Bellevue, Oslo', 'Frederiks gate 2, 0164 Oslo', 
'Bygdøynesveien 39, 0286 Oslo', 'Kongeveien 5, 0787 Oslo', 'Karl Johansgate 
11, 0154 Oslo', 'Rådhuset, 0037 Oslo', 'Bryggegata 9, 0120 Oslo', 'Sars 
gate 1, 0562 Oslo', 'Kirsten Flagstads Plass 1, 0150 Oslo']
#
geolocator = Nominatim(user_agent="foursquare_agent")
for add in addresses:
location = geolocator.geocode(add)
latitude = location.latitude
longitude = location.longitude
print(latitude, longitude)

### Output
59.922816 10.700466
59.9065863 10.7378627
59.916808 10.735398
59.91620355 10.7375404541528
59.916937 10.773577
44.4643809 -87.9406845
59.916808 10.735398
59.90336175 10.6995504838587
59.962632 10.666289
59.91199 10.746575
59.91222 10.730143
59.9101305 10.72643
59.9197905 10.7710802
59.90728015 10.7531208091572

0 个答案:

没有答案