Geofencing Extension API Developer's Guide

Check if the Asset's Position Is Inside the Geofences

User Story

The user wants to check in which geofence polygons an asset resides, and how far away it is from the polygons.

Request

The code below shows an actual request matching the user story. The proximity query parameter represents the asset's GPS position latitude and longitude in WGS 84 degree.

https://gfe.cit.api.here.com/2/search/proximity.json
?layer_ids=4711
&app_id={YOUR_APP_ID}
&app_code={YOUR_APP_CODE}
&proximity=50.0,8.0,500
&key_attribute=POSTCODE

Response

The response to the request contains information about each geometry that either comprises the asset position or is not more than the given search radius away from the asset position:
{
  "errors":[],
  "warnings":[],
  "requestId":"469b08f3-2838-49d3-912d-4adf81d6e93c",
  "geometries":[
    {
      "distance":655.66,
      "nearestLat":50.0,
      "nearestLon":8.0,
      "attributes":
        {
          "POSTCODE":"2009",
          "ADMIN4":"Sydney",
          ...
        }
    },
    {
      "distance":-99999999,
      "nearestLat":50.1,
      "nearestLon":8.1,
      "attributes":
        {
          "POSTCODE":"2000",
          "ADMIN4":"Sydney",
          ...
        }
    }
  ],
  "onError":false
}