Determining highway direction - openstreetmap

I was wondering if there is a way to get the highway direction of the route.
To be more specific, I am interested in routes on interstate highways in the United States only.
I'll give an example:
Interstate I45 is a north-south highway. When the route is returned, is there a way to know which "direction lane" the route is on?
The problem I'm trying to solve is accessing the rest ares like the one shown on the image here. As you can see, these are two rest areas, each accessible from one direction of the highway.
I would like to display only those accessible from the direction the user is on. I have all the data needed, including if the rest area is on the North/South/East/West direction and I only need the highway direction the route is on.
For obvious reasons, I would like to avoid manually checking if the route just appears to be going northwards.
I checked if this is possible via graphhopper, but it only gives the highway name, without direction. Is it possible to achieve this via Skobbler?

If you are using the TTS instructions (text-to-speech) then in the advice instructions & audio advices you will also receive the "orientation" (coded as a $orientation in the audio config files) - indicating the direction you are driving on a particular highway (south/north, etc.).
The trickier part is that you would have to parse the text instruction to get this information as it's not returned in a separate field (let me know in a comment if this was helpful).

I do not fully understand the original problem but as GraphHopper also returns the geometry for every instruction you should be able to calculate the orientation roughly but easily.
Another more complex approach would be to have a predefined name set associated with the geometry and use the map matching component to find out which highway parts are used in a route.
For obvious reasons,
which obvious reasons? That it is not really going norht south?
Or if something is not possible you always can modify in the code as it is open source or provide a pull request to merge it into the public release (if useful for others) and make it available for the Directions API too.

According to the OSM wiki page Highway Directions In The United States, directions of ways are supposed to be modeled as relation membership roles.
For example, I 75 way 173483918 is a member of the relation 332618 named "I 75 (TN northbound)" with role=north, so it's direction is "north".
The opposite way 173483897 is a member of the relation 332624 named "I 75 (TN southbound)" as role "south".
See more details on the wiki page. Don't know how well established that tagging scheme is, also don't know about router support (Telenav (Scout) seem to be involved in this who now own Skobbler).

Related

Azure Spatial Anchors - How to save and get anchors

I tried the azure-spatial-anchor-demo-package and it worked fine for me. Now I wanted to use azure in my project. In my current understanding, the coordinates of the anchor are stored. More precise information about whether it is a 3D object, and what it looks like, is not stored. If I'm wrong about this, please correct me.
Lets say I have 3 different objects: a car, house and tree.
All of them are anchors, which I instantiate in my scene. My current procedure is as follows:
_anchorModul.StartAzureSession();
I instantiate a car, house and tree and call for each of them CreateAzureAnchor();:
InstantiatedGo = Instantiate(GoToInstantiate, GetCurrentHitPosition(), Quaternion.FromToRotation(Vector3.back, _gazeProvider.HitInfo.normal)) as GameObject;
_anchorModul.CreateAzureAnchor(InstantiatedGo);
In the method CreateAzureAnchor() I set the type of my object via localCloudAnchor.AppProperties.Add("type", theObject.GetComponent<SomeClass>().Type);.
After that I save the anchors to disk via _anchorModul.SaveAzureAnchorIdToDisk();
But now I want to restart my application and get the objects at the right position. The right order should be:
Restart the application.
Get Azure Anchor from Disk
Start Azure Session
Find Azure Anchor
My Question: How do I get the found anchors, so I can access the properties I set and instantiate the related properties on my three objects?
My Specs:
Unity 2019.2.15
MRTK 2.2
AzureSpatialAnchors.unitypackage
MRTK.HoloLens2.Unity.Tutorials.Assets.AzureSpatialAnchors.2.2.0.0.unitypackage
MRTK.HoloLens2.Unity.Tutorials.Assets.GettingStarted.2.2.0.1.unitypackage
You need to make a request to the Azure service to locate an anchor using at least one of the ids saved. You can either send an array of ids or send one and ask for the nearby anchors.

IBM Chatbot Assistant - Array with same values

I have this piece of code in JSON editor of Watson:
"context": {
"array": "<? entities['spare_part'].![literal] ?>",
"array_size": "<?$array.size() ?>"
When the input of the user, for example, is "Hello, I need a valve, and the part number of the valve is 1234", the size of the array ends up being 2 since the user mentions the word "valve" twice in his input. Some nodes are being executed depending on size of the array. For instance if the size of the array is 1, some nodes will be ignored because they are only executed only if the size of the array is 2.
I want the array to store only the inputs with different values, which is basically I don`t want the array to store the values of the same type, in my case 2 valves. If it is possible somehow please show me a way.
All that can be done, but the best approach depends on the overall system architecture. Remember that Watson Assistant is a conversation service, not a data processing platform...
You can process JSON in either Watson Assistant directly using the built-in methods and SpEL, see these links to get started:
- https://console.bluemix.net/docs/services/conversation/expression-language.html#expressions-for-accessing-objects
- http://docs.spring.io/spring/docs/current/spring-framework-reference/html/expressions.html
- https://console.bluemix.net/docs/services/conversation/dialog-methods.html#expression-language-methods
That would require some coding within the dialog nodes. It could be ok. What I would recommend is to either process in your app that drives the dialog (you need that app anyway) or to code up small server actions to transform data.
If it is the word you are looking for, you can use contextual entities to train for this.
As an example I created the following intent (along with general intents from catalog).
For each example I highlighted the "valve" word that is the one I am interested in, and added to the entity.
Now when I test it I get the following.
All this was done in a couple of minutes. For production level you may want to add more examples, or think about how you want to annotate.

Getting routes on openstreetmaps using OSRM

I've been trying to get a list of co-ordinates in a route from point A to B using OSRM with the following request:
GET http://router.project-osrm.org/viaroute?hl=en&loc=47.064970,15.458470&loc=47.071100,15.476760
However, on opening the url, i find the 'via_points' tag containing only two co-ordinates. Surely, that can't be the entire route? Anything I'm missing here? Is there any other way of generating the list of route co-ordinates with OSRM? Thanks
The route is contained in the route_geometry object. It is an encoded polyline. If you don't want to uncompress it yourself you can disable compression via compression=false:
http://router.project-osrm.org/viaroute?compression=false&hl=en&loc=47.064970,15.458470&loc=47.071100,15.476760
Not sure what the via_points contains. OSRM's documentation seems to be outdated. Maybe they are just your start and end points snapped to the nearest road or something similar.

Getting distance between 2 markers

I would like to get the distance between 2 markers but not as a direct line, more as a real path like it goes in this plugin -
https://github.com/perliedman/leaflet-routing-machine
I didn't find anything about using this plugin in the directive: angular-leaflet-directive,
if someone can guide how to make it done, it would be very appreciated.
thanks!
I am not sure if you specifically want to use leaflet routing machine to get distances... but if you do, maybe this info can get you started:
Set up a route on your map based on this example by the leaflet routing machine author:
https://www.liedman.net/leaflet-routing-machine/tutorials/interaction/
If you look at that example, there is an array called routes. Each route has some basic statistics associated with it, generated by OSRM. You can pull them by calling for example:
routes[0].summary.totalDistance
or
routes[0].summary.totalTime
Then you can do whatever you want with them. If you dig through the code on GitHub you can see more about how the data are moved around within the plugin and why the array is arranged that way:
https://unpkg.com/leaflet-routing-machine#3.2.12/dist/leaflet-routing-machine.js

Restlet routing

I'm trying to work out the best/most performant/easiest to maintain version for handling many different URLs in restlet.
eg, if I want to have an Item resource, is there a better way to do it than this?
router.attach("/items", ItemResource.class);
router.attach("/item/{itemid}", ItemResource.class);
router.attach("/items/list", ItemResource.ItemListResource.class);
router.attach("/items/weapons", ItemResource.WeaponListResource.class);
router.attach("/items/armours", ItemResource.ArmourListResource.class);
...
(I tried with having /items/{itemid}, but then /items/weapons etc could not be accessed.)
ItemResource then has #Get for fetching a single item, but also has #Put for saving an item when just /items is used. Something feels a bit wrong here... Is there a better way to have fetching/inserting/updating/listing for items in this case?
Also, this router.attach list is very long, 100 or so items. Since this has to be run through on every request it would probably be fairly slow. I know I can attach multiple routers together in a chain - but I can't find documentation on how to do this nicely. What's the best way to chain routers and keep them maintainable?
Just put the
router.attach("/item/{itemid}", ItemResource.class);
on the lowest part of the routing, since it will catch all path parameters, so before it matches everything, rout the typed path first. This should fix it based on my experience.