如何使用ruby地理编码器获得多个搜索结果?

时间:2017-01-29 20:26:44

标签: ruby-on-rails ruby google-maps mapbox rails-geocoder

是否有可能使用ruby geocoder gem获得多个搜索结果?例如 - 使用

Geocoder.search("San jose")

我只会看到加利福尼亚州的圣何塞

   {"address_components"=>
     [{"long_name"=>"San Jose", "short_name"=>"San Jose", "types"=>["locality", "political"]},
      {"long_name"=>"Santa Clara County", "short_name"=>"Santa Clara County", "types"=>["administrative_area_level_2", "political"]},
      {"long_name"=>"California", "short_name"=>"CA", "types"=>["administrative_area_level_1", "political"]},
      {"long_name"=>"United States", "short_name"=>"US", "types"=>["country", "political"]}],
    "formatted_address"=>"San Jose, CA, USA",
    "geometry"=>
     {"bounds"=>{"northeast"=>{"lat"=>37.4695381, "lng"=>-121.589154}, "southwest"=>{"lat"=>37.124493, "lng"=>-122.0456719}},
      "location"=>{"lat"=>37.3382082, "lng"=>-121.8863286},
      "location_type"=>"APPROXIMATE",
      "viewport"=>{"northeast"=>{"lat"=>37.4695381, "lng"=>-121.589154}, "southwest"=>{"lat"=>37.124493, "lng"=>-122.0456679}}},
    "place_id"=>"ChIJ9T_5iuTKj4ARe3GfygqMnbk",
    "types"=>["locality", "political"]}>]

但还有其他国家/地区:

enter image description here

我怎样才能得到别人?

0 个答案:

没有答案