Google 地点不在 return 半径范围内

Google Places does not return place in reach of radius

我目前正在尝试查找位于特定地址的公司的地点详细信息。为此,我使用 geopy 将我拥有的地址编码为地理坐标。然后我使用 google places API 获取周围的地方并使用它们的 id 通过 google places details 获取详细信息(在下面找到我的代码)。

问题是,我可以在 google 地图上成功搜索到的公司没有列在搜索结果中。一个问题可能是该公司“永久关闭”——但由于这是从 Google Places 返回的字段,而且我仍然可以通过网络搜索在 google 地图上找到该公司,我认为这实际上应该无关紧要。

你知道为什么我的位置不在返回的位置吗?

我的代码:

companies = [{'name': '"Bullermeck" Spielscheunen und Freizeitanlagen GmbH', 'address': 'Am Kirchplatz 6, 26441 Jever'}]
places = []
myfields = ['name', 'website', 'type', 'rating', 'review', 'url', 'formatted_address', 'permanently_closed']


for company in companies:
    placesForCompany = {'company': company['name'], 'original_address': company['address']}

    # Derive coordinates by converting the address with geopy
    location = geolocator.geocode(company['address'])
    coordinates = str(location.latitude) + ", " + str(location.longitude)
    placesForCompany['coordinates'] = coordinates

    # Search for places in a 500m radius - the radius is a bit higher because of the inaccuracy of geopy
    result = gmaps.places_nearby(location=coordinates, radius=500)

    # Gather the found places in this array
    placesForCompany['nearbyPlaces'] = []

    # Iterate all the found places
    for place in result['results']:
        # Use the place_id to get more information about the place from Google Place Details
        place_id = place['place_id']
        place_details = gmaps.place(place_id = place_id, fields = myfields, language='de')
        placesForCompany['nearbyPlaces'].append(place_details['result'])

    places.append(placesForCompany)

这是我的 google 地图搜索的屏幕截图:

您似乎在地址 Am Kirchpl 搜索 Bullermeck Spielscheunen und Freizeitanlagen。 6, 26441 耶弗, 德国.如果您在 Geocoding API, you'll get the place_id ChIJZfmp_meJtkcR1D7UdD4Sex4. Checking this place_id through a Places Details request, you'll see that this establishment's business_status is CLOSED_PERMANENTLY. Please do note that places tagged as closed permanently/temporarily are not searchable through Places Nearby Search as per this comment on a bug here.

中勾选此项

正如您在 sample Nearby Search request 上注意到的那样,API 只有 returns 个业务状态为“运营”的地点,因此您标记为永久关闭的业务未归还在搜索结果中。

注意:您需要在上面提供的示例请求中添加自己的 API 密钥。

希望对您有所帮助!