Ruby的最佳邮政编码插件

Spl*_*lin 14 ruby api zipcode

我需要从邮政编码中找到城市和州.有谁知道我可以用来做这个的好插件/ API?

Jas*_*ble 19

gem install geokit
Run Code Online (Sandbox Code Playgroud)

在IRB:

require 'geokit'
geo = GeoKit::Geocoders::MultiGeocoder.multi_geocoder('90210')
if geo.success
  geo.state # => CA
  geo.city  # => Beverly Hills
end
Run Code Online (Sandbox Code Playgroud)


小智 7

一个更轻量级的选项是Area gem.

require 'area'

'11211'.to_region #=> "Brooklyn, NY"
Run Code Online (Sandbox Code Playgroud)

  • 刚刚实施区域,并得说 - 它非常棒!api比geokit更有感觉. (2认同)