Function AirDistNode(node1,node2: longint): single;

Calculates the air distance between two nodes. Uses the current coordinatesystem.

Possible error codes: -10 -30
Versions: All
ActiveX / VCL / CLX component:   TRWnetBase(X)
Function AirDistPos(Xlong1,Ylat1,Xlong2,Ylat2: single): single;

Calculates the air distance between two geographic positions. Uses the current coordinatesystem.

Versions: All
ActiveX / VCL / CLX component:   TRWnetBase(X)
Property Alpha;

Alpha is used in function Route and 0<=alpha<=4.

See seperate description of
alpha.

In the freeware version alpha is always 0.

Versions: All
ActiveX / VCL / CLX component:   TRWcalc(X)
Function Assignment(filename: pchar; Atype,Grouped: smallint): integer;

Assigns traffic to a network based on a list with traffic volumes between pairs of coordinates or node numbers.

Filename holds the name of the file with traffic to be assigned. This is the full filename and doesn't rely on property "Directorty".

If Atype=0 each line in the file holds pairs of nodes and the traffic volume:


If Atype=1 each line in the file holds pairs of coordinates and the traffic volume:


If Grouped=1, it is assumed that multiple occurences of node1 or (x1,y1) is grouped together.
If Grouped=0, it is assumed they are in random order.

The value of Grouped doesn't matter, but performance suffer if the wrong value is used as input.

If a traffic volume can not be assigned because the corresponding nodes are not connected, the function stops and returns a positive number which contains the line number with the problem.

The result can be saved with ResultSaveLink.

Possible error codes: -10 -40 -41
Versions:   Pro
ActiveX / VCL / CLX component:   TRWcalc(X)
Function AttributeCreate(filename: pchar): longint;

From the specified filename a file called attribute.bin is created, which holds all attributes regarding the links. The attribute is defined in this way:

0-31: Defines road class.
Add 32 if mode1 isn't allowed on this link.
Add 64 if mode2 isn't allowed on this link.
Add 128 if mode3 isn't allowed on this link.
Add 256 if mode4 isn't allowed on this link.
Add 512 if it is a one-way street, which may not be travelled in the opposite of the digitised direction.
Add 1024 if it is a one-way street, which may not be travelled in the digitised direction.
Add 2048 if a link is part of a roundabout.

Link.mid shouldn't contain any other values but the attribute, that is one number on each line in the file.

Attribute.bin simply holds the values from link.mid and so it is possible to write directly to this file if needed. It consists of 16-bit signed integers. You may even create the file from scratch yourself, if that suits you better.

Possible error codes: -31 -40
Versions: All
ActiveX / VCL / CLX component:   TRWnetBase(X)
Function AttributeRead(oneway: boolean): longint;

Calculates the time on all links according to attribute.bin (roadclass, mode), speed and Units. Should be called whenever one of these have been changed.

If oneway is false, all links will be two-way streets (for instance for pedestrians). For other modes specify true.

Possible error codes: -10 -31 -40
Versions: All
ActiveX / VCL / CLX component:   TRWnetBase(X)
Function AttributeSet(link: longint; newattrib: smallint): longint;

Changes the attribute for a single link. The change only takes effect on disk. You should still call AttributeRead afterwards. AttributeCreate should already have been executed.

Possible error codes: -32 -40
Versions:   Standard  Pro
ActiveX / VCL / CLX component:   TRWnetBase(X)
Function BestNode: longint;

See function Route for a description.

Possible error codes: -10
Versions:   Standard  Pro
ActiveX / VCL / CLX component:   TRWcalc(X)
Function CheckLink(link: longInt): boolean;

Returns true if the link number is valid.

Versions: All
ActiveX / VCL / CLX component:   TRWnetBase(X)
Function CheckNode(node: longint): boolean;

Returns true if the node number is valid.

Versions: All
ActiveX / VCL / CLX component:   TRWnetBase(X)
Function CloseLink(link: longint; code: smallint): longint;

Changes the status of the specified link for the current mode:

0: Two-way street
512: One-way street, which may not be travelled in the opposite of the digitised direction.
1024: One-way street, which may not be travelled in the digitised direction.
1536: Closed street.

This overwrites information loaded with AttributeRead and after a call to AttributeRead is also overwritten.

Possible error codes: -10 -30
Versions:   Standard  Pro
ActiveX / VCL / CLX component:   TRWnetBase(X)
Property Coord;

Coord defines the coordinate system used when creating the network and querying road distances etc. The following are defined:

XYMiles, XYKm, XYInch, XYft, XYyd, XYmm
XYcm, XYm, XYsurveyft, XYnmi, LatLong, XYlink, XYchain, XYrod

LatLong is default.

See also Units.

Versions: All
ActiveX / VCL / CLX component:   TRWnetBase(X)
Property Coord2;

If coord2 is true, a file called coord2.bin is created at the same time as the network is created. This file is used by function Direction2 to provide exact turn information.

Default value is false

Versions: All
ActiveX / VCL / CLX component:   TRWnetBase(X)
Property CostDist;

See Route for a description. Default value is 1. CostDist>=0.

In the freeware version CostDist is always 1.

Versions: All
ActiveX / VCL / CLX component:   TRWcalc(X)
Property CostTime;

See Route for a description. Default value is 0. CostTime>=0.

In the freeware version CostTime is always 0.

Versions: All
ActiveX / VCL / CLX component:   TRWcalc(X)
Function CulDeSac(Ctype: smallint): longint;

Identifies cul-de-sac or blind alleys, which are defined like this:

Position yourself in a node and drive in one direction using link A. If you can't get back to the same node without using the same link A again, it is a cul-de-sac. If you however can come back without making a U-turn, it is a semi cul-de-sec.

0 = normal roads
1 = cul-de-sac
2 = semi cul-de-sac.

If ctype=2 both types of cul-de-sac are identified. If ctype=1 only type 1 is identified.

The result can be saved with ResultSave.

Note that type 2 take a lot more time to identify and you will have to call AttibuteRead after using this function as all information about oneway streets are reset.

Possible error codes: -10 -40 -41 -42
Versions:   Pro
ActiveX / VCL / CLX component:   TRWcalc(X)
Function Direction1(node1, node2, node3: longint): longint;

Returns the turning angle (0-359) at node2 when moving from node1 to node3 via node2. This is based on the coordinates of the nodes and doesn't take the actual polyline-layout into consideration.

Straight on is 0, to the left is 90, backward is 180 and to the right is 270.

See also Direction2.

Possible error codes: -10 -30
Versions:   Standard  Pro
ActiveX / VCL / CLX component:   TRWnetBase(X)
Function Direction2(link1, node2, link2: longint): longint;

Returns the turning angle (0-359) at node2 when moving from link1 to link2 via node2. This is based on the exact coordinates of the polylines and the node.

Link1 and link2 must both be connected to node2. The extra coordinates are held in a file "coord2.bin", which can be created at the same time as the network is created, see Coord2 for a description.

Specifying node2 may seem superfluous, but is required since link1 and link2 could be parallel links.

If your network only consists of lines or polylines with one segment, Direction1 is easier to use and the result is the same.

Straight on is 0, to the left is 90, backward is 180 and to the right is 270.

See also Direction1.

Possible error codes: -10 -30 -31 -40
Versions:   Standard  Pro
ActiveX / VCL / CLX component:   TRWnetBase(X)
Property Directory;

Directory defines the location of all files used by RWNet. Default directory is the current path.

Versions: All
ActiveX / VCL / CLX component:   TRWnetBase(X)
Property ExtraDist;

See Route for a description. Default value is 0.

Versions: All
ActiveX / VCL / CLX component:   TRWcalc(X)
Property ExtraTime;

See Route for a description. Default value is 1.

Versions: All
ActiveX / VCL / CLX component:   TRWcalc(X)
Function ExtraVarCreate: longint;

Creates an extra variable which is used by function Route and IsoCost. 4 bytes per link.

Possible error codes: -40 -41
Versions: All
ActiveX / VCL / CLX component:   TRWcalc(X)
Procedure ExtraVarDrop;

Frees memory associated with extra variable.

Versions: All
ActiveX / VCL / CLX component:   TRWcalc(X)
Function ExtraVarExist: boolean;

Returns true if extra route information has been created.

Versions: All
ActiveX / VCL / CLX component:   TRWcalc(X)
Function FindCloseNodes(snap: single): longint;

Identifies all nodes, which are positioned closer to each other than specified in snap. The result is written to "closenodes.mif/mid", which can be imported into your GIS-program.

Close nodes are often an indication of problems in the network, e.g. missing "snap".

If the nodeindex hasn't been created, the function will do so.

The generated file will contain the distance between the nodes and whether or not they are connected by a link.

Possible error codes: -10
Versions:   Pro
ActiveX / VCL / CLX component:   TRWnetBase(X)
Function FindNode(XLong,YLat: single; var node: longint; var dist: single): longint;

Finds the nearest node based on a geographic position. Returns node number and air distance in node and dist.

Possible error codes: -10
Versions: All
ActiveX / VCL / CLX component:   TRWnetBase(X)
Function FindNodeFast(XLong,YLat: single; var node: longint; var dist: single): longint;

Same as FindNode, except it uses the index created by NodeIndexCreate and is a lot faster.

When dealing with latitude/longitude coordinates either along the dateline or close to the poles, use FindNode instead. (Very unlikely to have a network there)

If the nodeindex hasn't been created, the function will do so.

Possible error codes: -10 -34 -40 -41
Versions:   Standard  Pro
ActiveX / VCL / CLX component:   TRWnetBase(X)
Function FindRoundAbout(maxlink: smallint; maxradius: single): longint;

Locates links, which are roundabouts.

By definition roundabouts:
1) Need to have at least 3 links,
2) Should form a loop,
3) All nodes should have a valency of 2 or 3,
4) At least 3 nodes should have a valency of 3.

Maxlink denotes the maximum number of links in a roundabout. Max has to be >2 and <100.

Maxradius is the maximum radius of the roundabout.

The function locates roundabouts using two methods:
First it will look for links with one-way streets. If a loop can be found, where a sequence of links all are one-way streets in the same direction, it will be considered to be a roundabout.

Next it will search for sequences of links, where various geometric properties will also have to be in order to be accepted as a roundabout.

The method isn't 100% bullet proof, so a manual inspection of the result is needed. Usually most roundabouts are located, but also some false ones.

Latitude/longitude coordinates are not supported by this function, however you will not be stopped if you try.

The function returns the number of round-abouts.

0: Not roundabout
1: Links belonging to first roundabout
2: Links belonging to next roundabout etc.

The result can be saved with ResultSaveLink.

Possible error codes: -10 -30 -40 -41 -54
Versions:   Pro
ActiveX / VCL / CLX component:   TRWcalc(X)
Function GetLinkCost(Link: longint): single;

Same as GetNodeCost, just for links instead. TurnMode=false:
Returns the maximum cost of the two end nodes of the link.

TurnMode=true:
Link>0: Returns the cost of going to the ToNode
Link<0: Returns the cost of going to the FromNode


Possible error codes: -10 -30
Versions: All
ActiveX / VCL / CLX component:   TRWcalc(X)
Function GetLinkExtra(Link: longint): single;

Same as GetLinkCost, but returns link extra-result.

Possible error codes: -10 -30 -39
Versions: All
ActiveX / VCL / CLX component:   TRWcalc(X)
Function GetLinkSpeed(link: integer): single;

Returns the travelling speed for a specific link.

Possible error codes: -10 -30
Versions:   Standard  Pro
ActiveX / VCL / CLX component:   TRWnetBase(X)
Function GetLinkTime(link: integer): single;

Returns the travelling time for a specific link.

Possible error codes: -10 -30
Versions:   Standard  Pro
ActiveX / VCL / CLX component:   TRWnetBase(X)
Function GetNodeCost(Node: longint): single;

After a call to IsoCost the cost to all nodes are calculated. With GetNodeCost, you can query the cost to individual nodes very fast (instantaneous). This can be used to create a complete distance table.

Please note, if you have called isoCost with a limit on the distance, the result for some nodes may be undefined.

This can also be used after a call to Route, but in this case even fewer links will have a defined result. However all nodes on the route are defined.

When used in combination with turn restrictions, remember that a certain node can be part of a route more than once. In this case use GetLinkCost function instead when querying cost along the route.

Possible error codes: -10 -30
Versions: All
ActiveX / VCL / CLX component:   TRWcalc(X)
Function GetNodeExtra(Node: longint): single;

Same as GetNodeCost, but returns extra-result.

Possible error codes: -10 -30 -39
Versions: All
ActiveX / VCL / CLX component:   TRWcalc(X)
Procedure Init(passno: longint);

Supply the correct password for the ActiveX and DLL-version of RW Net. If you try to call any functions without having supplied the correct password, RW Net will crash. This will have to be the first function called.

Init is not needed and has no effect in freeware edition.

Versions: All
ActiveX / VCL / CLX component:   TRWnetBase(X)
Function IsoCost(Node: longint; MaxCost: single): longint;

Calculates an isochrone from node until a maximum cost of maxcost has been reached. If maxcost is 0, there is no upper limit and the whole network will be calculated, except for subnets.

Possible error codes: -10 -30
Versions:   Standard  Pro
ActiveX / VCL / CLX component:   TRWcalc(X)
Function IsoCostMulti(Nodenum: smallint; maxcost: single): longint;

Calculates isochrones simultaneously for several nodes, which has been entered through function NodeListSet.

Nodenum defines the number of nodes on the NodeList and maxcost defines if there is a maximum cost. 0 means no maximum.

The ID of the nearest node for each link can be extracted with function ResultSave/ResultGet afterwards.

This function is ideal for locating areas, which has more than x km to a facility, if you have several facilities or testing how new facilities will affect the market.

Possible error codes: -10 -40 -41
Versions:   Standard  Pro
ActiveX / VCL / CLX component:   TRWcalc(X)
Function IsoCostSave(link, node, complete: boolean): longint;

Saves the result from a previous call to the IsoCost function.

The result is saved to files specified in ResultFileNode and ResultFileLink.

Only results>0 are saved unless complete is true. This makes it possible to have more than one isochrone in the network at the same time, unless they are overlapping.

Specify if both link and/or node data is to be saved.

Possible error codes: -10 -20 -21 -32
Versions:   Standard  Pro
ActiveX / VCL / CLX component:   TRWcalc(X)
Function IsoGrid(nodenum: smallint; Xlong1, Ylat1, Xlong2, Ylat2: single; gridV, gridH: integer; roundoff: single): longint;

IsoGrid calculates an isochrone grid based on 1 or more nodes entered through the standard NodeList functions.

The grid is created as a window defined by the coordinates in the parameter list. The number of grids can be defined vertically and horizontally. Grids with same value are joined vertically before they are saved to "isogrid.mif".

It is also possible to define a round-off parameter, which is applied to the cost before the grids are joined. This makes the resulting grid more compact. 10 rounds off to the nearest 10 etc.

Call NodeIndexCreate first for faster calculations.

Possible error codes: -10 -30 -32 -40
Versions:   Standard  Pro
ActiveX / VCL / CLX component:   TRWcalc(X)
Function IsoPoly1(filename: pchar; node: longint; cost1,cost2: single; numpoly: longint; doughnut: boolean; convex: single): longint;

Obsolete function. Use IsoPoly2 instead.

IsoPoly1 calculates isocost polygons, which shows how far it is possible to go within a specified amount of cost from a node.

The result is saved to filename, which should include path and filename, but exclude extension.

Node specifies the start-node.

Cost1 and cost2 specifies the cost used at the start and end of the polygon, where 0<=cost1
Numpoly is the number of polygons created. Numpoly>=1.

Doughnut defines if the polygons are created as hollow polygons (doughnut) or not.

The best way to understand these parameters is to try the demo, which makes it possible to adjust all parameters easily and see the result immediately.

Convex defines to what degree the polygons should be calculated as convex hulls. The area around the possible points are scanned to see if other points are further away from the start-node. If not, the point is included in the polygon. Convex is specified in terms of degrees, when scanning. If convex is 0, only points on the convex hull is included. If the polygon is small, you would usually use a high value (30), whereas large polygons should be created with a smaller value (2-3).

If convex<>0 degenerate polygons may be created in some rare situations.

Latitude/longitude coordinates are not really supported by this function, but only in rare situations will it actually affect the generated polygons.

Possible error codes: -10 -30 -32 -37 -40
Versions:   Standard  Pro
ActiveX / VCL / CLX component:   TRWcalc(X)
Function IsoPoly2(filename: pchar; nodenum: integer): longint;

IsoPoly2 calculates isocost polygons, which shows how far it is possible to go within a specified amount of cost from one or more nodes.

The result is saved to filename, which should include path and filename, but exclude extension.

Nodenum specifies the number of nodes entered into the standard nodelist.

Use procedure StepsClear and StepsAdd to add a list of the actual isochrones generated.

The best way to understand these parameters is to try the demo, which makes it possible to adjust the parameters easily and see the result immediately.

Latitude/longitude coordinates are not really supported by this function, but only in rare situations will it actually affect the generated polygons.

Possible error codes: -10 -30 -40 -41
Versions:   Standard  Pro
ActiveX / VCL / CLX component:   TRWcalc(X)
Function IsoPoly3(filename: pchar; maxcost: single; nodenum, min_valency: integer; Xlong1,Ylat1,Xlong2,Ylat2: double): longint;

IsoPoly3 calculates voronoi polygons (cells), which shows the cost associated with each node in the network.

The function can use one or more nodes as a basis for the calculation of node cost. The output is a mif/mid file, which can be imported into your GIS. The mid file also holds information on the id of the nearest node.

The result is saved to filename, which should include path and filename, but exclude extension.

Nodenum specifies the number of nodes entered into the standard nodelist.

Maxcost specifies the maximum cost for the voronoi cells.

By specifying min_valency it is possible to restrict the generation of cells to nodes with a minimum valency, that is the more important nodes.

It is also possible to restrict the cells to a specific area of the network based on a window defined by (xmin,ymin) - (xmax,ymax).

The best way to understand these parameters is to try the demo, which makes it possible to adjust all parameters easily and see the result immediately.

Latitude/longitude coordinates are not really supported by this function, but only in rare situations will it actually affect the generated polygons.

Possible error codes: -10 -30 -40 -41
Versions:   Standard  Pro
ActiveX / VCL / CLX component:   TRWcalc(X)
Function Join(maxlength: single; filename: pchar): longint;

Join locates which links in a network can be joined together. If a node has only two links connected to it, that node may be superfluous for some purposes (aka. a pseudo-node). For other purposes it is needed, e.g. if you want to calculate the distance from that node to another.

If a network has many very short links, which you would like to join, you can specify that links should be joined until they reach a length of maxlength. If maxlength=0, there is no upper limit and all links between nodes with more or less than 2 links, will be connected.

If a filename is specified (including full path), it should for each link contain a line with the streetname. This can be used to stop the joins every time the street name changes on the links. If the file isn't found, the calculation is done as if the filename is "". The file can of course hold any string value.

The result can be saved using ResultSave. All links with the same value>0 should then be joined/combined in a GIS-program (see RouteWare homepage for mapbasic program). Now you can create a new topological network, which is smaller and faster.

Possible error codes: -10 -40 -41
Versions:   Pro
ActiveX / VCL / CLX component:   TRWcalc(X)
Function Link2FromNode(link: longint): longint;

Returns the number of the node at the start of the link. This is where digitizing has started.

Possible error codes: -10 -30
Versions: All
ActiveX / VCL / CLX component:   TRWnetBase(X)
Function Link2ToNode(link: longint): longint;

Returns the number of the node at the end of the link. This is where digitizing has ended.

Possible error codes: -10 -30
Versions: All
ActiveX / VCL / CLX component:   TRWnetBase(X)
Function LinkLimit: longint;

Returns the maximum number of links allowed in the network according to your license.

Versions: All
ActiveX / VCL / CLX component:   TRWnetBase(X)
Function LinkMax: longint;

Return the highest possible link-number in the current network, which should equal to the number of links in the corresponding GIS-network.

Possible error codes: -10
Versions: All
ActiveX / VCL / CLX component:   TRWnetBase(X)
Property Mode;

Define a mode from 1 to 4. Default is 1.

If you have multiple modes using the same network, you can define a set of speeds for each mode and define which links can't be used by some of the modes.

See also AttributeCreate.

Versions: All
ActiveX / VCL / CLX component:   TRWnetBase(X)
Function NearestNode(node,nodenum: longint): longint

Finds the nearest node from a list of nodes, calculated from a starting node.

Enter a list of possible nearest nodes through the standard NodeList functions and call the function with these parameters:

Node is the starting node.
Nodenum is the number of nodes on the NodeList.

Returns the ID of the nearest node on NodeList, that is a number between 1 and nodenum. The real node ID can then be found with NodeListGet. If return value=0, none of the nodes where found.

Possible error codes: -10 -30
Versions:   Standard  Pro
ActiveX / VCL / CLX component:   TRWcalc(X)
Function NodeCoordX(node: longint): single;

Returns the x-coordinate (or longitude) of node.

Possible error codes: -10 -30
Versions: All
ActiveX / VCL / CLX component:   TRWnetBase(X)
Function NodeCoordY(node: longint): single;

Returns the y-coordinate (or latitude) of node.

Possible error codes: -10 -30
Versions: All
ActiveX / VCL / CLX component:   TRWnetBase(X)
Function NodeCreate: longint

Creates Node.mif/mid on disk, which can be imported and used for locating nodes in the network and viewing node-related results in your GIS. First node in node.mif has ID=1, second node has ID=2 etc.

Possible error codes: -10
Versions: All
ActiveX / VCL / CLX component:   TRWnetBase(X)
Function NodeIndexCreate: longint;

Creates an index on node-coordinates, which is needed by FindNodeFast and FindCloseNodes. Uses 4 bytes per node.

Possible error codes: -10 -40 -41
Versions:   Standard  Pro
ActiveX / VCL / CLX component:   TRWnetBase(X)
Procedure NodeIndexDrop;

Frees memory associated by the node index.

Versions:   Standard  Pro
ActiveX / VCL / CLX component:   TRWnetBase(X)
Function NodeIndexExist: boolean;

Returns true if the node index has been created.

See also NodeIndexCreate.

Versions:   Standard  Pro
ActiveX / VCL / CLX component:   TRWnetBase(X)
Function NodeListGet(index: longint): longint;

Reads values from the nodelist.

Used after a call to function TSP, which orders the node numbers in optimal order.

Possible error codes: -10 -30
Versions:   Standard  Pro
ActiveX / VCL / CLX component:   TRWcalc(X)
Function NodeListLimit: longint

Returns maximum number of nodes allowed in NodeList.

20 in standard version and 300 in pro version.

Versions:   Standard  Pro
ActiveX / VCL / CLX component:   TRWcalc(X)
Function NodeListSet(index, node: longint): longint;

Use this function to enter a list of nodes, which is input to other functions.

This can be a list of nodes to visit in optimal order (function TSP).

NodeListSet(1,100) sets the first node/customer to be node #100. You should always start with 1.

Possible error codes: -10 -30
Versions:   Standard  Pro
ActiveX / VCL / CLX component:   TRWcalc(X)
Function NodeMax: longint;

Return the highest possible node-number in the current network.

Possible error codes: -10
Versions: All
ActiveX / VCL / CLX component:   TRWnetBase(X)
Function NWCreateMIF(filename: pchar; nodemif: boolean): longint;

Creates the topological network, which is used by all other functions.

Input: The topological network is created from a file as specified above in MapInfo mif/mid format. All (poly)lines will be used, when building the network. Multiple polylines and other objects are not used. Filename should be without directory and without extension (e.g. "link" will look for link.mif in the current directory).

The size of the resulting network depends on the total number of records in your mif-file, so you should avoid other object types than (poly)lines.

If you export from a TAB-file, it should be packed, that is it shouldn't contain any deleted records. Otherwise you will encounter wrong results in functions like RouteLink, IsoCostSave etc.

Output: The network consists of link.bin, node.bin, coord.bin and dist.bin. The size of the files on disk is appr. 28 bytes per link for average road networks.

If nodemif=true then function NodeCreate is called at the same time.

See also AttributeCreate.

Possible error codes: -11 -12 -14 -32 -40 -50
Versions: All
ActiveX / VCL / CLX component:   TRWnetBase(X)
Function NWCreateSHP(filename: pchar; nodemif: boolean; coordsys: string): longint;

Same as NWCreateMIF except:

The topological network is created from a file as specified above in shape format.

The coordinate clause (mapinfo mif/mid format) can be specified. If left empty a default Non-earth is used. The coordinate clause is only used when writing mif/mid files as a result from functions like isopoly, findclosenodes etc.

Possible error codes: -11 -12 -14 -32 -40 -50
Versions: All
ActiveX / VCL / CLX component:   TRWnetBase(X)
Function NWCreateTAB(filename: pchar; nodemif: boolean): longint;

Same as NWCreateMIF except:

The topological network is created from a file as specified above in MapInfo native format (map/id).

This function accepts deleted records and records without a graphical object.

Due to the status of the TAB-format (no official description), the network created may be faulty. If you encounter any problems, please report to RouteWare.

Possible error codes: -10 -11 -12 -14 -32 -40 -50
Versions: All
ActiveX / VCL / CLX component:   TRWnetBase(X)
Function NWLoad: longint;

Loads the topological network into memory. Uses appr. 34 bytes per link.

For each instance of RWcalc attached:
Add 9 / 15 bytes per link (turnmode= false / true).
Add 3 / 8 bytes per link if extravar is true.

Maximum is thus 34+15+8=57 bytes per link in the DLL version, which always has exactly one instance of RWcalc.

These numbers are based on average road networks (here TIGER data).

Possible error codes: -11 -15 -31 -40 -41
Versions: All
ActiveX / VCL / CLX component:   TRWnetBase(X)
Function NWLoaded: boolean;

Returns true if the network has been loaded.

Versions: All
ActiveX / VCL / CLX component:   TRWnetBase(X)
Procedure NWUnLoad;

Unloads the topological network and frees corresponding memory. All indexes and temporary results are also freed.

Versions: All
ActiveX / VCL / CLX component:   TRWnetBase(X)
Function OptimumAlpha: single

Returns the optimum value of alpha. This takes into consideration the relationship between straght line distance and time on all links and value of costdist and costtime.

See the discussion on alpha for more information.

Possible error codes: -10
Versions:   Standard  Pro
ActiveX / VCL / CLX component:   TRWcalc(X)
Function ParallelLinks: longint;

Identifies group of links, which start and end at the same two nodes. These might give problems in some networking algorithms ("emme/2" for instance).

RW Net has no problem with parallel links.

0: normal links
1: Single link, which start and end at the same node (loop).
>=10: Shortest link in group
<=-10: Other links in group

Three parallel links would have the value 10 (the shortest) and -10 for the other two. The next group of parallel links has value 11 / -11 and then 12 / -12 etc.

The result can be saved with ResultSaveLink.

Possible error codes: -10 -40 -41
Versions:   Pro
ActiveX / VCL / CLX component:   TRWcalc(X)
Procedure ResultDrop;

Frees memory associated by the result from CulDeSac, Join, IsoCostMulti, IsoGrid, ParallelLinks and SubNet. "4*link+4*node" bytes is freed.

Versions:   Standard  Pro
ActiveX / VCL / CLX component:   TRWcalc(X)
Property ResultField;

ResultField sets the name of the field into which results are saved. Default ResultField is "result".

Versions: All
ActiveX / VCL / CLX component:   TRWcalc(X)
Function ResultFileClear(link,node: boolean): longint;

Clears the result file used by ResultSave, IsoCostSave and RouteSave. The resultfield is assigned with "0.000".

State if one or both resultfiles should be cleared.

The same effect can be accomplished in mapbasic with this command: "update link set result=0", but this is faster.

Possible error codes: -20 -21 -32
Versions: All
ActiveX / VCL / CLX component:   TRWcalc(X)
Property ResultFileLink;

Name of a mapinfo dat-file or a shape dbf-file with a field named as defined in ResultField of type decimal(11,3). The path is defined through Directory.

This file is used by RouteSave, IsoCostSave and ResultSave.

Versions: All
ActiveX / VCL / CLX component:   TRWcalc(X)
Property ResultFileNode;

Name of a mapinfo dat or a shape dbf file with a field named as defined in ResultField of type decimal(11,3). The path is defined through Directory.

This file is used by RouteSave and IsoCostSave.

Versions: All
ActiveX / VCL / CLX component:   TRWcalc(X)
Function ResultGetLink(link: longint): single;

Returns the result for a specific link after a call to either CulDeSac, Join, IsoCostMulti, ParallelLinks or Subnet.

Possible error codes: -10 -30 -37
Versions:   Standard  Pro
ActiveX / VCL / CLX component:   TRWcalc(X)
Function ResultGetNode(node: longint): single;

Returns the result for a specific node after a call to IsoCostMulti or SubNet.

Possible error codes: -10 -30 -37
Versions:   Standard  Pro
ActiveX / VCL / CLX component:   TRWcalc(X)
Function ResultSaveLink: longint;

Saves the result from a previous call to CulDeSac, FindRoundAbout, IsoCostMulti, Join, ParallelLinks, Subnet or UnUsedLinks.

The result is saved as specified in ResultFileLink.

Possible error codes: -10 -20 -21 -32 -37
Versions:   Standard  Pro
ActiveX / VCL / CLX component:   TRWcalc(X)
Function ResultSaveNode: longint;

Saves the result from a previous call to IsoCostMulti or Subnet.

The result is saved as specified in ResultFileNode.

Possible error codes: -10 -20 -21 -32 -37
Versions:   Standard  Pro
ActiveX / VCL / CLX component:   TRWcalc(X)
Function RoundAbout(link: integer): boolean;

Returns true if a link is part of a roundabout. In all other situations false is returned. This is defined through attribute codes.

Versions: All
ActiveX / VCL / CLX component:   TRWnetBase(X)
Function Route(Node1,Node2: longint): single;

Calculates the cost of the cheapest route from node1 to node2 according to Alpha, CostTime and CostDist. Returns the Cost.

Cheapest route is defined as the route, which minimizes this expression:

Cost = CostDist*distance + CostTime*time, where CostDist and CostTime >=0.

Either CostDist or CostTime should be >0.

If ExtraVarCreate has been called, an additional variable is calculated as

extra = extradist*distance + extratime*time.

Distance is defined according to Units and time is always minutes.

If error -33 is returned, you can check function BestNode to see the node, which was nearest to node2.

See also Alpha.

Possible error codes: -10 -30 -33
Versions: All
ActiveX / VCL / CLX component:   TRWcalc(X)
Function RouteDyn(link1,link2: integer; Percent1,Percent2: single; var fromto1,fromto2,routelength: integer; var extra: single): single;

This function is used for dynamic routing. This means a route can be calculated from somewhere along a link to somewhere along another link. The normal Route function always goes from node to node.

Link1 and percent1 denotes where on link1 the route should start. The percentage (0 < percent1 < 1) counts from the same end as the link has been digitized.

Link2 and percent2 is the same, just for the link, where the route ends.

Fromto1 is part of the result. If fromto1=0, the calculated route goes through the start node of link1. If fromto1=1, the calculated route goes through the end node of link1.

Fromto2 has the same meaning, just for link2.

Routelength holds the number of nodes in the calculated route. If routelength=0, the route is a subset of link1. This can only happen if link1=link2, that is if the routing is along the same link. Even when link1=link2, routelength can also be >0.

You should never call function RouteFind after RouteDyn as this is an integrated part of RouteDyn. However RouteGetLink, RouteGetNode etc. can be called the normal way.

Variable extra hold the extra cost, if ExtraVarCreate has been called.

The result holds the cost.

There are a few restrictions when using loop links, that is links which start and end at the same node:
Loop links can not hold one-way information.
When computing a route where link1=link2 and the link is also a loop link, turn restrictions are not considered.

It is advisable to split loop links in the network in 2 sections, this removes the restrictions mentioned above.


Possible error codes: -10 -30 -33
Versions:   Standard  Pro
ActiveX / VCL / CLX component:   TRWcalc(X)
Function RouteFind(node2: longint): longint;

Calculates a route from node2 to node1, which has been defined in a previous call to either Route or IsoCost.

Returns the number of nodes on the route. The number of links is one less.

See also RouteGetLink and RouteGetNode.

Possible error codes: -10 -30 -35
Versions: All
ActiveX / VCL / CLX component:   TRWcalc(X)
Function RouteGetLink(index: longint): longint;

After a call to RouteFind, you can query the resulting route and get the ID of all links on the route.

When TurnMode=true, "ID" is returned if a link is travelled in the digitized direction. If the link is travelled in the opposite direction then "-ID" is returned. Errors are always returned as "0".

Possible error codes: -10 -35 -36
Versions: All
ActiveX / VCL / CLX component:   TRWcalc(X)
Function RouteGetNode(index: longint): longint;

After a call to RouteFind, you can query the resulting route and get the ID of all nodes on the route.

Possible error codes: -10 -35 -36
Versions: All
ActiveX / VCL / CLX component:   TRWcalc(X)
Function RouteReady: boolean;

Returns true if a call to RouteFind has been made and a route is ready for output.

Versions: All
ActiveX / VCL / CLX component:   TRWcalc(X)
Function RouteSave(link, node: boolean): longint;

After a call to RouteFind you can save the resulting route directly to either a mapinfo dat-file or a shape dbf-file. Links/nodes not on the route isn't cleared.

State if links and/or nodes should be saved.

Links/nodes on the route is changed to "1", except for start and end-node, which is changed to "2".

See also ResultLinkFile and ResultNodeFile.

Possible error codes: -10 -20 -21 -32 -35
Versions: All
ActiveX / VCL / CLX component:   TRWcalc(X)
Function RouteVia(Node1, Node2, Nodenum: integer): integer;

RouteVia calculates the cheapest path from node1 to node2 via one of the nodes entered into the standard nodelist.

Nodenum holds the number of nodes in the list.

The function makes sure that the result is returned in the fastest possible way for the loaded network. If oneway streets are used, it can not be avoided that the calculations may take some time.

Returns the id of the node in the nodelist.

Possible error codes: -10 -30
Versions:   Standard  Pro
ActiveX / VCL / CLX component:   TRWcalc(X)
Function SetLinkSpeed(link,speed: integer): integer;

Use this function for changing the speed on a specific link. This only affects the speed as it is loaded into memory. After calling AttributeRead the speed is back to normal, i.e. as defined through the function SetSpeed.

This function is of most use for temporarily changing the speed of link in connection with roadworks etc.

Possible error codes: -10 -30
Versions:   Standard  Pro
ActiveX / VCL / CLX component:   TRWnetBase(X)
Function SetLinkSpeedDefault(link: integer): integer;

Use this function for setting the speed on a specific link back to the original value, i.e. when the network was loaded into memory with AttributeRead.

Possible error codes:
Versions:   Standard  Pro
ActiveX / VCL / CLX component:   TRWnetBase(X)
Function SetLinkTime(link: longint; time: single): integer;

This function makes it possible to change the time on individual links. This can be used for special links, which doesn't match the road classes: A ferry could be an example, where you want to enter the exact sailing time, because individual ferries don't use the same speed.

Any changes are overwritten after calling function AttributeRead.

Time>0.

Possible error codes: -10 -30
Versions:   Standard  Pro
ActiveX / VCL / CLX component:   TRWnetBase(X)
Procedure SetNet(rwnetbase: TRWnetBase);

Links the TRWcalc component to a TRWnetBase component. Only VCL edition.

Versions: All
ActiveX / VCL / CLX component:   TRWcalc(X)
Procedure SetSpeed(roadclass: smallint; speed: single);

Changes the speed for the present mode and the specified road class (0-31). Default and minimum value is 1 for all road classes.

Speed should be expressed as either km/hour or miles/hour according to Unit.

Doesn't take effect until AttributeRead is called.

Versions:   Standard  Pro
ActiveX / VCL / CLX component:   TRWnetBase(X)
Procedure ShowProgress(yesno: smallint; exhandle: longint);

ShowProgress(1,exhandle) turns on the progressbar for function NWCreate, NWLoad and FindRoundAbout. Default value is 0 = no progressbar. The progressbar makes it possible to interrupt NWCreate.

Exhandle is a windows handle to parent the progressbar onto the calling applications window. Specify 0 if unknown.

This only applies to the DLL version. In the VCL version use the corresponding events.

Versions:   Standard  Pro
ActiveX / VCL / CLX component:   TRWcalc(X)
Procedure StepsAdd(step: single);

Adds a new value to the list of isochrones generated, when calling function isopoly2.

Versions:   Standard  Pro
ActiveX / VCL / CLX component:   TRWcalc(X)
Procedure StepsClear;

Clears the internal list of steps used for function isopoly2.

Versions:   Standard  Pro
ActiveX / VCL / CLX component:   TRWcalc(X)
Function SubNet: longint;

Defines which part of a network is a subnet. A subnet is defined as a part of the network which isn't connected to the rest of the network. The result from the calculations can be saved with ResultSaveLink and ResultSaveNode.

The main net is defined as the part of the network, where the node with highest valency is found (node number 1).

0 = main net
1,2,3... = sub nets

Returns the number of subnets.

Possible error codes: -10 -40 -41 -54
Versions:   Pro
ActiveX / VCL / CLX component:   TRWcalc(X)
Function TSP(nodenum: longint; TSPtype: smallint): single;

Calculates the optimum order to visit a list of nodes. TSP uses Lin's 3-optimum algorithm, which usually returns true optimum, if you have less than 20-30 nodes. With 100 nodes you should expect a cost 1-2% higher than true optimum.

The cost between two nodes are calculated in both directions, but the average is used in the optimization.

Nodenum is the number of nodes in the optimization (4<=nodenum<=NodeListLimit).

TSPtype=0,10: A route is calculated, which starts at the first node and ends at the last node in the list. The order of the other nodes are optimized.

TSPtype=1,11: A roundtrip is calculated, where the order of all nodes are optimized.

TSPtype=2,12: A trip is calculated, where only the first node is fixed. The last node on the route will be somewhere far from the first node. This method requires a lot more computing time than type 0 and 1.

If TSPtype=10, 11 or 12 straight line distances are used in the optimization. This is a lot faster, but also less accurate.

The function returns the minimum cost.

The new (optimum) order of the nodes can be retrieved with function NodeListGet.

If you enter a node number more than once the cost between these duplicates will be a small number.

Possible error codes: -10 -30 -38
Versions:   Standard  Pro
ActiveX / VCL / CLX component:   TRWcalc(X)
Property TurnMode;

Defines if routing supports turn restrictions or not.

False: Standard routing (default value)
True: With turn restrictions

You can only change turnmode if the network isn't loaded. Turnmode can not be changed in free version.

Versions: All
ActiveX / VCL / CLX component:   TRWnetBase(X)
Function TurnRestriction(link1,link2: longint; cost: single): longint;

Defines a restriction on turns from link1 to link2.

cost<0: Turn prohibited
cost=0: Remove turn restriction
cost>0: Additional cost related to the turn (=delay).

If link1=link2 a U-turn restriction is added at both ends of the link.

Possible error codes: -10 -16 -30
Versions:   Standard  Pro
ActiveX / VCL / CLX component:   TRWnetBase(X)
Function TurnStandard(node: longint): longint;

Adds turn restriction on standard 4-road intersections (valency=4), which means no turns are allowed - only driving straight through.

To function properly the 4 links joining at the node should not intersect anywhere else than at the intersection (node) itself.

Possible error codes: -10 -16 -30
Versions:   Standard  Pro
ActiveX / VCL / CLX component:   TRWnetBase(X)
Property Units;

Units can be either Km (default) or Miles. Distances are returned according to this. Units has no influence on NWCreate.

Speed as defined in SetSpeed should be km/h or miles/h according to this.

Time is always measured in minutes.

Versions: All
ActiveX / VCL / CLX component:   TRWnetBase(X)
Function UnUsedLinks: longint

This function returns the number of unused links in the network. An unused link is one which isn't part of any route at all. This is determined using the current cost function.

The result can be saved with function ResultSaveLink:
0=Normal link
1=Unused
2=Loop links

Possible error codes: -10 -40 -41
Versions:   Pro
ActiveX / VCL / CLX component:   TRWcalc(X)
Property UTurnAllowed;

Defines if U-turns are allowed when Turnmode=true.

False: U-turns are always disabled (default).
True: Depends on what turn restrictions has been manually added using function TurnRestriction.

Versions: All
ActiveX / VCL / CLX component:   TRWcalc(X)
Function Valency(node: longint): longint;

Returns the valency of the node. Valency is the number of links connected to a node.

Valency is a number from 1 to 1900, which is the highest possible valency in RW Net.

Possible error codes: -10 -30
Versions: All
ActiveX / VCL / CLX component:   TRWnetBase(X)
Property Version;

Returns set constant indicating the version, e.g. "Standard_v200".

In DLL an integer is returned: 0=Free, 1=Standard and 2=Pro.

Versions: All
ActiveX / VCL / CLX component:   TRWnetBase(X)