Google 根据没有地图的坐标提供地点建议
Google Places suggestions based on coordinates without map
看到一些相关的回答,不确定是否仍然有效(2014):
Get Google Place Details Without Map
需要使用指定坐标和半径的nearbySearch()
但不显示和映射,只需获取JSON数据并使用它。
甚至 Docs 也展示了使用 map 来初始化服务 :
map = new google.maps.Map(document.getElementById('map'), {
center: pyrmont,
zoom: 15
});
service = new google.maps.places.PlacesService(map);
service.nearbySearch(request, callback);
}
关于如何在没有地图的情况下将其作为适用于当前条款的更新解决方案的任何建议?
有两种方法可以使用 nearbySearch of the Places API。第一个(您当前正在使用的那个)是地图 Javascript API 的一部分的 Places 库。另一个是Web Service,就是你要找的:
https://developers.google.com/maps/documentation/places/web-service/search-nearby
您将选项(半径、坐标、json)设置为 URL 中的查询参数,它将 return 数据作为 JSON。您可以使用 .fetch 或 axios 之类的东西来发送请求。
看到一些相关的回答,不确定是否仍然有效(2014):
Get Google Place Details Without Map
需要使用指定坐标和半径的nearbySearch()
但不显示和映射,只需获取JSON数据并使用它。
甚至 Docs 也展示了使用 map 来初始化服务 :
map = new google.maps.Map(document.getElementById('map'), {
center: pyrmont,
zoom: 15
});
service = new google.maps.places.PlacesService(map);
service.nearbySearch(request, callback);
}
关于如何在没有地图的情况下将其作为适用于当前条款的更新解决方案的任何建议?
有两种方法可以使用 nearbySearch of the Places API。第一个(您当前正在使用的那个)是地图 Javascript API 的一部分的 Places 库。另一个是Web Service,就是你要找的:
https://developers.google.com/maps/documentation/places/web-service/search-nearby
您将选项(半径、坐标、json)设置为 URL 中的查询参数,它将 return 数据作为 JSON。您可以使用 .fetch 或 axios 之类的东西来发送请求。