Bugs: Browse | Submit New | Admin

[#10822] LocalSearchMap giving strange results

Date:
2007-05-14 12:24
Priority:
3
Submitted By:
Tom Taylor (tomtaylor)
Assigned To:
Brandon Keepers (brandon)
Category:
geocoders
State:
Open
Summary:
LocalSearchMap giving strange results

Detailed description
I'm getting some strange results back from LocalSearchMaps when doing a UK lookup. Please let me know if you'd like
more detail.

This works fine when looking up directly through:

http://geo.localsearchmaps.com/?street=48+Leicester+Square&city=London&country=UK

irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require 'graticule'
=> true
irb(main):003:0> g = Graticule.service(:local_search_maps).new
=> #<Graticule::Geocoder::LocalSearchMaps:0xb76e4b70 @url=#<URI::HTTP:0xfdbb72478
URL:http://geo.localsearchmaps.com/>>
irb(main):004:0> location = g.locate :street => '48 Leicester Square', :locality => 'London', :country =>
'UK'
=> #<Graticule::Location:0xb76d97c0 @longitude=-81.3382, @latitude=38.3623, @precision=:unknown>
irb(main):005:0> location.coordinates
=> [38.3623, -81.3382]

And also a bug when doing a postcode/zip lookup. It works fine when looking up directly through:

http://geo.localsearchmaps.com/?zip=W1A%201AA&country=UK

irb(main):006:0> location = g.locate :zip => 'W1A 1AA', :country => 'UK'
NoMethodError: undefined method `[]' for nil:NilClass
        from /usr/lib/ruby/gems/1.8/gems/graticule-0.2.3/lib/graticule/geocoder/local_search_maps.rb:38:in
`parse_response'
        from /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/core_ext/object/misc.rb:23:in
`returning'
        from /usr/lib/ruby/gems/1.8/gems/graticule-0.2.3/lib/graticule/geocoder/local_search_maps.rb:36:in
`parse_response'
        from /usr/lib/ruby/gems/1.8/gems/graticule-0.2.3/lib/graticule/geocoder/base.rb:81:in `get'
        from /usr/lib/ruby/gems/1.8/gems/graticule-0.2.3/lib/graticule/geocoder/local_search_maps.rb:17:in `locate'
        from (irb):6

Add A Comment: Notepad

Please login


Followup

Message
Date: 2007-05-15 15:04
Sender: Tom Taylor

I've just updated the patch to remove blank parameters from
the URL.
Date: 2007-05-15 14:57
Sender: Tom Taylor

Hi Brandon,

I've attached a patch for this problem. Because the tests
aren't live there's little point in testing for it.

Cheers,

Tom
Date: 2007-05-15 14:45
Sender: Brandon Keepers

Tom,

Thanks for looking into this. The SVN repository is available
at http://source.collectiveidea.com/public/geocode/trunk/.  Have
at it!

Brandon
Date: 2007-05-15 14:37
Sender: Tom Taylor

OK, it seems there are two separate problems here.

First, the problem with the strange long/lat return seems to
be with the generation of the URL that Graticule is pulling
the results from. By sniffing with Wireshark, it seems that
it's not including the country parameter.

Second, using :zip is the wrong parameter - my bad. It
should be :postal_code. This changed in 0.2.0. Might be
worth raising an error on an unrecognised hash parameter?

I'd like to submit a patch for these things. How can I do
it? Can I check the code out of the repository at all? Thanks!

Attached Files:

Name Description Download
patch.txt Patch for missing country param Download
patch2.txt Updated patch, which tidies the URL up a bit by removing blank parameters Download

Changes:

Field Old Value Date By
File Added1995: patch2.txt2007-05-15 15:04tomtaylor
File Added1993: patch.txt2007-05-15 14:56tomtaylor