Apply a Polygon Filter for Incidents

To request data for a specific region of any shape that can be defined by a polygon, use a JSON query with a polygon filter to define the location:

What Is a Valid Polygon?

A polygon is only valid if the following criteria are met:

  • The polygon must be a single shape. Multiple polygons are not accepted.
  • A polygon must not be self intersecting.
  • A polygon's first coordinate and last coordinate must not be the same value.

The polygon must be specified by an array of N decimal values that define the latitude and longitude of each vertex.

{
    {"loc": {"geo": {"polygon": [<latitude1>, <longitude1>, <latitude2>, <longitude2>, ...]}}
    ...
}

When requesting incidents, make sure to include the "incident" element in your JSON query:

{
    "loc": {"geo": {"polygon": [<latitude1>, <longitude1>, <latitude2>, <longitude2>, ...]}},
    "incident": {}
}

When requesting flow data, make sure to include the "flow" element in your JSON query:

{
    "loc": {"geo": {"polygon": [<latitude1>, <longitude1>, <latitude2>, <longitude2>, ...]}},
    "flow": {}
}

Send an HTTP POST request to either the DATEX II or the DATEX II flow endpoint with your JSON data in the POST body:

http://data.traffic.api.here.com/datex/2.3/incident/content.xml

For an example of a polygon filter in a request to the Traffic Data Service, see Traffic Incidents Within a Polygon in DATEX II

results matching ""

    No results matching ""