How to get a list of safety cameras in a geospatial area
This example uses the geospatial resource to retrieve a list of all known safety cameras for a given geospatial area. This data retrieval utilizes a corridor, which is a line describing the intended path of the vehicle and returns cameras within the specified radius of that path. Each request must conform to the following format:
GET
{header}
.../v2/search?{param}={value}
POST
{header}
{body payload}
.../v2/searchAuthorization
Each request requires authentication with a valid bearer token in the HTTP authorization header:
Authorization: Bearer <token>For more information on obtaining credentials, see the Identity and Access Management - Developer Guide.
Query parameter - GET resource
The following table defines the query parameter supported by the GET resource:
| Parameter | Required | Description | Notes |
|---|---|---|---|
| in | Yes | A geographic area can be one of the following: A circular area, provided as latitude, longitude, and radius (in meters) Format: circle:{latitude},{longitude};r={radius} Type: circle:{decimal},{decimal};r={integer} Example: circle:13.1,-43.1;r=10000 A bounding box, provided as west longitude, south latitude, east longitude, north latitude Format: bbox:{west longitude},{south latitude},{east longitude},{north latitude} Example: bbox:13.08836,52.33812,13.761,52.6755 | Maximum radius for circle area is 50 km Maximum bounding box size is 100x100 km. |
Payload for corridor search - POST resource
Schema
The following code block provides a sample schema:
CorridorSearchRequest {
corridor: [
Location {
lat: number($double),
lng: number($double)
}
],
width: integer($int32)
}
Payload example
The following code block provides a payload example:
{
"corridor": [
{
"lat": 52.5310898,
"lng": 13.3849497
},
{
"lat": 52.5378799,
"lng": 13.3735304
},
{
"lat": 52.5476799,
"lng": 13.3569899
},
{
"lat": 52.5622292,
"lng": 13.3263397
}
],
"width": 2000
}Payload requirements
The following are the required parameters for this payload:
lat,lngare mandatory.widthdescribes the width of the corridor in meters and is optional with a default value of 5km (in this case it would extend 2.5km to either side of the path).- Max area size is 5000km2.
- Max
widthis 20km. - Must have at east 2
Locationpoints.
Response
The response status is 200 OK and the response payload contains a list of safety cameras in the JSON format. For more information on the response data types, see Response data types.
Using the resource
The following sample code demonstrates how to access the resource:
curl GET -X 'https://safetycameras.cit.cc.api.here.com/v2/search?in=circle:41.872700,12.518161;r=1000'
-H 'Authorization: Bearer eyJhbGciOiJSUzUx...'
The following is the corresponding response:
{
"safetyCameras": [
{
"id": "54583_1_ITA",
"country": "ITA",
"positions": [
{
"latitude": 41.8689270019531,
"longitude": 12.5248804092407,
"drivingDirection": 169
},
{
"latitude": 41.8667678833008,
"longitude": 12.5266599655151,
"drivingDirection": 129
}
],
"cameraType": "RegularMobileZone",
"speedLimit": {
"value": 50,
"unit": "KPH"
},
"directionType": "Same",
"openLR": [
"CGUBEABhXAjoFh3GAwAJBQQ...=="
]
},
{
"id": "54580_1_ITA",
"country": "ITA",
"positions": [
{
"latitude": 41.873405456543,
"longitude": 12.5133857727051,
"drivingDirection": 282
},
{
"latitude": 41.874324798584,
"longitude": 12.5082292556763,
"drivingDirection": 281
}
],
"cameraType": "RegularMobileZone",
"speedLimit": {
"value": 50,
"unit": "KPH"
},
"directionType": "Same",
"openLR": [
"CIEcARAAgReBEQjmJB3GywAJBQQEA8sACg..."
]
}
]
}Updated last month