Migration guide Autocomplete 5

The migration guide shows the changes to the autocomplete and what needs to be adjusted for the new version.

Loader

The server-side loader must hand over to load the autocomplete module in version 5. This is done by adding autocomplete-5 to the libraries parameter.

https://www.yellowmap.de/api_rst/api/loader?libraries=free-3,autocomplete-5&apiKey={{API_KEY}}

Ready

In the javascript code, the ready function must be passed the parameter { autocomplete: 5 }..

ym.ready({ autocomplete: 5 }, function (modules) {

Changed parameter

For the new Autocomplete, these parameters have been renamed. An overview of all parameters can be found under references.

Old parameter Renamed to parameter Description
locales isoCountries The countries to search in: An array with any number of country codes according to ISO-3166-2 is specified. If the parameter is not specified, all supported countries are searched.
onlyInGeoRect inBoundingBox Shows only results that are in the rectangle specified in the boundingBoxBoost parameter.

Return Type

With the new autocomplete there are the return types GeoJSON and JSON. The protobuf data type has been discontinued.

Autocomplete no longer uses the location object to deliver the address data, but delivers it directly to the properties of the geoJSON. The variable names now start with capital letters.
Old returntype: JSON New returntype: GeoJSON

{
  "properties": {
    "type": "yellowmaps",
    "displayValue": "Berlin, DE",
    "location": {
      "country": "DE",
      "district": "",
      "zip": "",
      "city": "Berlin",
      "cityAddOn": "",
      "cityPart": "",
      "street": "",
      "houseNo": "",
      "singleSlot": ""
    },
    "searchData": {
      "location": {
        "singleSlot": "Berlin, DE"
      }
    }
  }
}

{
  "type": "Feature",
  "geometry": {
    "type": "Point",
    "coordinates": [
      13.3888599,
      52.5170365
    ]
  },
  "properties": {
    "Id": null,
    "Locale": null,
    "GeoEntityType": "CITY",
    "Country": "Deutschland",
    "State": "Berlin",
    "Neighbourhood": null,
    "District": null,
    "County": null,
    "City": "Berlin",
    "CityPart": null,
    "Zip": null,
    "Street": null,
    "Village": null,
    "HouseNumber": null,
    "Geometry": {
      "Type": "Point",
      "Coordinates": [
        13.3888599,
        52.5170365
      ]
    },
    "Poi": null,
    "_osmid": 0,
    "type": null,
    "_class": null,
    "Rank": 0,
    "Importance": 0.8875390282491362,
    "RepositoryScore": 1.3475391,
    "DisplayValue": "Berlin"
  }
}