使用Google Places API查找最近的道路: [英] Finding nearest road using Google Places API:

查看:52
本文介绍了使用Google Places API查找最近的道路:的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我正在开发的Ruby应用程序中,给定点的纬度和经度,我需要找到到该点最近的道路/高速公路.

In the Ruby application which I'm developing, given latitude and longitude of a point, I need to find the nearest road/highway to the point.

有人可以告诉我如何使用Google Places API进行此操作吗?

Can someone tell me how I can go about this using Google Places API?

我尝试使用'types:"route"'参数给定一定的半径并找到道路,但输出为零结果".

I have tried giving a certain radius and finding the roads using the 'types:"route"' parameter but it gives me "Zero results" as the output.

推荐答案

Google Places API并非旨在返回附近的地理位置,而是旨在返回附近场所的列表,最多可返回两个 locality political 类型的结果可帮助识别您要执行位置搜索请求的区域.

The Google Places API is not designed to return nearby geographical locations, it is designed to return a list of nearby establishments and up to two locality or political type results to to help identify the area you are performing a Place Search request for.

您要的功能可以通过 Google Geocoding API 来实现lat,lng到HTTP反向地理编码请求的 latlng 参数:

The functionality you are requesting would be possible with the Google Geocoding API by passing the lat, lng to the latlng parameter of the HTTP reverse geocoding request:

http://maps.googleapis.com/maps/api/geocode/json?latlng=41.66547000000001,-87.64157&sensor=false

这篇关于使用Google Places API查找最近的道路:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆