TurnImportTxt

Top  Previous  Next

This method loads turn restrictions from a text file on disk. Supply a full filename, including folder. It doesn't clear the list of turns first.

 

The format is one or more lines, where each line stores one restriction with parameters stored in space separated format. Different types of restrictions are possible:

 

0: Simple Turn restriction, 2 external link ID's + 1 cost value

1: Simple Turn restriction, 2 link ID's + 1 cost value

2: TurnStandard, coordinates for node

3: Mandatory turn, 2 external link ID's

4: Mandatory turn, 2 link ID's

5: Complex Turn restriction, >2 external link ID's + 1 cost value

6: Complex Turn restriction, >2 link ID's + 1 cost value

 

File example:

 

// Comment

0 A4003234 A4003127 -1

1 456 230 -1

2 -77.024098 38.902711

3 A4003234 A4003127

4 456 230

5 A4003279 A4003234 A4003127 -1

6 89 456 230 -1

 

Lines starting with // are ignored as comments.

 

The ITN converter will create turn restriction files in this format.

 

If you use turn restrictions with external ID's (type 0, 3 and 5), make sure you have called Open with externalID>0 or you will get an error code returned.

 

Type 0, 2, 3 and 4 gets translated into one or more type 1 during import and type 5 gets translated into type 6 during import.

 

The function returns the number of errors during the import. That can be due to external ID's not valid or non-existing turns.

 

It also generates a file called "turn_report.txt" in the same folder as the network, with information about the errors.

 

Syntax: TurnImportTxt(index: integer; filename: string): integer;