Nick11
Nick11

Reputation: 3

HERE-API: Determine direction of crossing streets from adjacent linkID information [update]

I am currently trying to figure out, if for a given route, a street is crossing form the left side or the right side of my route. I got the LinkID Information from the adjacent link. Is there a simple way to determine, in why direction the link is heading from the drivers POV?

I tried the following. 1) Determined the route using GPS points, and determine the REF_NODE_NEIGHBOR_LINKS and NONREF_NODE_NEIGHBOR_LINKS using the LINK_FCn attributes: https://pde.api.here.com/2/calculateroute.json?mode=car;shortest;traffic:enabled&departure=now&attributes=LINK_FCn(*)&app_id={appid}&app_code={appcode}&linkattributes=DynamicSpeedInfo&routeMatch=1&waypoint0=....&waypoint99=...

  1. Determine the GPS Coordinates of the Neighbor Links by using their LinkIDs in: https://route.ls.hereapi.com/routing/7.2/calculateroute.json?apiKey={apiKey}&representation=linkPaging&linkattributes=fc&waypoint0=link!...mode=car;shortest;traffic:enabled Since the Link Shapes are returned from each Link.

  2. build a route using, using the GPS coordinates, that were returned in step 2. The request is the same as in step 1), now with the newly aquired waypoints from step 2. It should in theory return a chaotic route, that includes all the neighbor Links of the original route. I know, it is quite complicated, but I need the LINK_FCn attributes of each link, and I don't know how to get them, aside from building a route and using the request from step 1.

I hope there is a much simpler way to get the LINK_FCn attributes for standalone links, other than what I did.

Upvotes: 0

Views: 344

Answers (1)

user3505695
user3505695

Reputation:

Solution doesn't exist out of box.

Better if you utilize RME HERE Route Matching 8: https://developer.here.com/documentation/route-matching/api-reference.html

And

Map Attributes API v8: https://developer.here.com/documentation/content-map-attributes/api-reference.html

1.Send POST request like in Postman collection:

{
    "info": {
        "_postman_id": "ac909f42-fd17-4828-9eed-29504b5304e3",
        "name": "RME_dir",
        "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
        "_exporter_id": "1051680"
    },
    "item": [
        {
            "name": "direction",
            "request": {
                "method": "POST",
                "header": [],
                "body": {
                    "mode": "raw",
                    "raw": "LATITUDE,LONGITUDE\r\n53.38033388,-1.466708518\r\n53.38051677,-1.466619881\r\n53.38113146,-1.466989795\r\n53.38123316,-1.467038024\r\n53.38153622,-1.466477674\r\n53.38158782,-1.466302653\r\n53.38251095,-1.465818564\r\n53.38298113,-1.465874184"
                },
                "url": {
                    "raw": "https://routematching.hereapi.com/v8/match/routelinks?apikey=YvyzQj_mHm9GrLNFIJH7pWapPkJAdta5XR-JotW7T5o&routeMatch=1&mode=fastest;car;traffic:disabled;&attributes=LINK_FCn(*)",
                    "protocol": "https",
                    "host": [
                        "routematching",
                        "hereapi",
                        "com"
                    ],
                    "path": [
                        "v8",
                        "match",
                        "routelinks"
                    ],
                    "query": [
                        {
                            "key": "apikey",
                            "value": "YvyzQj_mHm9GrLNFIJH7pWapPkJAdta5XR-JotW7T5o"
                        },
                        {
                            "key": "routeMatch",
                            "value": "1"
                        },
                        {
                            "key": "mode",
                            "value": "fastest;car;traffic:disabled;"
                        },
                        {
                            "key": "attributes",
                            "value": "SPEED_LIMITS_FCn(*),LINK_ATTRIBUTE_FCn(*),TRAFFIC_PATTERN_FCn(*),TRUCK_SPEED_LIMITS_FCn(*),SPEED_LIMITS_VAR_FCn(*),SPEED_LIMITS_COND_FCn(*) ",
                            "disabled": true
                        },
                        {
                            "key": "attributes",
                            "value": "LINK_FCn(*)"
                        }
                    ]
                }
            },
            "response": []
        }
    ]
}

2.Search in a response the 'leg' and loop over links.

Linkid with "-" (negative) means To Reference Node but without "-" (positive) means From Reference Node, from LINK_FC you know where is RefNode and NoNRefNode: So you can recognize a direction of driver.

3.Determine to which tileIds and to which functional class belongs all neighbor links (REF_NODE_NEIGHBOR_LINKS and NONREF_NODE_NEIGHBOR_LINKS getting above):

https://smap.hereapi.com/v8/maps/index.json?layer=ROAD_GEOM_FCn&attributes=LINK_ID&values=1214906732,1215056670,30087535,1076141132,1118335023&apikey=YvyzQj_mHm9GrLNFIJH7pWapPkJAdta5XR-JotW7T5o

4.From above response set tileIds to 'in' parameter and set accordingly FC number to 'layers' parameter:

https://smap.hereapi.com/v8/maps/attributes.json?layers=LINK_FC5,LINK_FC2&in=tile:105766770,1651694&apikey=YvyzQj_mHm9GrLNFIJH7pWapPkJAdta5XR-JotW7T5o

In the response of above request you can now find all adjacent links.

5.When you will have geometries of route links and their adjacent links and you know the direction of route and you know "ENTER_ANGLE" & "LEAVE_ANGLE", then you can calculate which link is on left or on right sides - this is a geometry task: unfortunately I don't know how to resolve it.

Upvotes: 1

Related Questions