Explore Multiple Positions

To explore up to 1000 positions with a single request, you can use the POST anchors endpoint. This endpoint is a more convenient way of using HERE Geoenrichment if performance is a key requirement and you need to customize the response accordingly.

POST https://geoenrichment.here.com/v1/layers/{layer_realName}/anchors

There are three parameters that you can use to customize the location to explore:

  • data - Contains infomations about the locations to be explored.
  • outputGeoProperties - Specifies the geo-properties that 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 the 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.

Request Body

Structure your request body based on the schema below:

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

The data parameter is an array that provides a collection of up to 1000 points to explore. Each element consists of a latitude, longitude, and an entity_id. entity_id is used to match the position sent in the request with the mapped entities in the response. You can use any string as the entity_id, as the service does not process it in any way.

For information on how to customize your response, see Filter Your Response.

Response Body

The response is based on the following schema:

{
  "layer": {
    "layerId": "string",
    "name": "string",
    "version": 0
  },
  "data": [
    {
      "request": {
        "entityId": "id_1",
        "location": {
          "lat": 0,
          "lng": 0
        }
      },
      "results": [
        {}
      ]
    }
  ]
}

The response consists of:

  • layer - Describes the layer that provides the data.
  • data - A collection of coordinates that was previously sent in the request, with a results collection containing entities that match the query. To limit the maximum number of results or the maximum radius of results, you can set limit or radius in the array object, or as query parameters. Query parameters will override default limit and radius values for all array objects, but parameters specified explicitly for given array object will override values from query parameters.

Example

The following example demonstrates how to send a POST request, requesting 3 coordinates with data from the Places layer. Query parameters limit the count of matched entities to 2, and the maximal distance to requested point as 90 meters.

Query URL

POST https://geoenrichment.api.here.com/v1/layers/places/anchors?limit=2&radius=90&apiKey={YOUR_API_KEY}

Request body

{
  "data": [
    {
      "entityId": "1",
      "location": {
        "lng": -0.14241993,
        "lat": 51.400344
      },
      "limit": 1,
      "radius": 100
    },
    {
      "entityId": "2",
      "location": {
        "lng": 0.1424241,
        "lat": 51.30012
      }
    },
    {
      "entityId": "3",
      "location": {
        "lng": -0.1253211,
        "lat": 51.385641
      }
    }
  ]
}

Response

{
    "layer": {
        "layerId": "0e14dd71-8bbf-437d-b622-f614f9406fac",
        "name": "HERE Place External layer",
        "version": 535
    },
    "data": [
        {
            "results": [
                {
                    "here_id": "826gcpuk-8974ae452cfc49d7bffe8db7f4ba4819",
                    "categories": "Hair and Beauty",
                    "name": "Healthy Hair Ateli",
                    "h24": "False",
                    "categories_ids": "600-6950-0000",
                    "geojson": {
                        "type": "Point",
                        "coordinates": [
                            -0.14167,
                            51.39998
                        ]
                    },
                    "qualityScore": "3",
                    "language": null,
                    "distance": 66.06,
                    "address": {
                        "countryCode": "GBR | GBR",
                        "street": " | Franklin Crescent",
                        "postalCode": "CR4 1 | CR4 1NB"
                    }
                }
            ],
            "request": {
                "location": {
                    "lat": 51.400344,
                    "lng": -0.14241993
                },
                "entityId": "1",
            }
        },
        {
            "results": [],
            "request": {
                "location": {
                    "lat": 51.30012,
                    "lng": 0.1424241
                },
                "entityId": "2",
            }
        },
        {
            "results": [
                {
                    "here_id": "826gcpum-df543281bb974c7d8e1b0a358b0f41ab",
                    "categories": "Education Facility",
                    "name": "Chris Osibona at the AA",
                    "h24": "False",
                    "categories_ids": "800-8200-0000",
                    "geojson": {
                        "type": "Point",
                        "coordinates": [
                            -0.1247,
                            51.38605
                        ]
                    },
                    "qualityScore": "1",
                    "language": null,
                    "distance": 62.77,
                    "address": {
                        "countryCode": "GBR | GBR",
                        "street": " | Westcombe Avenue",
                        "postalCode": "CR0 3 | CR0 3DA"
                    }
                },
                {
                    "here_id": "826gcpum-78c76a10a4ea43558ad9e509ad4ea80a",
                    "categories": "Specialty Trade Contractors",
                    "name": "Kore Plumbers",
                    "h24": "False",
                    "categories_ids": "700-7200-0277",
                    "geojson": {
                        "type": "Point",
                        "coordinates": [
                            -0.1259256,
                            51.3851435
                        ]
                    },
                    "qualityScore": "3",
                    "language": null,
                    "distance": 69.53,
                    "address": {
                        "countryCode": "GBR | GBR",
                        "street": " | Rosedene Avenue",
                        "postalCode": "CR0 3 | CR0 3DN"
                    }
                }
            ],
            "request": {
                "location": {
                    "lat": 51.385641,
                    "lng": -0.1253211
                },
                "entityId": "3",
            }
        }
    ]
}

results matching ""

    No results matching ""