开发者

Converting coordinates into map addresses

I am developing a GPS Server and tracking system:

  1. How can I convert latitudes and longitudes data got from a GPS tracking device into address data so that the client application report be displaying road name开发者_JS百科s instead of coordinates?
  2. How can I map the coordinate data so that tracker position be displayed on a map i.e. google maps or vector maps?

I'll highly appreciate your answers or suggestions


  1. Use a reverse geocoder. http://code.google.com/apis/maps/documentation/geocoding/#ReverseGeocoding

  2. Use a mapping API like Google Maps. http://code.google.com/apis/maps/documentation/javascript/


Here you find How to convert GPS coordinates to a full address with php?

And in 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"
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜