module Coordconver::Geo::Gaode

Public Instance Methods

geo(address) click to toggle source

Coordconver::Gaode.geo(“北京市朝阳区阜通东大街6号”) 116.480881,39.989410–>北京市朝阳区阜通东大街6号

# File lib/coordconver/geo/gaode.rb, line 20
def geo(address)
  url = geo_url

  params = {
    key: gaode_map_key,
    address: address
  }

  Utils::Request.get(url, params: params)
end
regeo(lng, lat) click to toggle source

Coordconver::Gaode.regeo(116.480881,39.989410) 116.480881,39.989410–>北京市朝阳区阜通东大街6号

# File lib/coordconver/geo/gaode.rb, line 8
def regeo(lng, lat)
  url = regeo_url(lng, lat)
  # params = {
  #   key: gaode_map_key,
  #   location: lng + "," + lat
  # }

  Utils::Request.get(url, params: nil)
end

Private Instance Methods

base_url() click to toggle source
# File lib/coordconver/geo/gaode.rb, line 41
def base_url
  Configuration.settings[:gaode_base_url]
end
gaode_map_key() click to toggle source
# File lib/coordconver/geo/gaode.rb, line 45
def gaode_map_key
  Configuration.settings[:gaode_map_keys].sample
end
geo_url() click to toggle source
# File lib/coordconver/geo/gaode.rb, line 37
def geo_url
  base_url + '/geo'
end
regeo_url(lng, lat) click to toggle source
# File lib/coordconver/geo/gaode.rb, line 33
def regeo_url(lng, lat)
  base_url + '/regeo' + "?key=#{gaode_map_key}&location=#{lng},#{lat}"
end