Usa calculate Tolls cost using here maps - here-api

Using this example https://developer.here.com/documentation/toll-cost/topics/example-tollcost.html
and description from here https://developer.here.com/documentation/toll-cost/topics/resource-tollcost-input-interface.html trying to calculate tolls on usa roads
First found paid road to be sure to have it on the route - found here https://www.sixt.com/toll-roads/usa/ - rout in Florida from Punta Gorda, FL, United States to Islamorada, FL, United States
From route received two links
0: {linkId: "-91500228", mappedPosition: {latitude: 26.9336687, longitude: -82.0531188},…}
1: {linkId: "+897488196", mappedPosition: {latitude: 24.9598652, longitude: -80.5699824},…}
Then do tolls request
https://tce.api.here.com/2/tollcost.json
?app_id=my_app_id
&app_code=my_code
&tollVehicleType=3
&vehicleNumberAxles=2
&emissionType=6
&height=3.5m
&vehicleWeight=10.0t
&limitedWeight=10.0t
&passengersCount=1
&tiresCount=8
&route=-91500228;897488196
&detail=1
In response always receive:
{"errors":[],"warnings":[{"category":1,"context":"Old response format is deprecated, please use request parameter &rollup"}],"countries":[],"onError":false}
Tried different locations in usa, no matter what - always empty countries array
Please advice what I'm missing, thank you

Here is a working example:
https://tce.cit.api.here.com/2/calculateroute.json?jsonAttributes=41&waypoint0=26.13442,-81.68696&detail=1&waypoint1=26.08104,-80.36682&routelegattributes=li&routeattributes=gr&maneuverattributes=none&linkattributes=none,rt,fl&legattributes=none,li,sm&currency=EUR&departure=&tollVehicleType=3&emissionType=5&height=3.8m&vehicleWeight=11000&limitedWeight=11t&passengersCount=1&tiresCount=4&commercial=1&heightAbove1stAxle=1m&width=2.55&length=10&mode=fastest;truck;traffic:enabled&rollup=none,country;tollsys&app_id=yyy&app_code=xxx
In general is the parameter rollup missing in your request. This one need to be added in any case. Besides of that is the route you try to calculate quite far over islands with a truck with a specific size and weight. It is quite difficult to get an idea within the pure HTTPRest request. Maybe this demo page helps a bit for debugging such cases:
https://tcs.ext.here.com/examples/v3/route_with_tce

Related

How to interpret "nearest source location" in the cumulativeCost-function of Google Earth Engine?

I am wondering what the documentation of cumulativeCost() in GEE exactly means by "nearest source location".
"nearest" in terms of "the closest starting pixel, linearly computed" or
"nearest" in terms of "the closest in terms of cumulative cost" ?
For my analysis I would like to know if the algorithm already reduces the number of potential routes in advance (by choosing only 1 starting point in advance) OR if it first tries the routes from one pixel to all possible starting points, and then takes the value to the starting pixel with the lowest total cost. Does anyone have more detailed information on how the algorithm works in that case? Thanks.

How do I find the road distance between two locations?

I am using HERE Developer API key. I want to calculate the road distance between 2 lats & longs. Can anybody help me on this with PHP code.
When using the Routing API, if you ask for summary or travelSummary in the result, you get a length result which is in meter. For example:
"travelSummary": {
"duration": 20973,
"length": 619962,
"baseDuration": 20316
},

Possible bug in vehicleWeight parameter for costs calculation in the Here Fleet Telematics Toll Costs Api

In the documentation I see:
vehicleWeight -- Number. Actual total weight of vehicle incl. its payload but NOT the trailers' weight or payload.
For me the truck itself is 12t. While trying to get costs for toll roads with this value, I'm getting distance 470km, costs 58Eur and it is wrong.
So, I want to know what is the problem: 1) documentation error, vehicleWeight should be mass truck+trailer, 2) I missed some extra parameters, 3) or maybe some other issue?
When I tryied to change vehicleWeight from 12t to 20t (truck+trailer mass) the result is correct, about 85Eur.
https://tce.cit.api.here.com/2/calculateroute.json?app_id={app_id}&app_code={app_code}&tollVehicleType=3&trailerType=2&trailersCount=1&vehicleNumberAxles=2&trailerNumberAxles=2&emissionType=6&height=4.0m&trailerHeight=4.0m&vehicleWeight=12t&limitedWeight=20t&tiresCount=10&commercial=1&cost_optimize=0&driver_cost=0.0&vehicle_cost=0.0&currency=EUR&rollup=country;tollsys&waypoint0=geo!stopOver!49.4889567,10.978884&waypoint1=geo!passThrough!50.1211273,8.4961394&waypoint2=geo!stopOver!51.2383707,6.6739259&mode=fastest;truck;traffic:disabled&vehicleType=diesel,28
I expect to get here about 85Eur (because distance is about 470km and price for Euro 6, >18t, 4 axles is 0.187cents/km), but actually API returning about 58Eur.
Thank you for reporting this issue. It seems that there was an issue and we could solve it already. Within the next release planned for February this will be solved.

Bayesian networks for text analysis in R

I have one page story (i.e. text data), I need to use Bayesian network on that story and analyse the same. Could someone tell me whether it is possible in R? If yes, that how to proceed?
The objective of the analysis is - Extract Action Descriptions from
Narrative Text.
The data considered for analysis -
Krishna’s Dharam-shasthra to Arjuna:
The Gita is the conversation between Krishna and Arjuna leading up to the battle.
Krishna emphasised on two terms: Karma and Dharma. He told Arjun that this was a righteous war; a war of Dharma. Dharma is the way of righteousness or a set of rules and laws laid down. The Kauravas were on the side of Adharma and had broken rules and laws and hence Arjun would have to do his Karma to uphold Dharma.
Arjuna doesn't want to fight. He doesn't understand why he has to shed his family's blood for a kingdom that he doesn't even necessarily want. In his eyes, killing his evil and killing his family is the greatest sin of all. He casts down his weapons and tells Krishna he will not fight. Krishna, then, begins the systematic process of explaining why it is Arjuna's dharmic duty to fight and how he must fight in order to restore his karma.
Krishna first explains the samsaric cycle of birth and death. He says there is no true death of the soul simply a sloughing of the body at the end of each round of birth and death. The purpose of this cycle is to allow a person to work off their karma, accumulated through lifetimes of action. If a person completes action selflessly, in service to God, then they can work off their karma, eventually leading to a dissolution of the soul, the achievement of enlightenment and vijnana, and an end to the samsaric cycle. If they act selfishly, then they keep accumulating debt, putting them further and further into karmic debt.
What I want is - post tagger to separate verbs, nouns etc. and then create a meaningful network using that.
The steps that should be followed in pre-processing are:
syntactic processing (post tagger)
SRL algorithm (semantic role labelling of characters of the story)
conference resolution
Using all of the above I need to create a knowledge database and create a Bayesian network.
This is what I have tried so far to get post tagger:
txt <- c("As the years went by, they remained isolated in their city. Their numbers increased by freeing women from slavery.
Doom would come to the world in the form of Ares the god of war and the Son of Zeus. Ares was unhappy with the gods as he wanted to prove just how foul his father’s creation was. Hence, he decided to corrupt the mortal men created by Zeus. Fearing his wrath upon the world Zeus decided to create the God killer in order to stop Ares. He then commanded Hippolyta to mould a baby from the sand and clay of the island. Then the five goddesses went back into the Underworld, drawing out the last soul that remained in the Well and giving it incredible powers. The soul was merged with the clay and became flesh. Hippolyta had her daughter and named her Diana, Princess of the Amazons, the first child born on Paradise Island.
Each of the six members of the Greek Pantheon granted Diana a gift: Demeter, great strength; Athena, wisdom and courage; Artemis, a hunter's heart and a communion with animals; Aphrodite, beauty and a loving heart; Hestia, sisterhood with fire; Hermes, speed and the power of flight. Diana was also gifted with a sword, the Lasso of truth and the bracelets of penance as weapons to defeat Ares.
The time arrived when Diana, protector of the Amazons and mankind was sent to the Man's World to defeat Ares and rid the mortal men off his corruption. Diana believed that only love could truly rid the world of his influence. Diana was successfully able to complete the task she was sent out by defeating Ares and saving the world.
")
writeLines(txt, tf <- tempfile())
library(stringi)
library(cleanNLP)
cnlp_init_tokenizers()
anno <- cnlp_annotate(tf)
names(anno)
get_token(anno)
cnlp_init_spacy()
anno <- cnlp_annotate(tf)
get_token(anno)
cnlp_init_corenlp()

R geocode query error when address has hash

An address containing a "#" (for example an apartment number) frequently gives an incorrect location result, both with ggmap::geocode and with google maps as well, so this is not strictly an R question. In this example, adding a "#3" after the street address changes the location result from Illinois to California:
> test <- geocode('1200 Davis St, Evanston, IL 60202', source='google', output='more')
> test[, c('lon', 'lat', 'administrative_area_level_1')]
lon lat administrative_area_level_1
1 -87.68978 42.04627 Illinois
> testhash <- geocode('1200 Davis St #3, Evanston, IL 60202', source='google', output='more')
> testhash[, c('lon', 'lat', 'administrative_area_level_1')]
lon lat administrative_area_level_1
1 -122.1692 37.72169 California
If you experiment with google maps directly, sometimes adding a hash into an address seems to confuse the lookup, generating a variety of geographically dispersed results. This doesn't always happen, but in my experience happens frequently. It's easily fixed (there's no need for an apartment number when geocoding) but I'm wondering why it happens and if there are other cautions about entering addresses.
Google has recommendations in regard to address formatting in Geocoding API. Particularly they suggest do not specify additional elements like apartment number or floor numbers in requests.
You can check the complete list of recommendations in Google Maps FAQ:
https://developers.google.com/maps/faq#geocoder_queryformat
The relevant part is
Do not specify additional address elements such as business names, unit numbers, floor numbers, or suite numbers that are not included in the address as defined by the postal service of the country concerned. Doing so may result in responses with ZERO_RESULTS.
I hope this helps!

Resources