xLocate2 Cyrillic vs Latin

deals with geocoding and reverse geocoding in the context of PTV Geocoding&Places, PTV Geocoding&Places OSM and PTV xLocate 1 and 2
Post Reply
RemcoZut
Posts: 4
Joined: Fri Dec 08, 2023 9:47 am

xLocate2 Cyrillic vs Latin

Post by RemcoZut »

We encounter a problem with the xServer2 XLocate responses on countries where cyrillic script is default.
The use-case:
SearchLocationRequest is invoked with mapLanguage with 'nl' (dutch) or other western languages.
When the requested language is not available in the map data the language of the country locality is used.
In case of requesting the Sparta in Greece this results in a western human unreadable cyrillic 'Σπάρτη'
A western Latin value was expected like 'Sparti'
To ensure latin script a workaround is implemented which checks the requested country and overrides the preferred mapLanguage when in certain cyrillic based countries with resp und-Latn-t-el, und-Latn-t-ru.
Unfortunately this workaround doesn't cover all types of requests, ie:
- a searchByText without allowedCountries specification
- a searchByPosition without allowedCountries specification (which definitely is the common way to be invoked, agree?)

An improvement in the xServer can be to have a switch in xserver.conf to enforce Latin script in the output

A related topic is viewtopic.php?t=1595

Kind regards,
Remco Zut | Locatienet bv
User avatar
Bernd Welter
Site Admin
Posts: 2664
Joined: Mon Apr 14, 2014 10:28 am
Contact:

Re: xLocate2 Cyrillic vs Latin

Post by Bernd Welter »

Hi Remco,

not sure what the request is about... you want to enforce a "latin" version of an output?

Code: Select all

{
  "$type":"SearchByTextRequest",
  "text": "Greece,Sparta",
  "requestProfile": {
      "mapLanguage": "nl"
  }
}

Code: Select all

{
  "$type":"SearchByTextRequest",
  "text": "Greece,Sparta",
  "requestProfile": {
      "mapLanguage": "und-Latn-t-el"
  }
}

Code: Select all

{
  "$type":"SearchByTextRequest",
  "text": "Greece,Sparta",
  "requestProfile": {
  }
}

Code: Select all

{
  "$type": "LocationsResponse",
  "results": [
    {
      "location": {
        "referenceCoordinate": {
          "x": 22.426630091,
          "y": 37.074611685
        },
        "address": {
          "country": "Griekenland",
          "state": "Πελοπόννησος",
          "province": "Λακωνία",
          "city": "Σπάρτη"
        },
        "formattedAddress": "Σπάρτη"
      },
      "matchQuality": {
        "totalScore": 100,
        "addressScores": {
          "country": 100,
          "state": 0,
          "province": 0,
          "city": 100
        }
      },
      "type": "LOCALITY"
    }
  ]
}

Code: Select all

{
  "$type": "LocationsResponse",
  "results": [
    {
      "location": {
        "referenceCoordinate": {
          "x": 22.426630091,
          "y": 37.074611685
        },
        "address": {
          "country": "Ellada",
          "state": "Peloponnisos",
          "province": "Lakonia",
          "city": "Sparti"
        },
        "formattedAddress": "Sparti"
      },
      "matchQuality": {
        "totalScore": 100,
        "addressScores": {
          "country": 100,
          "state": 0,
          "province": 0,
          "city": 100
        }
      },
      "type": "LOCALITY"
    }
  ]
}

Code: Select all

{
  "$type": "LocationsResponse",
  "results": [
    {
      "location": {
        "referenceCoordinate": {
          "x": 22.426630091,
          "y": 37.074611685
        },
        "address": {
          "country": "Ελλάδα",
          "state": "Πελοπόννησος",
          "province": "Λακωνία",
          "city": "Σπάρτη"
        },
        "formattedAddress": "Σπάρτη"
      },
      "matchQuality": {
        "totalScore": 100,
        "addressScores": {
          "country": 100,
          "state": 0,
          "province": 0,
          "city": 100
        }
      },
      "type": "LOCALITY"
    }
  ]
}
Bernd Welter
Technical Partner Manager Developer Components
PTV Logistics - Germany

Bernd at... The Forum,LinkedIn, Youtube, StackOverflow
I like the smell of PTV Developer in the morning... :twisted:
RemcoZut
Posts: 4
Joined: Fri Dec 08, 2023 9:47 am

Re: xLocate2 Cyrillic vs Latin

Post by RemcoZut »

The mapLanguage of our requests is usually 'nl'

Code: Select all

{
  "$type": "SearchByTextRequest",
  "text": "Sparta",
  "requestProfile": {
    "mapLanguage": "nl"
  }
}
which results in Cyrillc Greek:

Code: Select all

{
  "$type": "LocationsResponse",
  "results": [
    {
      "location": {
        "referenceCoordinate": {
          "x": 22.426630091,
          "y": 37.074611685
        },
        "address": {
          "country": "Griekenland",
          "state": "Πελοπόννησος",
          "province": "Λακωνία",
          "city": "Σπάρτη"
        },
        "formattedAddress": "Σπάρτη"
      },
-----
}
This is not readable for the end-user. Thus a Latin version is needed as a fallback mapLanguage.
User avatar
Bernd Welter
Site Admin
Posts: 2664
Joined: Mon Apr 14, 2014 10:28 am
Contact:

Re: xLocate2 Cyrillic vs Latin

Post by Bernd Welter »

Hi Remco,

currently this is not possible. But we forwarded the requirement to product management.
Please get in touch with Joost/Kasper, too.

Best regards,
Bernd
Bernd Welter
Technical Partner Manager Developer Components
PTV Logistics - Germany

Bernd at... The Forum,LinkedIn, Youtube, StackOverflow
I like the smell of PTV Developer in the morning... :twisted:
RemcoZut
Posts: 4
Joined: Fri Dec 08, 2023 9:47 am

Re: xLocate2 Cyrillic vs Latin

Post by RemcoZut »

They are already informed
RemcoZut
Posts: 4
Joined: Fri Dec 08, 2023 9:47 am

Re: xLocate2 Cyrillic vs Latin

Post by RemcoZut »

Hi Bernd,

I want to actualize this issue.

For the geocoding request Valjevo in Servia with maplanguage Russian transliterated to latin alphabet (transformation subtag).

Code: Select all

{
  "$type": "SearchByAddressRequest",
  "address": {
    "city": "Valjevo",
    "country": "RS"
  },
  "requestProfile": {
    "mapLanguage": "und-Latn-t-ru"
  }
}
The response is still in cyrillic notation, and thus unreadable for western human :roll: :

Code: Select all

{
  "$type": "LocationsResponse",
  "results": [
    {
      "location": {
        "referenceCoordinate": {
          "x": 19.890300695,
          "y": 44.273788494
        },
        "address": {
          "country": "Servia",
          "state": "Централна Србија",
          "province": "Колубарски Округ",
          "city": "Ваљево"
        },
        "formattedAddress": "Ваљево"
      },
      "matchQuality": {
        "totalScore": 100,
        "addressScores": {
          "country": 100,
          "state": 0,
          "province": 0,
          "city": 100
        }
      },
      "type": "LOCALITY"
    }
  ]
}
I understand that this is because of the lack of availability, as stated in the documentation:
It depends on the data whether or not texts are available in the requested language. If the requested language is not available for that item, the default text will be used
But the map of Valjevo in Servia is showing the name of the city in latin correctly. So you may think the lating version should be available.

For example run this

Code: Select all

var map = new L.Map('map', { center: [44.273788494,19.890300695], zoom: 10 });

// Add a tile layer with the url pattern.
var tileUrl = xServerUrl + '/services/rest/XMap/tile/{z}/{x}/{y}';
new L.TileLayer(tileUrl, { minZoom: 1, maxZoom: 19}).addTo(map);
At:
https://xserver2-europe-eu-test.cloud.p ... 257C_____1

Can you please tell me why the map is showing the city in correct latin and the geocoder doesn't

Kind regards,

Remco Zut
Locatienet
User avatar
Bernd Welter
Site Admin
Posts: 2664
Joined: Mon Apr 14, 2014 10:28 am
Contact:

Re: xLocate2 Cyrillic vs Latin

Post by Bernd Welter »

Hi Remco,

in the upcoming version of xLocate (v2.34, expected for mid/end of october) we will also support "x-ptv-Latn-DFT" which will then return the result as expected.

This value is already supported in PTV Developer:

Code: Select all

{
  "country": "RS",     "state": "",     "locality": "Valjevo",
  "postalCode": "",     "street": "",     "houseNumber": "",
  "countryFilter": null,   "language": "x-ptv-Latn-DFT",
  "results": [
    "ADDRESS_SCORES"
  ]
}
returns:

Code: Select all

{
  "locations": [
    {
      "locationType": "LOCALITY",
      "referencePosition": {
        "latitude": 44.273788452148438,         "longitude": 19.890300750732422
      },
      "address": {
        "countryName": "Srbija",          "state": "Centralna Srbija",
        "province": "Kolubarski Okrug",         "postalCode": "",
        "city": "Valjevo",
        "district": "",         "subdistrict": "",
        "street": "",         "houseNumber": "",
        "countryCodeIsoAlpha2": "RS",
        "countryCodeIsoAlpha3": "SRB"
      },
      "formattedAddress": "Valjevo",
      "quality": {
        "distance": null,
        "totalScore": 100,
        "addressScores": {
          "country": 100,
          "city": 100
        }
      }
    }
  ]
}
Attachments
PTV Developer test
PTV Developer test
Bernd Welter
Technical Partner Manager Developer Components
PTV Logistics - Germany

Bernd at... The Forum,LinkedIn, Youtube, StackOverflow
I like the smell of PTV Developer in the morning... :twisted:
Post Reply