简体   繁体   中英

Using Here route-matching API to find the attributes of the streets using OSMNX in Python

I have a set of GPS coordinates for a trip which is somehow noisy. I want to extract the street attributes (eg., type of street, number of lanes, length, speed limit) on which the driver rode using OSMNX. OSMnx is a Python package that lets you download geospatial data from OpenStreetMap. I am wondering how I can send request to HERE API sending my GPS coordinates as a list of tuples, and receive a set of U,V ID's corresponding to OpenStreetMap street IDs.

I tried to use Python Request package to send a "Post" request to Here route matching API, but I didn't work. I tried to find an example code, but I couldn't find that either.

I don't know about Python but curl command works perfect, if you can transform curl request to Python then it will work for you (please don't forget to set your correct apikey):

curl --location --request POST 'https://routematching.hereapi.com/v8/match/routelinks?routeMatch=1&mode=fastest;car;traffic:disabled;&attributes=SPEED_LIMITS_FCn(*),LINK_ATTRIBUTE_FCn(*),TRAFFIC_PATTERN_FCn(*),TRUCK_SPEED_LIMITS_FCn(*),SPEED_LIMITS_VAR_FCn(*),SPEED_LIMITS_COND_FCn(*),APPLICABLE_SPEED_LIMIT(*),LANE_FCn(*),ROAD_NAME_FCn(*),POINT_ADDRESS(*)&apikey=yourapikey' \
--header 'Content-Type: text/plain' \
--data-raw 'LATITUDE,LONGITUDE
53.3737131,-1.4704939
53.3742428,-1.4677477
53.3745646,-1.467576
53.3758092,-1.4665675
53.3765066,-1.4645076
53.3750689,-1.4637029
53.3745968,-1.4630377
53.3738351,-1.4672971
53.37275319,-1.473253781
53.37296063,-1.473458358
53.37317601,-1.473573578
53.3734015,-1.473591359
53.37364231,-1.473555407
53.37382051,-1.473525778
53.37398259,-1.473544385
53.37424653,-1.473552796
53.37444054,-1.473323957
53.37461894,-1.472965559
53.37560366,-1.471516545
53.37612036,-1.471082224
53.37664992,-1.471201825
53.37702013,-1.471195299
53.37725988,-1.47097831
53.37737117,-1.470668778
53.37855999,-1.469833729
53.37852091,-1.469329573
53.37862204,-1.468927756
53.37876223,-1.468789212
53.37892666,-1.468780348
53.38020745,-1.46563088
53.37937367,-1.467046193
53.37962673,-1.465272589
53.37988833,-1.465201122
53.37988833,-1.465201122
53.37988744,-1.466035798
53.37989308,-1.466140205
53.37987924,-1.466296083
53.38021984,-1.466613191
53.38033388,-1.466708518
53.38051677,-1.466619881
53.38113146,-1.466989795
53.38123316,-1.467038024
53.38153622,-1.466477674
53.38158782,-1.466302653
53.38251095,-1.465818564
53.38298113,-1.465874184
53.38304442,-1.464368113
53.3835912,-1.462213339
53.38379501,-1.461524376
53.38384597,-1.461352135
53.38298303,-1.461404355'

Additional docs: https://demo.support.here.com/pde/layers?region=WEU&release=latest&url_root=pde.api.here.com

https://demo.support.here.com/pde/maps?url_root=pde.api.here.com

https://smap.hereapi.com/v8/maps/layers/doc.html?layer=APPLICABLE_SPEED_LIMIT&apikey=yourapikey

https://developer.here.com/documentation/content-map-attributes/api-reference.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM