Opened 9 years ago

Closed 9 years ago

#21 closed defect (fixed)

local search from modRana not working in Australia

Reported by: Martin Kolman Owned by: Martin Kolman
Priority: major Milestone:
Component: gps Version:
Keywords: Cc:

Description

local search from modRana not working in Australia

  • using the same query from maps.google.com works
  • is the local search API broken ?
  • is the - in coordinates causing problems ?

Attachments (2)

mod_search.patch (501 bytes) - added by nyall@… 9 years ago.
Patch for mod_search.py
mod_searchv2.patch (124 bytes) - added by nyall@… 9 years ago.
Better patch

Download all attachments as: .zip

Change History (8)

comment:1 Changed 9 years ago by Martin Kolman

Status: newassigned

comment:2 Changed 9 years ago by nyall@…

I'd like to have a go fixing this, but I'm unfamiliar with the modrana code. Can you give me some pointers of places to start tracking this one down?

Cheers!

comment:3 Changed 9 years ago by nyall@…

Actually I've tracked this down. The google API does not like negative latitudes (although it's fine with negative longitudes!). Solution is to convert coordinates from -11.11111, 11.1111 to 11.1111S, 11.1111E type format. Here's a patch for mod_search.py which does that:

187c187,198 < sufix = " near %f,%f" % (lat,lon) ---

# Google api does not like negative latitudes, so convert numeric lat/long to # xxxxxN, xxxxxE type format instead if lat < 0:

latstring = str(-lat) + "S"

else :

latstring = str(lat) + "N"

if lon < 0:

lonstring = str(-lon) + "W"

else :

lonstring = str(lon) + "E"

sufix = " near %s,%s" % (latstring,lonstring)

Changed 9 years ago by nyall@…

Attachment: mod_search.patch added

Patch for mod_search.py

Changed 9 years ago by nyall@…

Attachment: mod_searchv2.patch added

Better patch

comment:4 Changed 9 years ago by nyall@…

I've just attached version 2 of the patch - this one returns to using a similiar method as was originally used, but instead of using "xxx near lat, long", the query is changed to "xxx loc:lat,long". This works reliably for australia, and works in more cases then the original patch.

comment:5 Changed 9 years ago by Martin Kolman

Thanks for the patches ! I have just integrated the V2 one, and a quick search for pizza in the Melbourne area is finally returning some results :)

BTW, sorry for not responding to your comments earlier. I unfortunately don't yet have a new comment notification in this bugtracker, but it should working soon.

comment:6 Changed 9 years ago by Martin Kolman

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.