Does Ruby Geocoder work with PO Box addresses?

41 Views Asked by At

I have been attempting to use the Ruby Geocoder gem on a static database (breweries, in this case) from a csv file. I have seeded the database, and have my latitude and longitude columns.

In the rails console, I have inputted this:

results = Geocoder.search("PO Box 4653, Stockton, California, 95204")
 => []

And it spits out an empty array, as you can see.

When I type in any other address, it works just fine.

3.1.2 :014 > results = Geocoder.search("102 S. State St., Ukiah, California, 95482")
3.1.2 :015 >   
 => 
[#<Geocoder::Result::Nominatim:0x000000010bfa70b0                                                              
...                                                                                                            
[3.1.2 :016 > results
 => 
[#<Geocoder::Result::Nominatim:0x000000010bfa70b0                                                              
  @cache_hit=nil,                                                               
  @data=                                                                        
   {"place_id"=>336152067,                                             
    "licence"=>"Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright",
    "osm_type"=>"way",                                                 
    "osm_id"=>26278364,                                                
    "boundingbox"=>["39.149863755102", "39.149963755102", "-123.20748084694", "-123.20738084694"],
    "lat"=>"39.14991375510204",                                        
    "lon"=>"-123.20743084693878",     
    "display_name"=>                  
     "102, South State Street, Downtown, Ukiah, Mendocino County, CAL Fire Northern Region, California, 95482, United States",
    "class"=>"place",                 
    "type"=>"house",                  
    "importance"=>-0.41000000000000003,
    "address"=>
     {"house_number"=>"102",
      "road"=>"South State Street",
      "neighbourhood"=>"Downtown",
      "town"=>"Ukiah",
      "county"=>"Mendocino County",
      "state_district"=>"CAL Fire Northern Region",
      "state"=>"California",
      "ISO3166-2-lvl4"=>"US-CA",
      "postcode"=>"95482",
      "country"=>"United States",
      "country_code"=>"us"}}>] 

Any ideas on if it just a PO box address issue and I just have to accept that?

0

There are 0 best solutions below