Simply Postcode Software “PostZon” Geographic Data:
“PostZon” data, or geographic data, primarily provides postcode to Longitude and Latitude conversion. This conversation can be used to calculate the straight line distance between two postcodes, which is provided in all of our API offerings.
This data can be taken to the next level to provide a “Nearest Store/Service” locator for a web site. This provides your customers a means of finding their nearest store, given their home postcode. More information about “Nearest Store/Service” locator.
PostZon Data Uses/Features:
Data returned
This is specialised data such as OS reference, Longitude, Latitude, NHS District , Health Authority codes, Local Authority Electoral Ward codes. The PostZon data has been consolidated from various sources, such as Ordinate Services, NHS, etc. The most useful information is Longitude and Latitude.
Note: Some Postcodes return no PostZon Data, such as PO
Boxes. It is a good idea to test any bespoke program against
such postcodes. Examples are AB10 1BH, AB10 1DQ, AB10 1DU,
AB10 1EP.
Distance between two postcodes
The distance between two postcodes can be returned. Simply call with Postcode and “Home postcode” provided in the parameters. Our service will then return the distance in km. So approximate charges could be applied to a customer based on the straight line distance.
Postcode to Longitude/Latitude
This is the main use of PostZon data. Simply call with the target Postcode and the PostZon data service will return the Longitude and Latitude. Ideal for mapping and calculating distances.
Longitude/Latitude to Postcode
To get the PostZon record by Longtitude/Latitude, (closest within 10Km) set postcode to the "Longtitude|Latitude" (separated by |). The Postcode found will be returned in pz_postcode.
Town to Longitude/Latitude
To get the Longitude and Latitude of a Town, simply provide the Town name + “,SPACE“ + County in the postcode field. The Longitude and Latitude will then be returned. It is suggested that the town list in displayed using a AJAX search box.
Using the "Postzon" Geographical Data
The "Postzon" Geographical Data is accessed by one of our extensive API’s. Simply click on the link below, and expand the appropriate API section. All "Postzon" Geographical Data is list under each API interface.
Data Returned by “Postzon” Geographical Data
This type of license returns:
| Fieldname | Description |
|---|---|
| postcode | Postcode in the PostZon record |
| latitude_wgs84 | Latitude. This equals zero if not co-ordinates are available, see extra notes below |
| longitude_wgs84 | Longitude |
| geodistancetohomepostcode | Distance from
HOME postcode in Kilometres -1 = Error |
| introductiondate | Date introduced to file |
| gridrefeast | Ordnance Survey 100m Easting and Northing measurements that refer to the distance east and north from a fixed point just South West of the Isles of Scilly. They indicate the mean centre point of a Postcode to 100m. |
| gridrefnorth | Ordnance Survey 100m Easting and Northing measurements that refer to the distance east and north from a fixed point just South West of the Isles of Scilly. They indicate the mean centre point of a Postcode to 100m. |
| county | Administrative
and Local Health Authority codes used by the office
of national statistics (2 Digits) Description is after the "," |
| district | Administrative
and Local Health Authority codes used by the office
of national statistics (2 Digits) Description is after the "," |
| ward | Local
Authority Ward Codes in England and Wales are
comprised of six characters - the first two digits
represent the county, the next two alphabetic
characters identify the Local Authority and the last
two characters represent the electoral ward of the
Postcode. Unitary Authorities in England, Wales and
Scotland are four-character fields represented by
the Local Authority and the Ward. In Northern
Ireland, the 6 characters are made up of 95 plus a
letter from A - Z followed by a space and the
electoral Ward. Description is after the "," |
| usertype | 0=Small User, 1=Large UserDescription is after the "," |
| gridstatus | Status of grid
co-ordinates. Latitude is aero if no grid
co-ordinates are available, see extra notes below. Description is after the "," |
| country | 064="England" 220="Wales" 179="Scotland" 152="Northern Ireland" 044="Channel Islands" 128="Isle of Man"Description is after the "," |
| wardstatus | Description is after the "," |
| nhs_code | A three
character code which identifies the Health Authority
or board responsible for funding patient care within
each Postcode. Description is after the "," |
| nhs_region | NHS Codes Description is after the "," |
| osreference | OS Reference. e.g PE132QL ="TF4630009100" This is our national coordinate system for topographic mapping. It is used for Ordnance Survey mapping at all scales, and for many private topographic surveys. The OSGB36 part of the name refers to the geodetic datum (system of latitude and longitude) used, and the National Grid part refers to the map projection and grid referencing convention for eastings and northings |
| wardstatus | |
| mailsort | Is a unique 5-digit numeric codes used internally by Royal Mail to route mailbags. They are also used by external customers with Mailsort contracts, which is why they are present in the data. |
The fields of main interest are:
Easting and Northings, the OS easting of the outcode, distance in metres due east from the south west of the UK.
Longitude and Latitude, using the WGS84 geodetic datum, used for mapping, and calculating distance between two postcodes
OS reference, OS representation of the location
Postcode, returned when searching by OS Ref, or Longitude/Latitude
This data is available through our programming interfaces
only, and can be retrieved by Postcode, OS Ref, or
Longitude/Latitude. These interfaces also contain functions
for working out the distance between two postcodes.
Postcodes, which relate to PO Boxes, are not included in
this file, because they DO NOT have a location.
The accuracy of the Longitude/Latitude varies. Can be
between 10-150 m
Get PostZon Data from SOAP Web Service:
To get a "Postzon" Geographical Data address from our SOAP Web Service we do the following:
The following example calls our server to retrieve the PostZon address data for a given postcode, OSRef, Longitude/Latitude or Town. It also returns the Distance in Km between two postcodes if HomePostcode is set.
Step 1 Add SOAP reference to you project
The following web references give access to our SOAP web service
.NET Web Reference
http://www.SimplyLookupadmin.co.uk/WebService.asmx
WSDL Web Reference
http://www.SimplyLookupadmin.co.uk/WebService.asmx?WSDL
You should add this SOAP reference to your project.
Step 2 Call SOAP Web Service to get PostZon Data
The following code will call the SOAP Web Service to return "Postzon" Geographical Data for a given postcode.
|
|
| Dim HomePostcode as string
="PE132QL" Dim PostcodeToGet as string = "PE132XQ" Dim PostcodeSearch As New PostcodeWebService.WebService Dim Address As PL_AddressRecord 'Ask for Address by ID Address = PostcodeSearch.SearchForPostZonData(“My DataKey”, “TestComputer", "UK", PostcodeToGet, HomePostcode) If Address.AddressRecordGotWithoutError Then 'Display results If Address.ErrorMessage <> "" Then MsgBox(Address.ErrorMessage) 'Process the Address to text field Dim AddressText As String With Address AddressText + = "Longitude:" & .longitude_WGS84 & vbCrLf AddressText + = "Latitude:" & .latitude_WGS84 & vbCrLf AddressText + = "Distance Km:" & .GeoDistanceToHomePostcode & vbCrLf End With Me.TxtAddress.Text = AddressText Else 'Display error (Account stuff mostly, i.e. No License) MsgBox(Address.ErrorMessage) End If |
|
|
| uk.co.simplylookupadmin.www.WebService
PostcodeSearch = new
uk.co.simplylookupadmin.www.WebService(); uk.co.simplylookupadmin.www.PL_AddressRecord AddressesDataReturned = new uk.co.simplylookupadmin.www.PL_AddressRecord(); string datakey = Request.QueryString["datakey"].ToString(); string postcode = Request.QueryString["postcode"].ToString(); string userid = Request.QueryString["userid"].ToString(); string homepostcode = Request.QueryString["homepostcode"].ToString(); //Please note: Section 3.5 of the terms and conditions state: "The Customer, when using the Postcode Lookup service via Web Service, must make sure each user is identified by a unique computer name, in each call to the Web Service." In simple language this means that each user must be identified by a unique username. //If the postcode address search is for External use then SET ComputerName = "" //Do Search, on Postcode or two or more address fields AddressesDataReturned = PostcodeSearch.SearchForPostZonData(datakey, userid, "UK", postcode, homepostcode); if (AddressesDataReturned.AddressRecordGotWithoutError == true) { //Display results, no major error this.TxtResults.Text = AddressesDataReturned.ErrorMessage; string AddressText; AddressText = "Status:" + AddressesDataReturned.CreditsStatusText + "\n" + "\n"; AddressText += "MailSort:" + AddressesDataReturned.MailSort + "\n"; AddressText += "longitude_WGS84:" + AddressesDataReturned.longitude_WGS84 + "\n"; AddressText += "latitude_WGS84:" + AddressesDataReturned.latitude_WGS84 + "\n"; AddressText += "UK_os_reference:" + AddressesDataReturned.UK_os_reference + "\n"; AddressText += "UK_OS_grid_east:" + AddressesDataReturned.UK_OS_grid_east + "\n"; AddressText += "UK_OS_grid_north:" + AddressesDataReturned.UK_OS_grid_north + "\n"; AddressText += "UK_NHS_code:" + AddressesDataReturned.UK_NHS_code + "\n"; AddressText += "UK_NHS_region:" + AddressesDataReturned.UK_NHS_region + "\n"; AddressText += "UK_country:" + AddressesDataReturned.UK_country + "\n"; AddressText += "UK_IntroductionDate:" + AddressesDataReturned.UK_IntroductionDate + "\n"; AddressText += "UK_county:" + AddressesDataReturned.UK_county + "\n"; AddressText += "UK_district:" + AddressesDataReturned.UK_district + "\n"; AddressText += "UK_ward:" + AddressesDataReturned.UK_ward + "\n"; AddressText += "UK_wardstatus:" + AddressesDataReturned.UK_wardstatus + "\n"; AddressText += "UK_county:" + AddressesDataReturned.UK_county + "\n"; AddressText += "UK_gridstatus:" + AddressesDataReturned.UK_gridstatus + "\n"; // long Distance = 0; // to do AddressesDataReturned.GeoDistanceToHomePostcode is a string and needs type casting? //If (length(AddressesDataReturned.GeoDistanceToHomePostcode)>0) Then // Distance = (long)(AddressesDataReturned.GeoDistanceToHomePostcode); // AddressText += "Distance:" + Distance + " km " + (long)(Distance / 1.609344) + " miles" + "\n"; this.TxtResults.Text = AddressText; } else { //Display error (Account stuff mostly) this.TxtResults.Text = AddressesDataReturned.ErrorMessage; } |
Where PostcodeSearch is a web reference to: http://www.SimplyLookupadmin.co.uk/WebService.asmx
Get PostZon Data from HTTP/XML Web Service:
To get a "Postzon" Geographical Data address from our HTTP/XML Web Service we do the following:
Call XMLService/XMLSearchForPostZonData.aspx to get PostZon record
This call will retrieve the PostZon Data for a given Postcode, OSRef, Longtitude/Latitude or by Town. This PostZon data is collected from many different source by the Royal mail. The most useful information is Distance from Home Postcode, Longitude and Latitude.
Example:
Call HTTP web service with your data key, which is e-mail to you when you open an account, and postcode.
www.simplylookupadmin.co.uk/XMLservice/XMLSearchForPostZonData.aspx?datakey=Your
Data key
&postcode=pe132ql&version=1&homepostcode=BS20
6EL
|
|
<?xml version="1.0" ?> <data> <confirm>Yes</confirm> <demoon>0</demoon> <credits_display_text>Evaluation expires 10 May 2011</credits_display_text> <credits_display_color>0</credits_display_color> <credits_display_size>12</credits_display_size> <credits_display_bold>0</credits_display_bold> <credits_display_showbutton>1</credits_display_showbutton> <co_customerchargeoption>0</co_customerchargeoption> <accountadminpage>https://www.simplylookupadmin.co.uk/WebAccountLogin.aspx? doid=1&amp;coid=3333305462&amp;Pay=yes</accountadminpage> <record> <pz_introductiondate>19880254</pz_introductiondate> <pz_gridrefeast>54630</pz_gridrefeast> <pz_gridrefnorth>30910</pz_gridrefnorth> <pz_county>12,Cambridgeshire</pz_county> <pz_district>UD,Fenland District</pz_district> <pz_ward>GT,Medworth Ward</pz_ward> <pz_usertype>0,Small User</pz_usertype> <pz_gridstatus>1,Within building</pz_gridstatus> <pz_country>064,England</pz_country> <pz_wardstatus>1</pz_wardstatus> <pz_nhs_code>Q35,East of England</pz_nhs_code> <pz_nhs_region>Y51,</pz_nhs_region> <pz_latitude_wgs84>52.659857</pz_latitude_wgs84> <pz_longitude_wgs84>0.1617</pz_longitude_wgs84> <pz_osreference>TF4630009100</pz_osreference> <pz_geodistancetohomepostcode>239</pz_geodistancetohomepostcode> <pz_postcode>PE132QL</pz_postcode> </record> </data> |
If address returned then <found>=1, else <found>=0,error in <errormessage>
Note: The <pz_geodistancetohomepostcode>
contains the distance between:
- &postcode=PE132QL
- &homepostcode=BS20 6EL
Expressed in the parameters. If the optional &homepostcode parameter is omitted then this will be 0.
Get PostZon Data from JSON Web Service:
To get a "Postzon" Geographical Data, including the distance between two postcodes, from our JSON Web Service we do the following:
Call JSONService/JSONSearchForPostZonData.aspx to get PostZon record
This call will retrieve the PostZon Data for a given Postcode, OSRef, Longtitude/Latitude or by Town. This PostZon data is collected from many different source by the Royal mail. The most useful information is Distance from Home Postcode, Longitude and Latitude.
Example:
Call JSON web service with your data key, which is e-mail to you when you open an account, and postcode.
www.simplylookupadmin.co.uk/JSONservice/JSONSearchForPostZonData.aspx?datakey=Your Data Key&postcode=pe132ql&homepostcode=BS20 6EL
|
|
{ "found":"1", "credits_display_text":"Evaluation expires 31 Mar 2011", "accountadminpage":"https://www.simplylookupadmin.co.uk/WebAccountLogin.aspx? doid=1&coid=3333366462&Pay=yes", "errormessage":"", "pz_introductiondate":"19880254", "pz_gridrefeast":"54630", "pz_gridrefnorth":"30910", "pz_county":"12,Cambridgeshire", "pz_district":"UD,Fenland District", "pz_ward":"GT,Medworth Ward", "pz_usertype":"0,Small User", "pz_gridstatus":"1,Within building", "pz_country":"064,England", "pz_wardstatus":"1", "pz_nhs_code":"Q35,East of England", "pz_nhs_region":"Y51,", "pz_latitude_wgs84":"52.659857", "pz_longitude_wgs84":"0.1617", "pz_osreference":"TF4630009100", "pz_geodistancetohomepostcode":"239", "pz_postcode":"PE132QL" } |
If address returned then <found>=1, else <found>=0,error in <errormessage>
Note: The pz_geodistancetohomepostcode
element contains the distance between:
- &postcode=PE132QL
- &homepostcode=BS20 6EL
Expressed in the parameters. If the optional &homepostcode parameter is omitted then this will be 0.
Getting PostZon Data using the .Net Assembly User Interface
Simply call GetPostZonAddressRecord (Postcode) as Boolean
This call will retrieve the PostZon Data for a given Postcode, OSRef, Longitude/Latitude or "Town, County". This PostZon data is collected from many different source by the Royal mail. The most useful information is Distance from Home Postcode (in Kilometers), Longitude and Latitude.
This call can be used with Local Data or Internet based
data.
To get the PostZon record by OSRef, simply set postcode to the OSRef, when calling GetPostZonData.
To get the PostZon record by Longtitude/Latitude,
(closest within 10Km) set postcode to the "Longtitude|Latitude"
(separated by |).
Postcode Lookup Example:
This code will get PostZon data from our database:
|
|
| 'Set Data key, to identify your
account SimplyPostCodeLookup.SetDataKey("Your Date Key") With SimplyPostCodeLookup 'Set optional Home Postcode to get straight line distance .SetHomePostCode(Me.txtHomePostcode.Text) If .GetPostZonAddressRecord(Me.txtPostcode.Text) Then Long = .PostZon_Longitude_wgs84 Lat = .PostZon_Latitude_wgs84 Distance = .PostZon_DistanceToHomePostcode GetLongLat=true Else MsgBox(.General_credits_display_text & vbCrLf & .General_errormessage, vbCritical, "Simply Postcode Lookup") End If Me.Text = "Simply Postcode Lookup : " & .General_credits_display_text End With |
|
|
| //Set Data key, to identify
your account string DataKey; DataKey = "Your Date Key"; SimplyPostCodeLookup.SetDataKey(DataKey); //Set optional Home Postcode to get straight line distance string OptionalHomePostCode =txtHomePostcode.Text; SimplyPostCodeLookup.SetHomePostCode(OptionalHomePostCode); string PostCodeToFind = txtPostcode.Text; if (SimplyPostCodeLookup.GetPostZonAddressRecord(PostCodeToFind) == true) { //Return PostZon data Lat = SimplyPostCodeLookup.PostZon_Latitude_wgs84; Long = SimplyPostCodeLookup.PostZon_Longitude_wgs84; Distance = SimplyPostCodeLookup.PostZon_DistanceToHomePostcode; } else { if (SimplyPostCodeLookup.General_errormessage != "") { MessageBox.Show(SimplyPostCodeLookup.General_credits_display_text + " " + SimplyPostCodeLookup.General_errormessage, "Simply Postcode Lookup"); } else { MessageBox.Show("Not found!"); } } this.Text = "Simply Postcode Lookup : " + SimplyPostCodeLookup.General_credits_display_text; |
To get distance between two points
Simply call:
GetDistance(Latitude1, Longtitude1, Latitude2,
Longtitude2) As Double
For more information, about the .NET Assembly to implement Postcode Finder Software for bespoke desktop software, click on the link below: