Changeset 404


Ignore:
Timestamp:
Dec 3, 2006, 5:47:37 PM (13 years ago)
Author:
Nick Burch
Message:

Update API docs, and an associated tweak to the geocoder

Location:
trunk/npemap.org.uk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/npemap.org.uk/cgi/geocoder.fcgi

    r403 r404  
    9393
    9494        # What postcode were they asking about?
    95         if(defined $cgi->param("postcode")) {
     95        if(defined $cgi->param("postcode") && $cgi->param("postcode")) {
    9696                $limit_results = 1;
    9797                $request{type} = "location";
     
    105105                        next REQUEST;
    106106                }
    107         } elsif(defined $cgi->param("easting") && defined $cgi->param("northing")) {
     107        } elsif(defined $cgi->param("easting") && $cgi->param("easting") &&
     108                defined $cgi->param("northing") && $cgi->param("northing")) {
    108109                $request{type} = "postcode";
    109110                $request{easting} = $cgi->param("easting");
  • trunk/npemap.org.uk/static/api/geocoder.shtml

    r379 r404  
    88<h4>Geocoder</h4>
    99
     10<p>The geocoder supports various methods for turning postcodes into
     11 locations, or locations into postcodes, using our collected data.</p>
     12
     13<h5>Postcode -&gt; Location</h5>
    1014<p>Look up the location that we have for a postcode. If we don't have an exact
    1115match for the postcode you request, then we will do our best. If we don't have
    12 an exact match, we will return #s where we don't have exact matches.
    13 </p>
     16an exact match, we will return #s where we don't have exact matches.</p>
    1417
    15 <p> If you request the response with the format of 'js', then you can specify
     18<h5>Location -&gt; Postcode</h5>
     19<p>Look up the nearest postcode for a location. You can optionally get the
     20 n nearest postcodes to a location.</p>
     21
     22<h5>Location -&gt; Postcode Areas</h5>
     23<p>Look up the nearest postcode area (eg 'OX2') for a location. You can
     24 optionally get the n nearest postcode areas to a location.</p>
     25
     26<h4>Result Formats</h4>
     27<p>The results can be returned as plain text (csv with header), XML, or
     28 javascript / javascript callback.</p>
     29
     30<p>If you request the response with the format of 'js', then you can specify
    1631the name of a funtion call to wrap around the JSON response. This will call
    1732that method with the JSON as a parameter. </p>
     
    2338<h4>Arguments</h4>
    2439<dl>
    25 <dt>postcode (required)</dt>
    26 <dd>The postcode that you wish the location of. You can enter just the outward part if you wish.</dd>
     40<dt>postcode (required, unless easting and northing given)</dt>
     41<dd>The postcode that you wish the location of. You can enter just the
     42 outward part if you wish.</dd>
     43
     44<dt>easting (required, unless postcode given)</dt>
     45<dd>The easting part of the location, to find nearby postcodes or postcode
     46 areas. If given, 'northing' must also be supplied.</dd>
     47
     48<dt>northing (required, unless postcode given)</dt>
     49<dd>The northing part of the location, to find nearby postcodes or postcode
     50 areas. If given, 'easting' must also be supplied.</dd>
     51
     52<dt>format (optional)</dt>
     53<dd>The format to return the results in. Can be 'text', 'js' or 'xml'. The
     54 default is plain text.</dd>
     55
     56<dt>results (optional)</dt>
     57<dd>The number of results to return. The default is 1. (postcode to location
     58 searching always returns one result).</dd>
     59
     60<dt>areas (optional)</dt>
     61<dd>If searching by easting and northing, should postcodes be returned, or
     62 should postcode areas be returned? The default is to return postcodes.</dd>
    2763
    2864</dl>
     
    4278
    4379<p>
    44 postcode: <input type="text" name="postcode" value="" size="30"> <br/>
     80 postcode: <input type="text" name="postcode" value="" size="30" />
     81 <i>or</i><br/>
     82 easting: <input type="text" name="easting" value="" size="10" /> &nbsp;
     83 northing: <input type="text" name="northing" value="" size="10" />
     84</p>
     85<p>
     86 number of results: <input type="text" name="results" value="1" size="30" />
     87 <br />
     88 format:
     89 <input id="format_text" type="radio" name="format" value="text"> <label for="format_text">Text</label>
     90 <input id="format_js" type="radio" name="format" value="js" checked> <label for="format_js">JS</label>
     91 <input id="format_xml" type="radio" name="format" value="xml"> <label for="format_xml">XML</label>
    4592
    46 format:
    47 <input id="format_text" type="radio" name="format" value="text"> <label for="format_text">Text</label>
    48 <input id="format_js" type="radio" name="format" value="js" checked> <label for="format_js">JS</label>
    49 <input id="format_xml" type="radio" name="format" value="xml"> <label for="format_xml">XML</label
    50 
    51 <input type="submit" value="Go" />
     93 <input type="submit" value="Go" />
    5294</p>
    5395</form>
Note: See TracChangeset for help on using the changeset viewer.