none
Location query geocoding to 'Postcode1' even with the building name/number supplied RRS feed

  • Question

  • I'm working on app that will geocode incoming data (how novel :P).

    I have a set of 50 addresses I'm using for testing and at the moment all of them are geocoded to the 'Postcode1' level even though they are good and well formatted addresses.

    I have tried all 50 but here's a sample of the data which hopefully shows the worst and best (they're post office addresses from the UK that are freely available on the post office websitehttp://www.postoffice.co.uk/branch-finder/).

    Abberley General Stores, Stockton Road, Abberley, Worcester, Worcestershire, WR6 6AR
    Butterfly Lodge, Smithfield Mersea Road,   Abberton, Colchester, Essex, CO5 7LG
    51 Abbots Road, Abbey Hulton,   Stoke-On-Trent, Staffordshire, ST2 8DU
    202 Abbey Lane, Leicester,   Leicestershire, LE4 0DA

    5-9 Abbey Lane, Sheffield, South   Yorkshire, S8 0BJ

    I can understand the 'Abberley General Stores' address resolving to the postcode level as that might not be an official building name, and '5-9 Abbey Lane, Sheffield, South Yorkshire, S8 0BJ' is a range of buildings that again might not be officially named like that.

    However '51 Abbots Road' includes the building number and is formatted as the address would be written on a letter.

    Here is the code I'm using; it's not production quality as I'm still trying to get the bloody thing to work ;)

    	var _geocodeRows = function() {
    		var selectedRowIndexes = _grid.getSelectedRows();
    
    		jQuery.each(selectedRowIndexes, function (index, selectedRowIndex) { 
    			var selectedRow = _gridDataView.getItems()[selectedRowIndex];
    
    			_map.getCredentials(function(credentials) {
    				var query = selectedRow['location'];
    				var callbackName = 'ViewModels.DataRepository.DatasetGeocoder.GeocodeCallback';
    
    				var geocodeUrl = 'http://dev.virtualearth.net/REST/v1/Locations/' + query + '?output=json&jsonp=' + callbackName + '&key=' + credentials;
    				var mapscript = document.createElement('script');
    				mapscript.type = 'text/javascript';
    				mapscript.src = geocodeUrl;
    
    				_mapContainer[0].appendChild(mapscript)
    			});
    		});
    	};

    Hopefully I'm just doing something stupid.

    Am I missing an important parameter to tell the service to resolve to address level?


    • Edited by Andy Jump Monday, August 6, 2012 2:21 PM Fixed spelling
    Monday, August 6, 2012 12:05 PM

Answers

  • If a postal code is in a query in the UK Bing Maps will always match it at the postal code even if there is a street address. The main reason for this is that the postal code information used in Bing Maps comes from the Ordnance Survey and is one of the most accurate data sets for address data in Bing Maps for the UK. If you do the same query above but remove the postal code you should find that it geocodes the street address.

    http://rbrundritt.wordpress.com

    • Marked as answer by Andy Jump Monday, August 13, 2012 10:43 AM
    Saturday, August 11, 2012 2:42 PM

All replies

  • I thought that I might be using the wrong pieces of information to analyse the returned result.

    I took "90 Abbey Wood Road, London, Greater London, SE2 9NN" and "SE2 9NN" and created two query requests with the same URL except for the location being the respective value in each.

    The results I got were (in order):

    {"authenticationResultCode":"ValidCredentials","brandLogoUri":"http:\/\/dev.virtualearth.net\/Branding\/logo_powered_by.png","copyright":"Copyright © 2012 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.","resourceSets":[{"estimatedTotal":1,"resources":[{"__type":"Location:http:\/\/schemas.microsoft.com\/search\/local\/ws\/rest\/v1","bbox":[51.48574528242932,0.1124672227510433,51.493470717570673,0.12900877724895671],"name":"SE2 9NN, London, United Kingdom","point":{"type":"Point","coordinates":[51.489608,0.120738]},"address":{"adminDistrict":"England","countryRegion":"United Kingdom","formattedAddress":"SE2 9NN, London, United Kingdom","locality":"London","postalCode":"SE2 9NN"},"confidence":"High","entityType":"Postcode1","geocodePoints":[{"type":"Point","coordinates":[51.489608,0.120738],"calculationMethod":"Rooftop","usageTypes":["Display"]}],"matchCodes":["Good"]}]}],"statusCode":200,"statusDescription":"OK","traceId":"1027e9235a924454a6af0cca85c7a337|EWRM003322|02.00.149.2500|EWRMSNVM002558, EWRMSNVM002513"}

    and

    {"authenticationResultCode":"ValidCredentials","brandLogoUri":"http:\/\/dev.virtualearth.net\/Branding\/logo_powered_by.png","copyright":"Copyright © 2012 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.","resourceSets":[{"estimatedTotal":1,"resources":[{"__type":"Location:http:\/\/schemas.microsoft.com\/search\/local\/ws\/rest\/v1","bbox":[51.485746047077761,0.11246708072897577,51.493471482219114,0.12900863550427771],"name":"SE2 9NN, London, United Kingdom","point":{"type":"Point","coordinates":[51.489608764648438,0.12073785811662674]},"address":{"adminDistrict":"England","countryRegion":"United Kingdom","formattedAddress":"SE2 9NN, London, United Kingdom","locality":"London","postalCode":"SE2 9NN"},"confidence":"High","entityType":"Postcode1","geocodePoints":[{"type":"Point","coordinates":[51.489608764648438,0.12073785811662674],"calculationMethod":"Rooftop","usageTypes":["Display"]}],"matchCodes":["Good"]}]}],"statusCode":200,"statusDescription":"OK","traceId":"33e64f79b1754eebb3669f6b3eacc0e5|EWRM001665|02.00.149.2500|EWRMSNVM001804, EWRMSNVM003195, EWRMSNVM003194, EWRMSNVM001743, EWRMSNVM001725"}

    I have left these unformatted in this post as I don't want to take up too much vertical space, but locally I formatted them using http://jsonformat.com/ and then threw them in to KDiff.

    The result of the diff was that only the bounding box and points are slightly different, with no other differences.
    The different locations appear to show that bing is geocoding the address to the correct location (i.e. the location of the building and not the postcode), but it gives me no way to tell if it was matched to the postcode or address. Both are returned as "postcode1" meaning I have to trust that the returned result is in fact an address, and not a postcode.

    This would appear to be a bug, or if it’s the intended behaviour then it needs to be documented and explained.

    Does anyone have any further insight in to this?

    Monday, August 6, 2012 2:19 PM
  • If a postal code is in a query in the UK Bing Maps will always match it at the postal code even if there is a street address. The main reason for this is that the postal code information used in Bing Maps comes from the Ordnance Survey and is one of the most accurate data sets for address data in Bing Maps for the UK. If you do the same query above but remove the postal code you should find that it geocodes the street address.

    http://rbrundritt.wordpress.com

    • Marked as answer by Andy Jump Monday, August 13, 2012 10:43 AM
    Saturday, August 11, 2012 2:42 PM
  • Thanks for the response Ricky.

    I gave removing the postcode a try and the results were encouraging.

    Query Entity Type Confidence Latitude Longitude
    21 High Street, Abercarn, Newport, Gwent,   NP11 5GQ Postcode1 High 51.649079 -3.135495
    21 High Street, Abercarn, Newport, Gwent Address High 51.64855637 -3.13506195
    NP11 5GQ Postcode1 High 51.64907837

    -3.1354951

    So, I can take the address, strip out the postcode, make a query, see if it's any good and if not then try with the postcode instead.

    It's a bit clunky but it'll work and that's good!

    (It's interesting but irrelevant that that the coordinates for an address with postcode and a postcode only are very close but not quite the same, especially as the rounding doesn't appear consistent. The longitude rounded down from 0.1 but the latitude rounded up from 0.37.)

    ------------------------------------------------------------

    'The main reason for this is that the postal code information used in Bing Maps comes from the Ordnance Survey and is one of the most accurate data sets for address data in Bing Maps for the UK' 

    Couldn't afford address point? :P

    It's a bit odd having to remove a part of the address that should make the matching easier, to get a higher quality result.

    It's also a bit odd having to make the client (potentially) send two requests, one being a subset of the other, to gain the required information. Especially when the service already supports returning multiple results and would do so for 'New York' as shown in the link below.

    http://msdn.microsoft.com/en-us/library/hh674188.aspx



    • Edited by Andy Jump Monday, August 13, 2012 12:47 PM Removed odd <o:p> tags
    Monday, August 13, 2012 10:43 AM