Page 1 of 1

Resolving UK addresses with full post code in xLocate Intern

Posted: Tue Aug 17, 2021 4:14 pm
by Oliver Meyer
Hi Bernd and PTV team,

we're observing some weird behaviour of xLocate Internet when we try to geolocate addresses in the UK.

As you know, we provide a tour planning service ("maiTour") as an add-on to SAP Sales Cloud, and have to geolocate addresses that come out of our customers' systems. We're using the "findAddresses" operation from the XLocate 1.x API.

Now that we have a customer in UK, we observe some puzzling behaviour of the XLocate API:

1. Addresses that have a full postcode will be corrected by XLocate.findAddresses, but the result will only consist of the post code and the country code; the street, housenumber and city will be returned empty.

Example:
XLocate In:

Code: Select all

{
  "addr": {
    "country": "GB",
    "postCode": "G53 6AG",
    "city": "SILVERBURN",
    "city2": "",
    "street": "BARRHEAD ROAD",
    "houseNumber": ""
  }
}
XLocate out:

Code: Select all

{
      "$type": "ResultAddress",
      "country": "GB",
      "state": "",
      "postCode": "G53 6AG",
      "city": "",
      "city2": "",
      "street": "",
      "houseNumber": "",
      "adminRegion": "",
      "appendix": "",
      "countryCapital": "London",
      "totalScore": 100,
      "detailLevelDescription": "EXTPOSTCODE",
      "classificationDescription": "LOW",
      "coordinates": {
        "$type": "Point",
        "point": {
          "$type": "PlainPoint",
          "x": -482825.05073,
          "y": 7514600.4946
        }
      },
      "additionalFields": []
    }
2. Addresses that have a correct street, housenumber and city, but a wrong or missing post code, will not be found, and replaced by something completely different.

Example:
XLocate in (note the wrong post code)

Code: Select all

{
  "addr": {
    "country": "GB",
    "postCode": "G53 6QR",
    "city": "SILVERBURN",
    "city2": "",
    "street": "BARRHEAD ROAD",
    "houseNumber": ""
  }
}
XLocate out (note: the totalScore of this address is so low that our service rejects it):

Code: Select all

    {
      "$type": "ResultAddress",
      "country": "GB",
      "state": "Scotland",
      "postCode": "EH26 9",
      "city": "Penicuik",
      "city2": "Silverburn",
      "street": "Biggar Road",
      "houseNumber": "",
      "adminRegion": "Penicuik",
      "appendix": "",
      "countryCapital": "London",
      "totalScore": 41,
      "detailLevelDescription": "STREET",
      "classificationDescription": "LOW",
      "coordinates": {
        "$type": "Point",
        "point": {
          "$type": "PlainPoint",
          "x": -363862.04651,
          "y": 7516122.7815
        }
      },
      "additionalFields": []
    }
3. Addresses that have a correct street, housenumber and city, and only the first part of the post code (the "outward code"; only area and district), will usually be found correctly, and street, housenumber (if present) and city will be correct also in the returned result.

Example:
XLocate in:

Code: Select all

{
  "addr": {
    "country": "GB",
    "postCode": "G53",
    "city": "SILVERBURN",
    "city2": "",
    "street": "BARRHEAD ROAD",
    "houseNumber": ""
  }
}
XLocate out:

Code: Select all

    {
      "$type": "ResultAddress",
      "country": "GB",
      "state": "Scotland",
      "postCode": "G53 6",
      "city": "Glasgow",
      "city2": "",
      "street": "Barrhead Road",
      "houseNumber": "",
      "adminRegion": "Glasgow",
      "appendix": "",
      "countryCapital": "London",
      "totalScore": 66,
      "detailLevelDescription": "HNRSECTION",
      "classificationDescription": "MEDIUM",
      "coordinates": {
        "$type": "Point",
        "point": {
          "$type": "PlainPoint",
          "x": -482042.23845,
          "y": 7514857.8172
        }
      },
      "additionalFields": []
    }
The ideal response would be a mix of case 1 and case 3, i.e. when the post code is correct, not only the coordinates should be returned correctly, but also the address.
Is there something about this we can influence by setting specific parameters?
Setting POSTCODE_AGGREGATE didn't change anything about the result.

Or do we have to adapt our service to the values returned in the result, like detailLevelDescription?

Kind Regards

Oliver Meyer
nagarro ES GmbH
Westerbachstraße 32
61476 Kronberg im Taunus

Re: Resolving UK addresses with full post code in xLocate In

Posted: Wed Aug 18, 2021 11:50 am
by Bernd Welter
Hi Oliver,

did you already check this article?
https://xserver.ptvgroup.com/forum/view ... CODE#p2426

Roughly spoken there's an additional table with (more than a million!) UK 7digit postcodes + (x,y). This table does not contain any citynames, districts or streets.

If you enter a zipcode with 6 or 7 digits (with or without other fields such as city or streetname) we check this table and if there's a match we return "the extended postcode", (x,y) and the level "EXTPOSTCODE".
WIthout a match we perform the regular geocoding based on the maps own dataset.

What I'll do next:
- I'll ask Jochen to comment on this, too
- I'll try to find out whether there's a API parameter that disables the 2 steps and immediately enforces the step 2 (search on map data).

Bernd

Re: Resolving UK addresses with full post code in xLocate In

Posted: Wed Aug 18, 2021 12:24 pm
by bocajo
Hi together
Bernd explained the behavior of UK post code search in xLocate 1 very good. What I can say is that there is no API parameter to disable the 2 steps.
Maybe you can check xLocate 2? Here we integrated the 6/7 digits UK post codes into the search index and the response returns postal code, city, street and housenumber there aren't to search steps and no additional postal code file.

Re: Resolving UK addresses with full post code in xLocate In

Posted: Wed Aug 18, 2021 12:39 pm
by Bernd Welter

Re: Resolving UK addresses with full post code in xLocate In

Posted: Wed Aug 18, 2021 1:49 pm
by Oliver Meyer
Hi Bernd and Jochen,

thanks for clearing this up.

I think there's an easy workaround for us:

If we find the EXTPOSTCODE level in the response from xLocate, we just don't copy the street, house number and city fields from the response, but instead copy them from the original input data. That way, we leave it to the responsibility of our customers to maintain their data correctly so the actual address matches the postal code.

Is the presence of the EXTPOSTCODE level a reliable indicator for the coordinates being correct, as per the UK post code table? Is this level also used for other countries, and if so, does it have the same meaning?

Cheers

Oliver

Re: Resolving UK addresses with full post code in xLocate In

Posted: Wed Aug 18, 2021 1:56 pm
by Bernd Welter
Here's some more info about the extended postcode.
It's main purpose - at least from my perspective - is to gather a ~100m coordinate (precise enough for a tender, not precise enough for the postman) if the input zipcode is 100% correct. No fuzzy search, no typos...

Look at https://xserver.ptvgroup.com/forum/down ... &mode=view - there you can see the same approach in the US. Each dot is a single code. Coverage is enough for the tender usecase.

Bernd