Page 1 of 1

How to gather BCR file from xServer to trigger guided navi?

Posted: Wed Feb 05, 2020 10:44 am
by Bernd Welter
Hi there,

as you know the PTV Navigator is able to use a so-called BCR file to guide a driver along a given route - this is what we call "guided navigation". Here's an example of such a string / text. Below the sample I explain different techniques of "how to assemble such a file" based on the output of different engines...
[CLIENT]
ROUTENAME=xServer 2 - guided navigation route export
MAP_VERSION=unknown

[COORDINATES]
STATION1=937170,6270123
STATION2=936043,6274708

[VISITED]
STATION1=0
STATION2=0

[Station2Segmentcenters]
Point1=936972,6269962,238
Point2=936583,6270029,350
Point3=936350,6270099,270
Point4=936080,6270359,0
Point5=934091,6272218,38
  • PTV Developer: Code Sample
  • xRoute2: probably the easiest way. The regular routing method calculateRoute offers a parameter resultFields which enables you to request a complete BCR text (BASE64 encoded): guidedNavigationRoute
  • xRoute1: as this engine does not return a ready-to-be-used BCR you would have to write your own implementation of a BCR converter. Check the section Interface for Guided Navigation in the User Guide Guided Navigation. Or look at the famous PTV xServer Cookbook!
  • MAP&GUIDE Internet: offers a feature where you can send a route straight to a PTV Navigator device once you defined the connection between M&G and the device based on the device ID.
  • Other engines: probably same as with xRoute1- at least if the engine offers the required input such as coordinates.
Best regards,
Bernd

Re: How to gather BCR file from xServer to trigger guided navi?

Posted: Wed Sep 20, 2023 2:13 pm
by Bernd Welter
I've jst been asked by some client about how to get this nice BCR string displayed in the post.
Well, here's what you should be aware of when you use xRoute2.calculateRoute / RouteResponse:
  • gather the byte array given in guidedNavigationRoute
  • Transform the byte array through

    Code: Select all

            public static string getBcrFromByteArray(byte[] bytes)
            {
                return Encoding.UTF8.GetString(bytes).Replace("\n", "\r\n");
            }
    
Does this help? Works fine in my C# driven samples... Maybe you need to look for similar libs in your programming language.