RouteList

Top  Previous  Next

function RouteList(filename: string; tspmode,listmode,listnum,concatmode: integer; offroadspeed: double; Starttime: Tdatetime; timeformat: integer; vialist: boolean; roadnameID: integer; var distance,time: double): integer;

 

This function allows you to enter a list of nodes, locations or positions and have a route calculated, that passes through all of them and have the result generated in various ways, ready to be shown on a map. It includes the option of doing travelling salesman optimization and creating driving directions at the same time, making it much easier to get very complex results generated by just specifying a number of parameters.

 

The parameters are explained here, one by one:

 

Output filename

This is fully qualified filename with path. As usual don't specify the extension as that is determined by the GISformat property.

 

TSPmode

This defines how the routing points are connected. In case of optimization, the TSP2 function is used and most of the parameters are also the same as for that function. Only 3 and 4 are new:

 

0: Optimization, start - end

1: Optimization, round-trip

2: Optimization, start - no fixed end

3: No optimization, start-end

4: No optimization, round-trip

10: Optimization, start - end (straight line distances used in optimization)

11: Optimization, round-trip (straight line distances used in optimization)

12: Optimization, start - no fixed end (straight line distances used in optimization)

 

Listmode

This defines the type of input for the routing points:

1: Nodelist

2: Locationlist (dynamic segmentation)

3: Positionlist (dynamic segmentation)

 

If you use mode 3, the positions will be translated into locations as part of the function call (and overwrite anything on the Locationlist). In the output you will see a section from the road and to the exact position. This part is referred to as "off-road" and the speed is defined by setting parameter offroadspeed (see below).

 

Listnum

Number of routing points on the list - refers to parameter above.

 

Concatmode

This describes how the GIS objects should be concatenated:

1: With all road segments between routing points as 1 record

2: With off-road segments separately

3: Driving directions

4: With all segments separately

 

Offroadspeed

This is for use with listmode 3. If this is zero and listmode=3, it is effectively the same as listmode=2, but you don't have to call the coordinate2location function yourself, making the setup a bit easier.

The value should be expressed as either km/h or mi/h depending on the configuration file.

 

Starttime

You can use this parameter to define, when the route starts and have a timestamp on all records, which tells when that exact section of the route is entered. Format is a fraction of a day (11:23 = 11/24 + 23/(24*60) = 0.4743055). The integer part of the argument is not used unless timeformat=3.

 

Timeformat

This specifies the format for the timestamp field:

0: Skip timestamp field in output

1: 24 hour format (H:mm)

2: AM/PM (h:mm)

3: Unformatted floating point number - time of day.

 

At midnight the time wraps for (1) and (2), so "23:59" is followed by "0:00" and "0:01". If you prefer to do your own formatting, use (3).

 

Vialist

This is a list that can contain a name and a time for the routing points to be visited on the route. These will be included in the output and the time will be added to the running total. Specify true / false. See function vialistset. If name="" and time=0, the via point will not be included in the output, but will still be used in the routing.

 

RoadnameID

This points to an already loaded database with road names.

You can use 0 as parameter, if no Roadname database has been loaded.

 

Distance

This variable returns the total distance in km or miles.

 

Time

This variable returns the total time in minutes.

 

In order for both distance and time to be returned, you need to call ExtraVarCreate in advance.

 

 

These are additional options, not controlled through RouteList parameters:

 

POI in driving directions output

It is possible to include POI (point-of-interest) in the output, when concatmode = 3. This can be toll stations, petrol stations etc. You can have thousands of POI, but only those on the actual route will be included in the output.

 

This is an example of output:

Description

Distance

Total distance

Road 1

0.2

0.2

Road 2

0.3

0.5

POI

0

0.4

Road 3

0.5

1.0

 

Explanation:

Road 1 is travelled from 0.0-0.2 km

Road 2 is travelled from 0.2-0.5 km

POI is at 0.4 km (on Road 2)

Road 3 is travelled from 0.5-1.0 km

 

See chapter POI Lists on how to add POI.

 

SetApproach

You can define curb approach for the whole route through the seperate function SetApproach. This is only available in Pro version.

 

SharpTurnDrivingDirections

This parameter is defined through setting the corresponding property. If the value is >0, it is possible to trigger a turn description in the output even when the street name doesn't change, but the road makes a clear turn in an intersection. Just define how sharp the turn should be. Suggested value is 60-75 degrees. Please note this only applies to sharp turns in intersections - not halfway down a link.

 

 

The routelist function will return 0 if no error occurred.

 

The possible fields of the generated file are these:

ID (only if vialist = true)

LinkID (only when concatmode = 4)

Roadname or vialist name (only when concatmode = 3 or 4)

Time (minutes, 1 decimal after the comma = 6 sec accuracy)

Total time (minutes, 1 decimal after the comma = 6 sec accuracy)

Timestamp (string or float format, uses offset value)

Distance (3 decimals after the comma = meter accuracy)

Total distance (3 decimals after the comma  = meter accuracy)

Speed (1 decimal after the comma)

Turn (integer)

 

Turn is coded this way:

-1: Starting point, if via points are used in output

-2: If next line is a via point

-3: end point, if via points are used in output

0-359: Turning angle

360: Not possible

361-: "Take (value-360). exit from roundabout"

 

Turning angles from 0-359 can be interpreted this way (45 deg for each section):

 

0-22: Straight on

23-67: Slight turn to the left

68-112: Turn to the left

113-157: Sharp turn to the left

158-202: U-turn like

203-247: Sharp turn to the right

248-292: Turn to the right

293-337: Slight turn to the right

338-359: Straight on

 

You are of course welcome to define your own verbal description of turning angles.

 

Some of the fields may be skipped in the output depending on the input parameters.

 

Possible error codes: -10 -30 -33 -38 -40 -49 -55 -56

Versions: Standard Pro

ActiveX / VCL / CLX component: RWcalc