Filter Your Response

Use the POST anchors endpoint to filter the response that you receive according to your application's needs. You can select which geo-properties you want and specify the values that they should have.

For example, if you are interested in hotels, you can get information about hotels in the area.

Request Body

Structure your request body based on the schema below:

{
  "outputGeoProperties": [
    "string"
  ],
  "filterGeoProperties": [
    {
      "geoPropertyId": "string",
      "propertyValue": [
        "string"
      ]
    }
  ],
  "data": [
    {
      "entityId": "string",
      "location": {
        "lat": 0,
        "lng": 0
      }
    }
  ]
}

Both outputGeoProperties and filterGeoProperties are optional parameters, that are used to customize the response.

  • outputGeoProperties - Specifies which geo-properties should be part of each entity in the response; optional. By default, all possible geo-properties are returned. If you require only a subset of possible geo-properties, you must specify their IDs.
  • filterGeoProperties - An array that contains the criteria to filter for a specific geo-property, by a specific value; optional. Each criteria consists of a geo-property ID and a collection of values allowed. If the geo-property value does not contain any of the allowed values, the entity is excluded from the response.

Example

Consider a layer described as follows:

{
    "data": [
        {
            "id": "bce6b1aa-5464-450d-a387-37caf357b93e",
            "name": "HERE Places layer",
            "realName": "places",
            "shortDescription": "All countries ingested",
            "version": 1527233555,
            "geoProperties": [
                {
                    "id": "d6c4eec2-272c-4dc0-8dbc-b4b32086e40d",
                    "name": "categories"
                },
                {
                    "id": "d4b377e9-15dd-4d80-9006-4d809ddfc577",
                    "name": "postalCode"
                },
                {
                    "id": "842baf42-2219-4170-a29f-5794ecb57463",
                    "name": "street"
                },
                {
                    "id": "b6b06929-e117-4343-a6de-339acd2cef85",
                    "name": "countryCode"
                },
                {
                    "id": "365a9433-ec74-4ba1-829e-c3dfc283791a",
                    "name": "name"
                },
                {
                    "id": "0f51fa4b-bddf-4b44-8fbc-2159b412b418",
                    "name": "language"
                },
                {
                    "id": "4b4c7bf6-c6b5-46f3-8a73-de0dd4ba8db0",
                    "name": "qualityScore"
                }
            ]
        }
    ]
}

If a user wants to query only for hotels, and is interested in the name, category, and quality score, the request body is as follows:

{
  "outputGeoProperties": [
    "name",
    "categories",
    "qualityScore"
  ],
  "filterGeoProperties": [
    {
      "geoPropertyId": "Categories",
      "propertyValue": [
        "Hotel"
      ]
    }
  ],
  "data": [
    {
      "entityId": "id_0",
      "location": {
        "lat": 51.515052,
        "lng": -0.180789
      }
    }
  ]
}

The corresponding response is then:

{
    "layer": {
        "layer_id": "bce6b1aa-5464-450d-a387-37caf357b93e",
        "name": "HERE Places layer",
        "version": 1527233555
    },
    "data": [
        {
            "request": {
                "entityId": "id_1",
                "location": {
                    "lat": 51.515052,
                    "lng": -0.180789
                }
            },
            "results": [
                {
                    "calc_distance": 5.71,
                    "quality_score": 2,
                    "name": "Chilworth Court Apartments;Chilworth Court Apartment Hotel London",
                    "categories_ids": "Hotel/Motel|Lodging",
                    "geojson": {
                        "type": "Point",
                        "coordinates": [
                            -0.18072,
                            51.51508
                        ]
                    }
                },
                {
                    "calc_distance": 36.04,
                    "quality_score": 1,
                    "name": "Chilworth Court Apartments",
                    "categories_ids": "Hotel",
                    "geojson": {
                        "type": "Point",
                        "coordinates": [
                            -0.18027,
                            51.51506
                        ]
                    }
                },
                {
                    "calc_distance": 36.04,
                    "quality_score": 2,
                    "name": "Casserly Court Hotel",
                    "categories_ids": "Hotel/Motel|Hotel",
                    "geojson": {
                        "type": "Point",
                        "coordinates": [
                            -0.18027,
                            51.51506
                        ]
                    }
                },
                {
                    "calc_distance": 82.64,
                    "quality_score": 2,
                    "name": "Devonshire Terrace",
                    "categories_ids": "Hotel/Motel|Lodging",
                    "geojson": {
                        "type": "Point",
                        "coordinates": [
                            -0.18045,
                            51.51434
                        ]
                    }
                },
                {
                    "calc_distance": 90.75,
                    "quality_score": 2,
                    "name": "Nest Hotel",
                    "categories_ids": "Hotel/Motel|Hotel",
                    "geojson": {
                        "type": "Point",
                        "coordinates": [
                            -0.18153,
                            51.51438
                        ]
                    }
                }
            ]
        }
    ]
}

If the user requires more conditions, for example, to look for all hotels that contain 'Grand' or 'Terrace' in their name, the resulting filter should be:

  "filterGeoProperties": [
    {
      "geoPropertyId": "categories",
      "propertyValue": [
        "Hotel"
      ]
    },
    {
      "geoPropertyId": "name",
      "propertyValue": [
        "Grand", "Terrace"
      ]
    }
  ]

Now, the response is:

{
    "layer": {
        "layer_id": "bce6b1aa-5464-450d-a387-37caf357b93e",
        "name": "HERE Places layer",
        "version": 1527233555
    },
        "data": [
        {
            "request": {
                "entityId": "id_1",
                "location": {
                    "lat": 51.515052,
                    "lng": -0.180789
                }
            },
            "results": [
                {
                    "calc_distance": 82.64,
                    "quality_score": 2,
                    "name": "Devonshire Terrace",
                    "categories_ids": "Hotel/Motel|Lodging",
                    "geojson": {
                        "type": "Point",
                        "coordinates": [
                            -0.18045,
                            51.51434
                        ]
                    }
                },
                {
                    "calc_distance": 90.75,
                    "quality_score": 4,
                    "name": "Park Grand",
                    "categories_ids": "Hotel/Motel|Hotel",
                    "geojson": {
                        "type": "Point",
                        "coordinates": [
                            -0.18153,
                            51.51438
                        ]
                    }
                }
            ]
        }
    ]
}

results matching ""

    No results matching ""