【问题标题】:Converting coordinates into map addresses将坐标转换为地图地址
【发布时间】:2011-10-11 18:17:05
【问题描述】:

我正在开发一个 GPS 服务器和跟踪系统:

  1. 如何将从 GPS 跟踪设备获取的纬度和经度数据转换为地址数据,以便客户端应用程序报告显示道路名称而不是坐标?
  2. 如何映射坐标数据,以便在地图(即谷歌地图或矢量地图)上显示跟踪器位置?

非常感谢您的回答或建议

【问题讨论】:

    标签: php gps


    【解决方案1】:

    【讨论】:

    • 谢谢。我会浏览你建议的网络链接。
    • 反向地理编码器根据您的回答工作。然而,一些跟踪设备以不同的格式发送坐标信息,例如0116.8635S、03645.5796E 在以下地理编码器上绘制变得有点困难maps.google.com/maps/… 任何有关如何绘制上述坐标的建议将不胜感激。
    • 您需要将它们从任何格式转换为标准符号。
    • 谢谢 ceejayoz 我按照您的指导得到了解决方案。设备的经纬度采用十进制度分钟格式,而地理编码器链接需要十进制度格式。
    【解决方案2】:

    在这里你可以找到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"
    

    【讨论】:

    • @JuanRicardo: Ruby 中的解决方案是你建议的here Juan Ricardo
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-10-31
    • 2021-03-17
    • 2017-07-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多