使用立交桥API获取设施的错误坐标

时间:2019-02-02 20:59:11

标签: python-3.x openstreetmap overpass-api

我正在使用立交桥API来获得特定位置(半径200 m以内)附近的便利设施。我能够接收结果,但对于最后8条记录(从20到28),我得到的坐标错误。有人可以帮助,是有什么错查询?

import  pandas as pd
from pandas.io.json import json_normalize
pd.set_option('display.max_rows', 500)
pd.set_option('display.max_columns', 500)
pd.set_option('display.width', 1000)
pd.set_option('display.max_colwidth', 500)
# bounding box coordinates
unique_nodes = []
way_nodes = []
# query overpass within OpenStreetMap
import overpass
api = overpass.API()
data = api.get('(node["amenity"](around:200,51.896723,-8.482056);way["amenity"](around:200,51.896723,-8.482056);relation["amenity"](around:200,51.896723,-8.482056);>;);')
#df = [f for f in data.features  if f.geometry['type'] == "LineString"]
df_1 = json_normalize(data['features'])
df_1 = df_1[df_1['properties.amenity'].notnull()]
df_1 = df_1[df_1['properties.name'].notnull()]
print(df_1[['properties.amenity', 'geometry.coordinates', 'properties.name']])

The results are mentioned below:

   properties.amenity      geometry.coordinates                           properties.name
0             college  [-8.4816139, 51.8950368]        Crawford College of Art and Design
1                taxi  [-8.4797104, 51.8974271]                           Cork Taxi Co-op
2          restaurant  [-8.4829027, 51.8971138]                             Café Paradiso
3         car_sharing  [-8.4792851, 51.8964633]                                Wandesford
4             parking   [-8.481515, 51.8961668]                          Saint Finbarre's
5                 pub    [-8.483117, 51.897028]                             Reidy's Vault
6                 pub  [-8.4801976, 51.8973964]                                 Costigans
8     social_facility  [-8.4813453, 51.8976471]                             Penny Dinners
9      bicycle_rental  [-8.4846434, 51.8971537]                               Dyke Parade
10     bicycle_rental  [-8.4822285, 51.8971562]                     St. Finbarre's Bridge
11     bicycle_rental  [-8.4800657, 51.8964889]                           Wandesford Quay
12           pharmacy  [-8.4802256, 51.8975298]                                  Santry's
13                pub  [-8.4812941, 51.8980821]                               Porterhouse
14          fast_food   [-8.4812901, 51.897902]                                Holy Smoke
17         restaurant  [-8.4797886, 51.8975706]                          Feed your Senses
20             school  [-8.4806982, 51.8982846]             Presentation Brothers College
21         university  [-8.4806982, 51.8982846]                          UCC Lee Maltings
22         university  [-8.4806982, 51.8982846]                Tyndall National Institute
23             school  [-8.4806982, 51.8982846]  Saint Maries of the Isle National School
24             school  [-8.4806982, 51.8982846]                     Saint Aloysius School
25            parking  [-8.4806982, 51.8982846]                           Lancaster Lodge
26            theatre  [-8.4806982, 51.8982846]                                  The Kino
27         university  [-8.4806982, 51.8982846]                   University College Cork
28           hospital  [-8.4806982, 51.8982846]                 Mercy University Hospital


0 个答案:

没有答案