Get map attributes along a path
HERE Map Attributes API v8 offers HERE map data for a variety of use cases. This sample demonstrates how to pick additional road attributes along a path, which might be a precalculated route. This feature requires a list of contiguous segment references.
Topology segment references
The tutorial shows how to enrich a route with additional information based on all HERE map data. The route can be provided as a list of contiguous segment references literals or as a flexible polyline.
Segment references are described in the HERE Routing API reference (see segmentRef in spans in HERE Routing API v8 API reference). Such a reference needs also latitude, longitude, remaining time and the functional class of the segment for efficient lookup of the data.
Sample request
curl -gX GET 'https://smap.hereapi.com/v8/maps/attributes/path?'\
'transportMode=car'\
'&segmentRefs=$1%3A87628529%230..725739'\
'&attributes=ROAD_GEOM_FCn(*),ROAD_NAME_FCn(NAMES),LINK_ATTRIBUTE_FCn(*)'\
'&apiKey=API_KEY'Sample request using POST
GET requests are subject to request-line length limits imposed by load balancers. For a path with many segment references, use POST and send the path in an application/x-www-form-urlencoded request body. Only authentication (apiKey, or app_id/app_code) and basic configuration parameters remain in the query string.
Send the path with segmentRefs in the request body:
curl -X POST 'https://smap.hereapi.com/v8/maps/attributes/path?transportMode=car&attributes=ROAD_GEOM_FCn(*),ROAD_NAME_FCn(NAMES),LINK_ATTRIBUTE_FCn(*)&apiKey=API_KEY' \
-H 'Content-Type: application/x-www-form-urlencoded' \
--data-raw 'segmentRefs=here:cm:segment:851632317#-0..1;here:cm:segment:106914355#-0..1;here:cm:segment:213328810#+0..1'You can also provide the path with the segments parameter, which encodes latitude, longitude, remaining time, and functional class for each segment:
curl -X POST 'https://smap.hereapi.com/v8/maps/attributes/path?attributes=LINK_ATTRIBUTE_FCn(FUNCTIONAL_CLASS)&apiKey=API_KEY' \
-H 'Content-Type: application/x-www-form-urlencoded' \
--data-raw 'segments=$0::377554540:$1:106914355#-0..1,45.50542,6.56933,43,4;$0::377554540:$1:213328810#+0..0.1716907241315792,45.5049,6.56856,41,4'Response
Click to view the sample response.
{
"refReplacements": {
"0": ":1742895365354:",
"1": "here:cm:segment"
},
"segments": [
{
"segmentRef": "$0:23600842:$1:87628529#+0..0.35066",
"attributeDirection": "+",
"attributes": {
"LINK_ATTRIBUTE_FCN": [
{
"ISO_COUNTRY_CODE": "DEU",
"VEHICLE_TYPES": "1023",
"URBAN": "Y",
"TRANSPORT_VERIFIED": "Y",
"FUNCTIONAL_CLASS": "3",
"CONTROLLED_ACCESS": "N",
"LIMITED_ACCESS_ROAD": "N",
"TRAVEL_DIRECTION": "B",
"BOAT_FERRY": "N",
"RAIL_FERRY": "N",
"MULTI_DIGITIZED": "N",
"DIVIDER": "N",
"DIVIDER_LEGAL": "N",
"FRONTAGE": "N",
"PAVED": "Y",
"RAMP": "N",
"PRIVATE": "N",
"POI_ACCESS": "N",
"INTERSECTION_CATEGORY": "0",
"SPEED_CATEGORY": "6",
"LANE_CATEGORY": "1",
"COVERAGE_INDICATOR": "N0",
"TO_REF_NUM_LANES": "1",
"FROM_REF_NUM_LANES": "1",
"PHYSICAL_NUM_LANES": "3",
"LOW_MOBILITY": "3",
"PUBLIC_ACCESS": "Y",
"ROUTE_TYPES": "8"
}
],
"ROAD_GEOM_FCN": [
{
"LONG_HAUL": "N",
"NAME": "L3202 / Freigerichter Straße",
"TUNNEL": "N",
"BRIDGE": "N",
"LAT": "5020318,36",
"LON": "917879,26",
"ZLEVEL": ",",
"ELEVATION": ","
}
],
"ROAD_NAME_FCN": [
{
"NAMES": "GERBNL3202\u001e\u001eGERY\"?El %tsvaI|?Un|\"draI|sIC \"nUI \"tsvaI;GERN\"?El \"tsvaI|?Un|%draI|sIC \"nUl \"tsvaI;GERN\"lant|Stra:|s@ %draI|taU|z=nt|%tsvaI|hUn|d6t|\"tsvaI;GERN\"lant|Stra:|s@ \"tsvaI|?Un|%draI|sIC \"nUl \"tsvaI\u001dGERBNFreigerichter Straße\u001e\u001eGERY\"fraI|g@|%rIC|t6 \"Stra:|s@"
}
]
}
},
{
"segmentRef": "$0:23600842:$1:87628529#+0.35067..0.71976",
"attributeDirection": "+",
"attributes": {
"LINK_ATTRIBUTE_FCN": [
{
"ISO_COUNTRY_CODE": "DEU",
"VEHICLE_TYPES": "1023",
"URBAN": "Y",
"TRANSPORT_VERIFIED": "Y",
"FUNCTIONAL_CLASS": "3",
"CONTROLLED_ACCESS": "N",
"LIMITED_ACCESS_ROAD": "N",
"TRAVEL_DIRECTION": "B",
"BOAT_FERRY": "N",
"RAIL_FERRY": "N",
"MULTI_DIGITIZED": "N",
"DIVIDER": "2",
"DIVIDER_LEGAL": "Y",
"FRONTAGE": "N",
"PAVED": "Y",
"RAMP": "N",
"PRIVATE": "N",
"POI_ACCESS": "N",
"INTERSECTION_CATEGORY": "0",
"SPEED_CATEGORY": "6",
"LANE_CATEGORY": "1",
"COVERAGE_INDICATOR": "N0",
"TO_REF_NUM_LANES": "1",
"FROM_REF_NUM_LANES": "1",
"LOW_MOBILITY": "3",
"PUBLIC_ACCESS": "Y",
"ROUTE_TYPES": "8"
}
],
"ROAD_GEOM_FCN": [
{
"LONG_HAUL": "N",
"NAME": "L3202 / Freigerichter Straße",
"TUNNEL": "N",
"BRIDGE": "N",
"LAT": "5020354,17,21",
"LON": "917905,12,15",
"ZLEVEL": ",,",
"ELEVATION": ",,"
}
],
"ROAD_NAME_FCN": [
{
"NAMES": "GERBNL3202\u001e\u001eGERN\"lant|Stra:|s@ \"tsvaI|?Un|%draI|sIC \"nUl \"tsvaI;GERY\"?El %tsvaI|?Un|\"draI|sIC \"nUI \"tsvaI;GERN\"?El \"tsvaI|?Un|%draI|sIC \"nUl \"tsvaI;GERN\"lant|Stra:|s@ %draI|taU|z=nt|%tsvaI|hUn|d6t|\"tsvaI\u001dGERBNFreigerichter Straße\u001e\u001eGERY\"fraI|g@|%rIC|t6 \"Stra:|s@"
}
]
}
},
{
"segmentRef": "$0:23600842:$1:87628529#+0.71977..1",
"attributeDirection": "+",
"attributes": {
"LINK_ATTRIBUTE_FCN": [
{
"ISO_COUNTRY_CODE": "DEU",
"VEHICLE_TYPES": "1023",
"URBAN": "Y",
"TRANSPORT_VERIFIED": "Y",
"FUNCTIONAL_CLASS": "3",
"CONTROLLED_ACCESS": "N",
"LIMITED_ACCESS_ROAD": "N",
"TRAVEL_DIRECTION": "B",
"BOAT_FERRY": "N",
"RAIL_FERRY": "N",
"MULTI_DIGITIZED": "N",
"DIVIDER": "1",
"DIVIDER_LEGAL": "Y",
"FRONTAGE": "N",
"PAVED": "Y",
"RAMP": "N",
"PRIVATE": "N",
"POI_ACCESS": "N",
"INTERSECTION_CATEGORY": "0",
"SPEED_CATEGORY": "6",
"LANE_CATEGORY": "1",
"COVERAGE_INDICATOR": "N0",
"TO_REF_NUM_LANES": "1",
"FROM_REF_NUM_LANES": "1",
"PHYSICAL_NUM_LANES": "3",
"LOW_MOBILITY": "3",
"PUBLIC_ACCESS": "Y",
"ROUTE_TYPES": "8"
}
],
"ROAD_GEOM_FCN": [
{
"LONG_HAUL": "N",
"NAME": "L3202 / Freigerichter Straße",
"TUNNEL": "N",
"BRIDGE": "N",
"LAT": "5020392,30",
"LON": "917932,16",
"ZLEVEL": ",",
"ELEVATION": ","
}
],
"ROAD_NAME_FCN": [
{
"NAMES": "GERBNL3202\u001e\u001eGERN\"lant|Stra:|s@ \"tsvaI|?Un|%draI|sIC \"nUl \"tsvaI;GERY\"?El %tsvaI|?Un|\"draI|sIC \"nUI \"tsvaI;GERN\"?El \"tsvaI|?Un|%draI|sIC \"nUl \"tsvaI;GERN\"lant|Stra:|s@ %draI|taU|z=nt|%tsvaI|hUn|d6t|\"tsvaI\u001dGERBNFreigerichter Straße\u001e\u001eGERY\"fraI|g@|%rIC|t6 \"Stra:|s@"
}
]
}
}
]
}Link to demo
To see an interactive demo, follow this link: https://demo.support.here.com/examples/v3.1/map_attributes_path
Besides the input parameters of HERE Map Attributes API v8, this demo accepts as input a GET request submitted to the HERE Routing API v8 or two sets of coordinates (origin and destination of the route). The demo then extracts the relevant data from the response returned by the HERE Routing API.
Response attributes are associated with layers. To see a list of the available layers and their attributes, access the following URL:
https://smap.hereapi.com/v8/maps/layers/list.html?&apiKey=API_KEYUpdated 3 days ago