require 'geocoder/us' fails

83 views
Skip to first unread message

John L. Poole

unread,
Mar 22, 2010, 2:06:56 AM3/22/10
to GeoCommons Geocoder
I successfully installed:
hermes geocoder # make install
make -C src install
make[1]: Entering directory `/var/work/geocoder/src'
make -C libsqlite3_geocoder
make[2]: Entering directory `/var/work/geocoder/src/
libsqlite3_geocoder'
Makefile:21: warning: overriding commands for target
`libsqlite3_geocoder.so'
Makefile:11: warning: ignoring old commands for target
`libsqlite3_geocoder.so'
Makefile:32: warning: overriding commands for target `clean'
Makefile:15: warning: ignoring old commands for target `clean'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/var/work/geocoder/src/
libsqlite3_geocoder'
make -C liblwgeom
make[2]: Entering directory `/var/work/geocoder/src/liblwgeom'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/var/work/geocoder/src/liblwgeom'
make -C shp2sqlite
make[2]: Entering directory `/var/work/geocoder/src/shp2sqlite'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/var/work/geocoder/src/shp2sqlite'
cp libsqlite3_geocoder/*.so ../lib/geocoder/us/sqlite3.so
make -C shp2sqlite install
make[2]: Entering directory `/var/work/geocoder/src/shp2sqlite'
make[2]: Leaving directory `/var/work/geocoder/src/shp2sqlite'
make[1]: Leaving directory `/var/work/geocoder/src'
gem build gemspec
WARNING: no rubyforge_project specified
WARNING: description and summary are identical
Successfully built RubyGem
Name: Geocoder-US
Version: 2.0.0
File: Geocoder-US-2.0.0.gem
gem install *.gem
Successfully installed Geocoder-US-2.0.0
1 gem installed
Installing ri documentation for Geocoder-US-2.0.0...
Installing RDoc documentation for Geocoder-US-2.0.0...
hermes geocoder #

then when I tried to load the package following the documentation:

hermes geocoder # irb
irb(main):001:0> require 'geocoder/us'
LoadError: no such file to load -- geocoder/us
from (irb):1:in `require'
from (irb):1
from :0
irb(main):002:0>

I'm familiar with Perl and new to Ruby. I'm obviously not addressing
the package correctly.

Yet:
hermes geocoder # gem specification Geocoder-US
--- !ruby/object:Gem::Specification
name: Geocoder-US
version: !ruby/object:Gem::Version
version: 2.0.0
platform: ruby
authors:
- Schuyler Erle
autorequire:
bindir: bin
cert_chain: []

date: 2010-03-22 00:00:00 +00:00
default_executable:
dependencies: []

description: US address geocoding based on TIGER/Line.
email: geoc...@entropyfree.com
executables: []

extensions: []

extra_rdoc_files:
- README.rdoc
files:
- lib/geocoder/us.rb
- lib/geocoder/us/sqlite3.so
- lib/geocoder/us/database.rb
- lib/geocoder/us/constants.rb
- lib/geocoder/us/address.rb
- lib/geocoder/us/import.rb
- lib/geocoder/us/numbers.rb
- tests/database.rb
- tests/constants.rb
- tests/address.rb
- tests/generate.rb
- tests/run.rb
- tests/benchmark.rb
- tests/numbers.rb
- README.rdoc
has_rdoc: true
homepage: http://geocoder.us/
licenses: []

post_install_message:
rdoc_options: []

require_paths:
- lib
required_ruby_version: !ruby/object:Gem::Requirement
requirements:
- - ">="
- !ruby/object:Gem::Version
version: "0"
version:
required_rubygems_version: !ruby/object:Gem::Requirement
requirements:
- - ">="
- !ruby/object:Gem::Version
version: "0"
version:
requirements: []

rubyforge_project:
rubygems_version: 1.3.5
signing_key:
specification_version: 3
summary: US address geocoding based on TIGER/Line.
test_files:
- tests/run.rb

hermes geocoder #

John L. Poole

unread,
Mar 22, 2010, 3:01:03 AM3/22/10
to GeoCommons Geocoder

On Mar 21, 11:06 pm, "John L. Poole" <jlpool...@gmail.com> wrote:
> I successfully installed:
<snip>

Perl coders beware: ruby does not automatically pick up packages
because you specified them in the file; you
have to load such as "-rubygems". See Chapter 3 of the Ruby Gems
manual.

My error was not running gems. For a script, example:
ruby -rubygems jlpooletest1.rb

I was able to run my test script -- though my output placed a test
address 30 miles out of town.

It would be helpful to have some examples that show a way to get a
higher precision.

Kate Chapman

unread,
Mar 22, 2010, 5:35:54 PM3/22/10
to GeoCommons Geocoder
John,

Can you give me a sample of how you were inputting the address? Was
it as a single string or a hash with the pieces broken out?

-Kate

John L. Poole

unread,
Mar 24, 2010, 11:01:54 AM3/24/10
to GeoCommons Geocoder

On Mar 22, 2:35 pm, Kate Chapman <k8chap...@gmail.com> wrote:
> John,
>
> Can you give me a sample of how you were inputting the address?  Was
> it as a single string or a hash with the pieces broken out?

Here's my ruby script:

require 'text'
require 'geocoder/us'

db = Geocoder::US::Database.new("/var/work/tiger/geocoder.db")
p db.geocode("2133 First Street, Napa, CA")
# try a valid intersection
p db.geocode("First & Jefferson, Napa, CA")
# try an intersection that does not exist
p db.geocode("First & Third, Napa, CA")

here's my output:

hermes geocoder # ruby -rubygems jlpooletest1.rb
zip results 2
[{:city=>"Napa", :precision=>:city, :fips_county=>"06055", :lon=>"-122.311921", :zip=>"94558", :score=>0.506, :lat=>"38.516158", :state=>"CA"}]
zip results 2
zip results 2
[{:city=>"Napa", :precision=>:city, :fips_county=>"06055", :lon=>"-122.311921", :zip=>"94558", :score=>0.752, :lat=>"38.516158", :state=>"CA"}]
zip results 2
zip results 2
[{:city=>"Napa", :precision=>:city, :fips_county=>"06055", :lon=>"-122.311921", :zip=>"94558", :score=>0.75, :lat=>"38.516158", :state=>"CA"}]
hermes geocoder #

Incidentally, using sqlitebrowser, I checked the database and tables
features, features-edge, and range were empty. I'm confident at least
range should have values. So I'm going to start anew and document my
changes and warning error messages. In my hurry to get to the end, I
did not methodically document what I had done to get the end.
Obviously, one of the warnings was a fatal one in terms of the
database not being fully populated.

The project I'm working on that is driving this: being able to insert
two streets and if there is a valid intersection, returning the
coordinates thereof.

<snip>

Reply all
Reply to author
Forward
0 new messages