Can't decode base64 string in OpenLR spec
In the OpenLR whitepaper at page 116 an example binary location reference encoded in base64 is provided, namely the following:
CwRbWyNG9RpsCQCb/jsbtAT/6/+jK1lE=
If I input this string in your demo website it doesn't work, nothing happens.
Sending the request directly to the API this is the result:
$ http GET http://openlr-api.itinero.tech/planet/decode\?data\=CwRbWyNG9RpsCQCb/jsbtAT/6/+jK1lE\=
HTTP/1.1 500 Internal Server Error
Cache-Control: private
Connection: close
Content-Type: application/json; charset=utf-8
Date: Wed, 21 Feb 2018 10:54:53 GMT
Link: </decode.xml>; rel="application/xml"
Server: Microsoft-IIS/8.5
Vary: Accept
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
{
"details": "Nancy.RequestExecutionException: Oh noes! ---> System.Exception: No candidates found for LRP: Could not resolve a point at the location.\r\n at OpenLR.Referenced.Codecs.CoderExtensions.FindCandidateLocationsFor(Coder coder, LocationReferencePoint lrp, Single maxVertexDistanceInMeter, Single candidateSearchBoxSize)\r\n at OpenLR.Referenced.Codecs.CoderExtensions.FindCandidatesFor(Coder coder, LocationReferencePoint lrp, Boolean forward, Single maxVertexDistance)\r\n at OpenLR.Referenced.Codecs.ReferencedLineCodec.Decode(LineLocation location, Coder coder)\r\n at OpenLR.API.Coding.CodingModule.DoDecode(Object _)\r\n at Nancy.Routing.Route.<>c__DisplayClass4.<Wrap>b__3(Object parameters, CancellationToken context)\r\n --- End of inner exception stack trace ---\r\n at Nancy.NancyEngine.InvokeOnErrorHook(NancyContext context, ErrorPipeline pipeline, Exception ex)",
"message": "Something went horribly, horribly wrong while servicing your request.",
"statusCode": 500
}
Any clues?
This could be caused by:
- A bug in the OpenLR code.
- The location is just an example and doesn't represent a real part of the road network.
- The OSM data at the location isn't up-to-date.
It's possible to convert the raw data to, for example, GeoJSON and you can then see what's in it.
My bad, it looks like the location is not entirely part of the road network.
http://bl.ocks.org/d/d07e2ca6747e983df22d50e15a7b2a41
Ok, no worries, I'm glad it's not bug in the code because I'm sure there are some left in there... 👍
And the API is just setup as a demo, so don't use it in any actual real-world scenario's... :-)