another ValueError: Didn't find exactly one placemark! (Found 0.)

174 views
Skip to first unread message

dbusarow

unread,
Mar 3, 2008, 7:58:45 PM3/3/08
to geopy
Hi, I'm also getting the error message

ValueError: Didn't find exactly one placemark! (Found 0.)

like a previous post but in my case it does not seem to be a bad
address format causing the problem.

Here's what I have

from geopy import geocoders
g = geocoders.Google('My API Key')
# I've tried this with the non-API key version too, no difference
place, (lat, lng) = g.geocode('1091 chamberlain drive, gravenhurst p1p
1a2, canada')
Traceback (most recent call last):
...
ValueError: Didn't find exactly one placemark! (Found 0.)

Entering the same address at Google does work although it changes
"drive" to "dr". Making the same change in the geocoder call does not
help.

Any ideas??

Thanks,
Dan


Hajo Smulders

unread,
Mar 3, 2008, 9:00:03 PM3/3/08
to ge...@googlegroups.com
This is a google error.
Pass along the parameter: exactly_one=False
as in:
place, (lat, lng) = g.geocode('1091 chamberlain drive, gravenhurst p1p
1a2, canada', exactly_one=False)

Hajo

(This is the example from the documentation:
See: http://exogen.case.edu/projects/geopy/
  1. >>> for place, (lat, lng) in g.geocode('1296 Magnolia Dr in Cleveland',  
  2. ...                                    exactly_one=False):  
  3. ...     print "%s: %.5f, %.5f" % (place, lat, lng)  
  4. 1670 Magnolia Dr, Cleveland, OH 44106, USA: 41.51211, -81.60704  
  5. 199 Magnolia Dr, Cleveland, OH 44110, USA: 41.58104, -81.56251 
--
--------------------------------------------------------------------------------------------------
There is a tragic flaw in our precious Constitution, and I don't know what can be done to fix it. This is it: Only nut cases want to be president.
 - Kurt Vonnegut

dbusarow

unread,
Mar 4, 2008, 12:39:25 PM3/4/08
to geopy


On Mar 3, 7:00 pm, "Hajo Smulders" <hajosmuld...@gmail.com> wrote:
> This is a google error.
> Pass along the parameter: exactly_one=False
> as in:
> place, (lat, lng) = g.geocode('1091 chamberlain drive, gravenhurst p1p
> 1a2, canada', exactly_one=False)
>
> Hajo

Hajo,

You are correct of course. I mis-stated my problem. It's not the
ValueError being raised that I was trying to fix, it's the fact that
using the address shown I get back 0 results.

If I go to Google and enter the same address manually it works fine.

I'm looking for suggestions on what I can do to coax a lat/lon out of
Google/geopy for that address.

Thanks!

Dan

Hajo Smulders

unread,
Mar 4, 2008, 2:03:20 PM3/4/08
to ge...@googlegroups.com
Have you tried to "scrape" google method (ie: the one where you don't use a google key; but it scrapes the google mapping page? The google mapping page is more up to date that the data you access by key. Sometimes significantly so. I work for a pretty big company and although we all have API keys we use the scrape method a lot.

Hajo

dbusarow

unread,
Mar 5, 2008, 12:51:45 PM3/5/08
to geopy


On Mar 4, 12:03 pm, "Hajo Smulders" <hajosmuld...@gmail.com> wrote:
> Have you tried to "scrape" google method (ie: the one where you don't use a
> google key; but it scrapes the google mapping page? The google mapping page
> is more up to date that the data you access by key. Sometimes significantly
> so. I work for a pretty big company and although we all have API keys we use
> the scrape method a lot.
>

OK, I guess I'll give that a try.

Thanks for your help.

Dan
Reply all
Reply to author
Forward
0 new messages