Question

We operate a route optimisation service, these routes typically involve 100+ deliveries in a small local area several times a day, lots of the deliveries may exist in the same postcode.

As such, when we use MapPoint to add waypoints and optimise the run on postcode & streetname / house number.

Problem is, if you call MapPoints FindAddressResults() function with a bad streetname but valid postcode, it ignores the postcode and tries finding the streetname elsewhere, often in a random town hundreds of miles away.

Now, whilst we can ask the shops to improve the quality of their data - this will never be done reliably.

My question: when calling FindAddressResults(), is there any way to make it prioritise the postcode over the streetname as opposed to it's default behaviour which prioritises the streetname over the postcode?

Example usage (This is written in VB6 (dont ask) - but any example / info would help):

'#### GeoCode using postcode & streetname
Set oResults = oMap.FindAddressResults(rsRequest("Request_Address"), , , , rsRequest("Request_Postalcode"))
If oResults.Count = 0 Then
    '#### Nothing was found, GeoCode using postcode only
    Set oResults = oMap.FindAddressResults(, , , , rsRequest("Request_Postalcode"))
End If

The only thing i can think off is setting a "Max Distance" var, if the 1st (best match) item in oResults[] is over that threshold, default to a postcode only search - but that would be a botch at best.

EDIT 1 - Just came up with this, seems to work OK:

Set oResults = oMap.FindAddressResults(rsRequest("Request_Address"), , , , rsRequest("Request_Postalcode"))
If oResults.ResultsQuality <> geoFirstResultGood Then
    echo (rsRequest("Request_Address") & " + " & rsRequest("Request_Postalcode") & " had poor results (" & CStr(oResults.ResultsQuality) & "), using postcode only instead...")
    Set oResults = oMap.FindAddressResults(, , , , rsRequest("Request_Postalcode"))
End If
Was it helpful?

Solution

Yes you have come up with the result I would have suggested:

  1. Perform query with street address
  2. Check the ResultsQuality if it is ambiguous / bad, then...
  3. ...perform the second query with just the postcode

Another way to improve FindAddressResults quality with British addresses, is to try a few different calls to FindAddressResults until you find one that gives a "Good" quality result. Each call would have a slightly different variation in the parameters. British addresses are pretty felxible, for example the house name might be line 1 (making line 2 the street); and there might be more than one place ("cities" in US parlance) - eg. a village and a city/town. in the address.

Run some test data through, first; and find the combinations that perform best. Then your call sequence would start with the best combination, second best, etc. until a 'good' result is found. Finally if there are no results, you can try your Postcode-only call, as above.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top