I am using HERE api to get information about geographic points. In my request I ask for multiple layers and for all of them I get information, expect for most of my points when I try to read the LINK_ATTRIBUTE2 layer, it says it is undefined:
let linkObject = routeLinks.get(linkId);
...
let linkAttribute2Group = linkObject.attributes['LINK_ATTRIBUTE2_FCN'][0];
The error:
(node:103736) UnhandledPromiseRejectionWarning: TypeError: Cannot read property '0' of undefined
The attributes part of my request looks like this:
attributes=ADAS_ATTRIB_FCn(HPX,HPY,HPZ,SLOPES,HEADINGS,CURVATURES,REFNODE_LINKCURVHEADS,NREFNODE_LINKCURVHEADS),LINK_ATTRIBUTE_FCn(ISO_COUNTRY_CODE,VEHICLE_TYPES,URBAN,TRANSPORT_VERIFIED,TO_REF_NUM_LANES,FROM_REF_NUM_LANES),LINK_ATTRIBUTE2_FCn(FOUR_WHEEL_DRIVE,SCENIC_ROUTE,PARKING_LOT_ROAD,PARKING_AVAILABILITY,PRIORITY_ROAD,CARPOOL_ROAD,REVERSIBLE,EXPRESS_LANE,TRANSITION_AREA,EXPANDED_INCLUSION,DELIVERY_ROAD,TRUCK_ROAD_TYPE,BICYCLE_ACCESS,BICYCLE_PROTECTION_TYPE,BICYCLE_TRAVEL_DIR_OVERRIDE,SURFACE_TYPE,GENERALISED_BICYCLE_PATH),TRAFFIC_SIGN_FCn(VEHICLE_TYPES,TRAFFIC_SIGN_TYPE)
Why does HERE return undefined for a group of requested attributes? Is it because it does not have these information? I couldn't find anywhere in the documentation that the layer attribute group can be undefined. I saw that paticular attributes in layer are nullable, but not the whole layer attribute group.
Yes, it is possibility that link ID doesn't return any attribute for the specified layer(if it is incorrect or not coded in the map or doesn't exist). Would it be possible for you to share the specific link ID so that we can check the detail for it from the (linkObject).