To get a "Postzon" Geographical Data address from our COM Object we do the following:
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.
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.
Simply use the "Sign Up for Trial" link at top right of this page to open a trial account. We will then send you a data key, which is used to identify your account, when using the following service.
The COM Object is for use with any COM compliant language. You have two choices to install the object on the target computer:
Simply run InstallSimplyPostcodeCOM.exe or InstallSimplyPostcodeCOM.msi from the root of our api example code as admin. This will install and enable the COM object without any user input.
InstallSimplyPostcodeCOM.exe
InstallSimplyPostcodeCOM.msi
If you wish to use from 64bit applications. You need to run Simply_COM_Obj_64Bits_register_fix.exe, as admin, which alters the registry to enable 64bit applications to use the 32bit COM object.
Simply_COM_Obj_64Bits_register_fix.exe
The Postcode Software COM Object is in the “COM Object\COM Object Files” directory of our api example code:
* = Needs to be registered as a COM object by install routine.
Add a COM Reference to our COM object, “ISimplyPostCodeCOMClass”SimplyPostCodeLookup.dll, within your programming language.
VB.NET Dim SimplyPostCodeLookup As New SimplyPostCode
Dim SimplyPostCodeLookup As New SimplyPostCode
GetPostZonAddressRecord
Simply call GetPostZonAddressRecord (Postcode) as Boolean
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 |).
This code will get PostZon data from our database:
VB 6 '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) If .GetPostZonAddressRecord(Me.txtPostcode) 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 SimplyPostCodeLookup.SetDataKey("Your Date Key") With SimplyPostCodeLookup 'Set optional Home Postcode to get straight line distance .SetHomePostCode(Me.txtHomePostcode) If .GetPostZonAddressRecord(Me.txtPostcode) 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
VB.NET '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 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
C# .NET //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;
//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;
Simply call:
GetDistance(Latitude1, Longtitude1, Latitude2, Longtitude2) As Double
Final step is to test, to enable easy testing please use our special test postcodes.
Simply download the example code. The code is in the "COM Object/C++ COM Object","COM Object/MS Access 2000 onwards","COM Object/MS Excel using COM", "COM Object/VB6 COM Example","COM Object/VBNET COM 2005" directory of our example downloads.
You must run InstallSimplyPostcodeCOM.EXE included in the above download.
These examples demonstrate postcode lookup software using PostZon data.
The above function returns the distance between two Postcodes, but we offer the following function to allow you to workout the distance between two address, given the Longitude, Latitude
Returns in Kilometers as a double This function can be used if you want to workout the nearest store address to as customers entry, since the Longitude and Latitude can be stored for all of your stores. Then simply call this and sort to get the nearest store.
This type of license returns: (see example below)
Public PostZon_IntroductionDate As String Public PostZon_Gridrefeast As String Public PostZon_Gridrefnorth As String Public PostZon_County As String Public PostZon_District As String Public PostZon_Ward As String Public PostZon_Usertype As String Public PostZon_Gridstatus As String (accuracy of the geographic data) Public PostZon_Country As String Public PostZon_Wardstatus As String Public PostZon_NHS_code As String Public PostZon_NHS_region As String Public PostZon_Latitude_wgs84 As String Public PostZon_Longitude_wgs84 As String Public PostZon_OSreference As String 'This is not supported at present but may be in future Public PostZon_DistanceToHomePostcode As String 'Distance from Home Postcode
More infromation on Geographic data returned