Attached is a patch to enable access to UK postcodes in the zipcodes table. It adds code to supported/location.uk.inc and was made against current dev.

It provides the following functions:
location_latlon_rough_uk()
location_get_postalcode_data_uk()

These are modelled on their US equivalents and tested with an experimental argument handler, see #606342: Views Argument Handler for Proximity
Although the UK records in zipcodes table contain no city or state information, the latitude and longitudes are there.

Comments

yesct’s picture

+++ location.uk.inc	4 May 2010 12:10:16 -0000
@@ -268,3 +268,89 @@
+ * Returns a lat/lon pair of the approximate center of the given postal code in the given country

I think some comments are longer than 80 chars.

Powered by Dreditor.

(testing out using Dreditor... sorry about the non useful review. :) still needs to be reviewed more. )

hutch’s picture

All the comments in this patch were copied over verbatim from existing code, in this case location.us.inc

What needs reviewing is the functionality, cleanups later. I usually run the Code review module over my modules just before a stable release, Location needs bugfixes before anything else.

The patch in #578216: proximity filter wont work with german zips, the error is the missing location_latlon_rough_de() may have some bearing on this functionality. If geocode lookups provide better data than currently available in location.uk.inc then that must be considered although there may be performance issues. I shall be looking into this ASAP

It may also be possible to use geocoding to improve the existing zipcodes entries, not sure if the data can be captured in the case of UK. Lots of interesting possibilities.

yesct’s picture

yep. :) I agree.

hutch’s picture

Looks like #662892: (1=0) in query and Reworking of proximity filter handler to automatically geocode zipcodes are working on this already, just found the thread ;-)

yesct’s picture

should we mark this a duplicate and put a link in the other issue to this one (you understand the details better about the two)?

hutch’s picture

They are not so much duplicate as parallel, I'm currently exploring #662892: (1=0) in query and Reworking of proximity filter handler to automatically geocode zipcodes patches in #28, they look promising. Folks want to do proximity searches based on input of city name, that's what I'm trying to pull together in conjunction with other useful ways.

ankur’s picture

Status: Needs review » Closed (fixed)

I guessing this was closed in another ticket. If that is not the case, please feel free to re-open this ticket.

manoloka’s picture

Is this patch still needed nowadays???

Cause I'm having problems with this, all seems to work execpt that the list doesn't actually gets ordered by distance/proximity at all.

If I set a filter everything works as expected but with an argument the order seems random.