【发布时间】:2011-10-11 18:17:05
【问题描述】:
我正在开发一个 GPS 服务器和跟踪系统:
- 如何将从 GPS 跟踪设备获取的纬度和经度数据转换为地址数据,以便客户端应用程序报告显示道路名称而不是坐标?
- 如何映射坐标数据,以便在地图(即谷歌地图或矢量地图)上显示跟踪器位置?
非常感谢您的回答或建议
【问题讨论】:
我正在开发一个 GPS 服务器和跟踪系统:
非常感谢您的回答或建议
【问题讨论】:
使用反向地理编码器。 http://code.google.com/apis/maps/documentation/geocoding/#ReverseGeocoding
使用地图 API,例如 Google 地图。 http://code.google.com/apis/maps/documentation/javascript/
【讨论】:
在这里你可以找到How to convert GPS coordinates to a full address with php?
在 Ruby 中:
require 'curb'
require 'json'
class GpsUtils
GOOGLE_MAP_URL = "http://maps.googleapis.com/maps/api/geocode/json?latlng="
class << self
# Return the address
def convert_from_gps_coordinates_to_address(lat, long)
response = Curl.get(GOOGLE_MAP_URL + lat + "," + long)
json_response = JSON.parse(response.body_str)
# Read the full address (formatted_address) from json_response
json_response["results"].first["formatted_address"]
end
end
end
GpsUtils.convert_from_gps_coordinates_to_address("19.43250", "-99.1330"
【讨论】: