How to use osrm properly - gps

I am having a route consisting of 2 points
I would like to find all GPS coordinates in the route but I want get GPS coordinate every 4 km... Is this possible please? I am lost here, I want to use this:
https://github.com/Project-OSRM/osrm-backend/blob/master/docs/http.md
What I tried is used route service
http://router.project-osrm.org/route/v1/driving/49.209243,18.757936;48.158645,17.106259?steps=false&geometries=geojson&overview=full&annotations=true
But How to specify the distance? or at least how could I specify I want only 40 GPS points? Thank you.

I don't think you can specify how many points you want returned, or how far apart they should be. I believe you would need to perform this operation in your own code after requesting ALL the points from OSRM. Because you have specified annotations=true in your request you will receive data about the distance for each Waypoint. Using this you should be able to process the data to only contain one Waypoint every 4km.

Related

Mapbox API requests for Static Map and Polyline

I'm rewording a question I asked earlier in hopes that it will get me some feedback.
I need to generate a static map from Mapbox that shows two end points and the polyline route between them. The method outlined below is what I'm using. It sometimes works and sometimes doesn't--and that is what's driving me crazy.
First, I use the two GPS end points to make an API request that generates the polyline. Then I use a second API request with the two end points and the polyline to generate the static map. The first part always seems to work. I get an encoded polyline that I can run through an online decoding tool and it shows the various points along the path just fine, but the second step to generate the map from Mapbox sometimes gives me the expected map and sometimes gives me an error code. The code is usually {"message":"Not Found"}, but sometimes I get a {"message":"Not Authorized - No Token"} error code.
I use this API with the two end points to get a JSON file that has a polyline:
https://api.mapbox.com/directions/v5/mapbox/driving/POINT1;POINT2?access_token=TOKEN
Then, once I have the polyline, I am using this API to generate the map:
https://api.mapbox.com/styles/v1/mapbox/streets-v11/static/pin-s-a+9ed4bd(POINT1),pin-s-b+000(POINT2),path-5+f44-0.5(POLYLINE)/auto/500x300?access_token=TOKEN
This works fine...
Point 1 = -87.321536,36.584454
Point 2 = -104.793676,38.749513
Polyline = }kh~Ez{}sO|HUuHmj#uhHbOyAla#kisAdelC|aMf~w#egO|uaAahfBr{|#w_#sAozkCcwFsp#v]__w#hjFjf#bdCkaJhmzAiyXtzb#fJ|{#{p[|~yErtBdacE{x^vkvHrZfuKo[tpBfxSrcuBocGpi_AqhCvjb#wgAvfsDhyc#fkrD~mD~bkDayD~ywCsui#vjmEoyBpk|AiOhHrvEdueApda#huoA|v[zuhFsySvwaAvbDwqHxXpwDYj#riJULheEfXh^tdAj~I^gIhAkEY~#kHseBlGyC^kA
Map API request = https://api.mapbox.com/styles/v1/mapbox/streets-v11/static/pin-s-a+9ed4bd(-87.321536,36.584454),pin-s-b+000(-104.793676,38.749513),path-5+f44-0.5(}kh~Ez{}sO|HUuHmj#uhHbOyAla#kisAdelC|aMf~w#egO|uaAahfBr{|#w_#sAozkCcwFsp#v]__w#`hjFjf#bdCkaJhmzAiyXtzb#fJ|{#{p[|~yErtBdacE{x^vkvHrZfuKo[tpBfxSrcuBocGpi_AqhCvjb#wgAvfsDhyc#fkrD~mD~bkDayD~ywCsui#vjmEoyBpk|AiOhHrvEdueApda#huoA|v[zuhFsySvwaAvbD`wqHxXpwDYj#riJULheEfXh^tdAj~I`^gI`hAkEY~#kHseBlGyC^kA)/auto/500x300?access_token=TOKEN
Map (yay!)
This does not work...
Point 1 = -87.321536,36.584454
Point 2 = -85.855218,37.690038
Polyline = }kh~Ez{}sO|HUtCurC}xCkhC}~BqvIuc_#o~l#oaI}aUrs#kkL}~Iso\qHoyGsiKaTpQcRdlGusK_DEiz#w^cwOakJurAizT{hCugF_bBenSsOclZkdCw]mgEwyDogLgfBatEubCmkGxa#icLe_Do_Spf#cw]}sEgOaDgT{[zFyIk~Bts#
Map API request = https://api.mapbox.com/styles/v1/mapbox/streets-v11/static/pin-s-a+9ed4bd(-87.321536,36.584454),pin-s-b+000(-85.855218,37.690038),path-5+f44-0.5(}kh~Ez{}sO|HUtCurC}xCkhC}~BqvIuc_#o~l#oaI}aUrs#kkL}~Iso\qHoyGsiKa`TpQcRdlGusK_DEiz#w^cwOakJurAizT{hCugF_bBenSs`OclZkdCw]mgEwyDogLgfBatEubCmkGxa#icLe_Do_Spf#cw]}sEgOaDgT{[zFyIk~Bts#)/auto/500x300?access_token=TOKEN
No Map :-(
This is a small part of a much bigger project where I am automating the process for generating project reports, but the problem isn't with my jQuery/AJAX code. It's a problem with my APIs and/or Mapbox. If there is a better/faster/easier way to get these maps, then I am absolutely open to suggestions, because this does not seem like the most efficient way to do it. I will be generating these reports from a computer. I am not worried about bandwidth or scaling down for a phone application. The file can be as cumbersome as it wants to be as long as I can consistently generate a map every time.
Steve's comment hints at the right solution, but just to make it absolutely clear - this is happening because you are not properly encoding the path polyline in your request. Polylines in particular have a nasty habit of including reserved characters that will break URIs unless properly encoded at the time of the request.
When I encode the polyline portion of your path overlay with a simple tool like url encode decode, I'm able to make your request work as expected:
https://api.mapbox.com/styles/v1/mapbox/streets-v11/static/pin-s-a+9ed4bd(-87.321536,36.584454),pin-s-b+000(-85.855218,37.690038),path-5+f44-0.5(%7Dkh~Ez%7B%7DsO%7CHUtCurC%7DxCkhC%7D~BqvIuc_%40o~l%40oaI%7DaUrs%40kkL%7D~Iso%2FqHoyGsiKa%60TpQcRdlGusK_DEiz%40w%5EcwOakJurAizT%7BhCugF_bBenSs%60OclZkdCw%5DmgEwyDogLgfBatEubCmkGxa%40icLe_Do_Spf%40cw%5D%7DsEgOaDgT%7B%5BzFyIk~Bts%40)/auto/500x300?access_token=MAPBOX_ACCESS_TOKEN
⚠️ disclaimer: I currently work at Mapbox ⚠️

How to Use Correlation Sets with multiple Receive Shapes in BizTalk Orchestration

My scenario is:
There are four txt-files created in a source-folder at the same time. They should be mapped to four xml-files. Then one of the xml-files should be sent to a remote Web Service and, if it was received properly, a response containing a "replacement-id" is coming back. And if so, finally, the replacement-id is mapped into the other three xml-files before they are sent to the Web Service.
I'm trying to control all the flow in one single orchestration. In my BizTalk Server Project I have all the schemas and maps that is needed. Since there must be four Receive Shapes in the Orchestration I understand I must deal with Correlation sets. There is one (date) field that is common to all the input txt-files and have the same unique value in each file. I assumed that this field could be used in a Correlation Set. But how is that done?
I've found questions on similar cases on forums but not yet found any answer that gives me the right clue to this case.
I tried this:
• promoted the common field in all the files (a Property Schema was created for me)
• created a Correlation Type based on the Property Schema
• created a Correlation Set based on the Correlation Type
• in the first Receive Shape: set Initializing Correlation Sets = my Correlation Set
• in the other Receive Shapes: set Following Correlation Sets = my Correlation Set
• the first Receive Shape has also Active = true and the others = false
This don’t work however. On building the solution I get errors telling that my Correlation Set does not exist in the messages I use as input to the mappings. The “blocking stone” is that I don’t seem know how to use Correlation Sets the right way to solve a Multiple-Receive-Shape problem. (Hope that calling the Web Service and mapping the replacement-id won’t be a problem when I get that far.) Would be glad if someone could correct the list of steps or put me on the right road if I’m completely wrong.

How to visualize GPS coordinates on a map using Node red?

I'm trying to track the location of an object/vehicle for this, I'm using a GY-GPS6MV2 module for getting GPS coordinates. I'm streaming those values to Bluemix - Internet of Things cloud platform and trying to visualize the data on maps from node red using the WorldMap node. But while doing so I couldn't map them on the OpenStreetMap.
I have gone through the documentation on WorldMap node. But couldn't get the insights which are useful for me. Can you please help in this context?
Link :WorldMap NodeRed
From the worldmap node docs:
Usage
Plots "things" on a map. The map will be served from
{httpRoot}/worldmap
The minimum msg.payload must contain name, lat and lon properties,
e.g.
{name:"Joe", lat:51, lon:-1.05}
name must be a unique identifier across the whole map. Repeated location updates to the same name move
the point.
At the moment your msg.payload is a string with lat, then 2 new lines and then the lon value. You need to build a msg.payload that matches what's in the doc. This is probably best done directly from the output of the IBM IoT node as it looks to already be a JSON object which will make it easier to extract the correct values.

Getting user's location once, and only once

My app needs to know the rough location of a user, with a resolution of their state/province. This way we know what the default tax rate should be in a simple tax calculator. They can still pick it after that, but its always nice to try to get it right.
Is there an easy way to get this sort of resolution without all the rigamarole of callbacks and such? I don't need updates, a single rough location will do, and an old one is likely perfectly fine.
There are no short simple ways to get current location.
That means that you need init CLLocationManager object, call startUpdatingLocation method and retrieve result in delegate method.
It's impossible to get current location synchronously by using one line of code because retrieving location info could take much time (For example turning on GPS sensor and so on.). That's why you get info by asynchronous delegate methods.
is the only way,
but to get a single user position
within the method locationManager:didUpdateLocations: call stopUpdateLocation:
[locationManager stopUpdatingLocation]

WCF Paged Results & Data Export

I've walked into a project that is using a WCF service for the data tier. Currently, when data is needed for a grid, all rows are returned and the results are bound to a grid and the dataset is stuffed into a session variable for paging/sorting/rebinding. We've already hit a max message size problem, so I'm thinking it's time to convert from fetch and cache to fetch only the current page.
Face value this seems easy enough, but there's a small catch. The user is allowed to export the entire result set at any point. This means that for grid viewing purposes fetching the current page is fine, but when they want to do an export, I still need to make a call for all data.
This puts me back into the max message size issue. What is the recommended approach for this type of setup?
We are currently using the wsHttpBinding...
Thanks for any assistance.
I think the recommended approach for large files is to use WCF streaming. I'm not sure the exact details for your scenario, but you could take a look at this as a starting point:
http://msdn.microsoft.com/en-us/library/ms789010.aspx
I would probably do something like this in your case
create a service with a "paged" GetData() method - where you specify the page index and the page size as additional parameters. This should give you a nice clean interface for "regular" use, and that should not hit the maxMessageSize limits
create a second service (or method) that would send all data - ideally, you could bundle that up into a ZIP file or something on the server, before sending it. If that ZIP file is still too large, you might want to check out WCF streaming for handling large files, as Andy already pointed out
The maxMessageSizeLimit is in place for a good reason: to avoid Denial of Service attacks where a WCF service would just get flooded with large messages and thus brought to its knees. If you can, always try to keep that in mind and don't just jack up the maxMessageSize to 2 GB - it might come back to bite you :-)