Drivers

tipichris edited this page Sep 14, 2010 · 5 revisions

textfile

The textfile driver stores postcode data in a simple text file. The following parameters are available:

   datafile: location of the datafile
   fieldsep: field separator used in the datafile. Default is "\t" (tab)

Data files should contain three fields, either

postcode    latitude    longitude
or
postcode    eastings    northings

The textfile driver is useful for simple installations requiring data only down to sector level. It is not recommended if you have unit level data, unless it is for a small area only, as there are 1.7 million postcodes in Great Britain

mysql

The mysql driver stores data in a mysql database. Valid parameters are

    host: mysql host to connect to
    user: user name for mysql connection
    pass: password for mysql connection
    db:   database to use
    sql:  the SQL statement to execute. This should take a single substitution,
          %s, which is replaced by the postcode being searched. It should return
          two fields, eastings and northings or latitude and logtitude. Defaults are
          "SELECT lat,long FROM postcodes WHERE postcode = '%s'" for wgs84 and
          "SELECT east,north FROM postcodes WHERE postcode = '%s' for osgb36

uk_postcodes

The uk_postcodes driver uses the API at http://www.uk-postcodes.com to retrieve data. It caches data in a local file to minimize the load on the remote server. Valid parameters are:

    cachefile: path to file for cache. Must be readable and writeable by server
    cachettl:  time to live in seconds for cache entries (default 604800, 1 week)

The uk_postcodes driver only handles full postcodes. Consequently the behaviour of validcode() is slightly different, in that it will not check for matches at sector level or below.

ukgeocode

The ukgeocode driver uses the API at http://maxmanders.co.uk/ukgeocode/ to retrieve data. It caches data in a local file to minimize the load on the remote server. Valid parameters are:

    cachefile: path to file for cache. Must be readable and writeable by server
    cachettl:  time to live in seconds for cache entries (default 604800, 1 week)

The ukgeocode driver only handles full postcodes. Consequently the behaviour of validcode() is slightly different, in that it will not check for matches at sector level or below.

ukgeocode uses wgs84. The driver will set this – there is no need to call use_wgs84

openlylocal

The openlylocal driver uses the API at http://www.openlylocal.com/ to retrieve data. It caches data in a local file to minimize the load on the remote server. Valid parameters are:

    cachefile: path to file for cache. Must be readable and writeable by server
    cachettl:  time to live in seconds for cache entries (default 604800, 1 week)

The openlylocal driver only handles full postcodes. Consequently the behaviour of validcode() is slightly different, in that it will not check for matches at sector level or below.

openlylocal uses wgs84. The driver will set this – there is no need to call use_wgs84

geopostcode

The geopostcode driver uses the API at http://www.geopostcode.org.uk to retrieve data. It caches data in a local file to minimize the load on the remote server.

Valid parameters are:

    cachefile: path to file for cache. Must be readable and writeable by server
    cachettl: time to live in seconds for cache entries (default 604800, 1 week)
Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.