Aimsun Next API Network Information¶
Functions related to Network Information¶
Notes¶
These functions are available when AAPIInit() is called and anytime after. They are not available in the AAPILoad() high-level function.
Read the name of an object¶
In C++ and Python¶
Explanation¶
Read the name of an object, UNICODE version.
Format¶
const unsigned short * ANGConnGetObjectName( int idObject ); // Unicode version.
const char * ANGConnGetObjectNameA( int idObject ); // Ascii version.
Parameters¶
- idObject: The object identifier
Output¶
- ≠ NULL: Name of the object.
- = NULL: Error.
The recommended usage in Python APIs is:
anyNonAsciiChar = boolp()
AKIConvertToAsciiString(ANGConnGetObjectName(idObject), True, anyNonAsciiChar))
Read the Path of the Network¶
In C++ and Python¶
Explanation¶
Read the full path of the network. The result has to be deleted with delete().
Format¶
const unsigned short * AKIInfNetGetNetworkPath();
Parameters:¶
None.
Output¶
- ≠ NULL: Path of the Network.
- = NULL: Error.
The recommended usage in Python APIs is:
anyNonAsciiChar = boolp()
AKIConvertToAsciiString(AKIInfNetGetNetworkPath(), True, anyNonAsciiChar))
Read the Path of the Network Ascii¶
In C++ and Python¶
Explanation¶
Read the full path of the network in ascii.
Format¶
const char * AKIInfNetGetNetworkPathA();
Parameters¶
None.
Output¶
- ≠ NULL: Path of the Network.
- = NULL: Error.
Read the Name of the Network¶
In C++ and Python¶
Explanation¶
Read the name of the network file (without extension). The result has to be deleted with delete().
Format¶
const unsigned short * AKIInfNetGetNetworkName();
Parameters¶
None.
Output¶
- ≠ NULL: Path of the Network.
- = NULL: Error.
The recommended usage in Python APIs is:
anyNonAsciiChar = boolp()
AKIConvertToAsciiString(AKIInfNetGetNetworkName(), True, anyNonAsciiChar))
Explanation¶
Read the name of the network file (without extension) in ascii. Obsolete function. Kept for compatibility reasons.
Read the Name of the Network in Ascii¶
In Python¶
Format¶
const char * AKIInfNetGetNetworkNameA();
Parameters¶
None.
Output¶
- ≠ NULL: Name of the Network file.
- = NULL: Error.
Read the Traffic Demand Name¶
In C++ and Python¶
Explanation¶
Read the name of the loaded traffic demand. The result has to be deleted with delete().
Format¶
const unsigned short * AKIInfNetGetTrafficDemandName ();
Parameters¶
None.
Output¶
- ≠ NULL: Traffic demand name.
- = NULL: Error.
The recommended usage in Python APIs is:
anyNonAsciiChar = boolp()
AKIConvertToAsciiString(AKIInfNetGetTrafficDemandName(), True, anyNonAsciiChar))
Read the Traffic Demand Name in Ascii¶
In Python¶
Explanation¶
Read the name of the of the loaded traffic demand in ascii. Obsolete function. Kept for compatibility reasons.
Format¶
const char * AKIInfNetGetTrafficDemandNameA();
Parameters¶
None.
Output¶
- ≠ NULL: Traffic demand name.
- = NULL: Error.
Read the Type of Traffic Demand¶
In C++ and Python¶
Explanation¶
Read the type of the Traffic Demand.
Format¶
int AKIInfNetGetTrafficDemandType ();
Parameters¶
None.
Output¶
- 1 traffic demand using OD matrices
- 2 using traffic states.
- < 0: Error.
Read the Units of a Network¶
In C++ and Python¶
Explanation¶
Read the units of a Network.
Format¶
int AKIInfNetGetUnits ()
Parameters¶
None.
Output¶
- 1 Metric Units,
- 0 English Units.
- < 0: Error.
Read the World Coordinates of the Network¶
In C++ and Python¶
Explanation¶
Read the world coordinates of a Network. This gives the left bottom point and the right top point of the bounding box.
Format¶
int AKIInfNetGetWorldCoordinates (double *min_x, double *min_y, double *max_x, double *max_y)
Parameters¶
The parameters changed to return the bounding box are:
- min_x,
- min_y,
- max_x, *
- max_y
Output¶
- = 0: correct.
- < 0: Error.
Read the Number of Sections¶
In C++ and Python¶
Explanation¶
Read the number of sections present on the road network.
Format¶
int AKIInfNetNbSectionsANG();
Parameters¶
None.
Output¶
- > 0: Number of sections in the road network.
- < 0: Error.
Read the Identifier of a Section¶
In C++ and Python¶
Explanation¶
Read the elem-th section identifier present on the road network.
Format¶
int AKIInfNetGetSectionANGId( int elem );
Parameters¶
- elem: The number of the section and must be in the range 0 ≤ elem < Number of Sections - 1.
Output¶
- > 0: Identifier of the section.
- ≤ 0: Error.
Read the Section Information¶
In C++ and Python¶
Explanation¶
Read the information of a section.
Format¶
A2KSectionInf AKIInfNetGetSectionANGInf(int aid)
Parameters¶
- aid: The section identifier.
Output¶
struct A2KSectionInf{
int report;
int id;
int angId;
int nbCentralLanes;
int nbSideLanes;
double speedLimit;
double reservedLanesVisibilityDistance;
double capacity;
double distance_OnRamp;
double distance_OnRampMerge;
double cooperation_OnRamp;
double length;
int nbSegments;
double * slopePercentages;
double userDefinedCost;
int reactionTimeVariation;
double reactionTimeAtTrafficLightVariation;
double reactionTimeAtStopVariation;
bool imprudentLaneChanging;
int nbTurnings;
};
where:
- int report: 0, OK, otherwise is an error code.
- int id: Section identifier.
- int angId: Section identifier.
- int nbCentralLanes: Number of central lanes.
- int nbSideLanes: Number of side lanes.
- double speedLimit: Speed limit of the section (Km/h o mph).
- double reservedLanesVisibilityDistance: Visibility distance of the reserved lanes of the section (meters or feet).
- double capacity: Capacity of the section (veh/h).
- double distance_OnRamp: Distance of the On Ramp of the section (sec).
- double distance_OnRampMerge: Side Lane Merging Distance: (m o ft).
- double cooperation_OnRamp: Lane-changing cooperation percentage.
- double length: Length of the section (meters or feet).
- int nbSegments: Number of section segments.
- double * slopePercentages: Array of segment percentages. There are nbSegments values.
- double userDefinedCost: User-defined cost of the section.
- int reactionTimeVariation: Reaction time variation of the section.
- double reactionTimeAtTrafficLightVariation: Reaction time variation at traffic lights.
- double reactionTimeAtStopVariation: reaction time variation at a stop.
- bool imprudentLaneChanging: True if the section has imprudent lane-changing behavior activated.
- int nbTurnings: Number of turns that have this section as their origin .
Read the Destination Section Identifier of all turns from one section¶
In C++ and Python¶
Explanation¶
Read the elem-th section identifier of the turning movement.
Format¶
int AKIInfNetGetIdSectionANGDestinationofTurning(int aid, int elem);
Parameters¶
- aid: The section identifier.
- elem: The number of the turn in the range 0 ≤ elem < Number of Turns - 1.
Output¶
- > 0: Corresponding section identifier.
- ≤ 0: Error.
Read the lane numbers of a Turn from a Section¶
In C++ and Python¶
Explanation¶
Read lane number of a turn from a section (lane number equal to 1 means the rightmost lane).
There are four functions:
- AKIInfNetGetOriginFromLaneofTurning: Gets the first lane of the origin section of the turn.
- AKIInfNetGetOriginToLaneofTurning: Gets the last lane of the origin section of the turn.
- AKIInfNetGetDestinationFromLaneofTurning: Gets the first lane of the destination section of the turn.
- AKIInfNetGetDestinationToLaneofTurning: Gets the last lane of the destination section of the turn.
Format¶
int AKIInfNetGetDestinationFromLaneofTurning(int sectId, int elem);
int AKIInfNetGetDestinationToLaneofTurning(int sectId, int elem);
int AKIInfNetGetOriginFromLaneofTurning(int sectId, int elem);
int AKIInfNetGetOriginToLaneofTurning(int sectId, int elem);
Parameters¶
- aid: The section identifier.
- elem: The number of turn and must be in the range 0 ≤ elem < Number of Turns - 1.
Output¶
- > 0: Corresponding lane number (from 1 to N, where lane 1 is the rightmost lane).
- ≤ 0: Error.
Read the lane numbers given the Origin and Destination Sections¶
In C++ and Python¶
Explanation¶
Read lane number of one turn (lane number equal to 1 means the rightmost lane).
There are four functions:
- AKIInfNetGetTurningOriginFromLane: Gets the first lane of the origin section of the turn.
- AKIInfNetGetTurningOriginToLane: Gets the last lane of the origin section of the turn.
- AKIInfNetGetTurningDestinationFromLane: Gets the first lane of the destination section of the turn.
- AKIInfNetGetTurningDestinationToLane: Gets the last lane of the destination section of the turn.
Format¶
int AKIInfNetGetTurningDestinationFromLane( int originSection, int destinationSection )
int AKIInfNetGetTurningDestinationToLane( int originSection, int destinationSection )
int AKIInfNetGetTurningOriginFromLane( int originSection, int destinationSection )
int AKIInfNetGetTurningOriginToLane( int originSection, int destinationSection )
Parameters¶
- originSection: Origin section identifier.
- destinationSection: Destination section identifier.
Output¶
- > 0: Corresponding lane number (from 1 to N, where lane 1 is the rightmost lane).
- ≤ 0: Error.
Modify the Behavioral Parameters of a Section¶
In C++ and Python¶
Explanation¶
Modify the behavioral parameters of a section that will be used when applying the models and in the route choice calculations.
Format¶
int AKIInfNetSetSectionBehaviouralParam(int aid, A2KSectionBehaviourParam behaviourParam, bool allsegments);
Parameters¶
- aid: Section identifier.
- allsegments: True if the changes is expanded to all segments of the section.
-
behaviourParam: New parameters to be assigned with the following structure:
struct A2KSectionBehaviourParam{ double speedLimit; double reservedLanesVisibilityDistance; double capacity; double distance_OnRamp; double distance_OnRampMerge; double cooperation_OnRamp; double userDefinedCost; int reactionTimeVariation; double reactionTimeAtTrafficLightVariation; double reactionTimeAtStopVariation; bool imprudentLaneChanging; };
where:
- double speedLimit: Speed limit of the section (km/h or mph).
- double reservedLanesVisibilityDistance: Visibility distance of the reserved lanes of the section (meters or feet).
- double capacity: Capacity of the section (veh/h).
- double distance_OnRamp: Distance of the On Ramp of the section (sec).
- double distance_OnRampMerge: Side Lane Merging Distance: (m or ft)
- double cooperation_OnRamp: Lane-changing cooperation percentage.
- double userDefinedCost: User-defined cost of the section.
- int reactionTimeVariation: Reaction time variation of the section.
- double reactionTimeAtTrafficLightVariation: Reaction time variation at traffic lights.
- double reactionTimeAtStopVariation: reaction time variation at stop.
- bool imprudentLaneChanging: True if the section has imprudent lane-changing behavior activated.
Output¶
- = 0: No Error
- < 0: Error
Sample code in Python:¶
The following code modifies the reaction time variation of section with ID=106 to a value of 1. It first reads the current parameters before modifying one of them.
report = intp()
behParams = AKIInfNetGetSectionBehaviouralParam(106, report)
if report.value() == 0:
behParams.reactionTimeVariation = 1
AKIInfNetSetSectionBehaviouralParam(106, behParams, True)
AKIPrintString("OK")
else :
AKIPrintString("Not OK")
Read the Behavioral Parameters of a Section¶
In C++ and Python¶
Explanation¶
Reads the behavioral parameters of a section that will be used when applying the models and in the route choice calculations.
Format¶
A2KSectionBehaviourParam AKIInfNetGetSectionBehaviouralParam(int aid, int *report);
Parameters¶
- aid: section identifier.
Output¶
- report = 0: No Error. The current section behavioral parameters (see Modify the Behavioural Parameters of a Section).
- report < 0: Error.
Sample code in Python¶
The following code reads the behavioural parameters of section with ID=106 and prints the reaction time variation.
report = intp()
behParams = AKIInfNetGetSectionBehaviouralParam(106, report)
if report.value() == 0:
string = str(behParams.reactionTimeVariation)
AKIPrintString(string)
Modify the Behavioral Parameters of a Turn¶
In C++ and Python¶
Explanation¶
Modify the behavioral parameters of a turn that will be used when applying the models and in the route choice calculations.
Format¶
int AKIInfNetSetTurnBehaviouralParam(int aid, A2KTurnBehaviourParam behaviourParam);
Parameters¶
- aid: Turn identifier.
- behaviourParam: Behavior parameters for the turn.
The A2KTurnBehaviourParam structure is:
A2KTurnBehaviourParam{
double speedLimit;
bool yellowBoxBehaviour;
double distanceZone1;
double distanceZone2;
double waitingTimeBeforeLosingTurn;
double safetyMarginFront;
double safetyMarginBack;
double minimumGap;
double maximumGap;
double minGiveWayTimeFactor;
double maxGiveWayTimeFactor;
double visibilityDistanceMainStream;
The parameters are explained in detail in the Turn Editing Section and in the Gap Acceptance Model Section and the Land Choice Model Section.
- Turn speeds
- speedLimit: Speed limit of the turn in metric or imperial units determined by the preferences set in the Aimsun document
-
yellowBoxBehaviour: Yellow box behavior on/off.
-
Lane Selection
- distanceZone1: look-ahead for the lane-changing model.
-
distanceZone2: critical look-ahead for the lane-changing model.
-
Gap Acceptance
- waitingTimeBeforeLosingTurn:
- safetyMarginFront:
- safetyMarginBack:
- minimumGap:
- maximumGap:
- minGiveWayTimeFactor:
- maxGiveWayTimeFactor:
- visibilityDistance: Assessment distance on approach section
- visibilityDistanceMainStream: Assessment distance on conflicting sections.
Output¶
- = 0: No Error.
- < 0: Error.
Read the Behavioral Parameters of aTurn¶
In C++ and Python¶
Explanation¶
Reads the behavioral parameters of a turn that will be used in lane choice and gap acceptance.
Format¶
A2KTurnBehaviourParam AKIInfNetGetTurnBehaviouralParam( int idturn, int* report );
Parameters¶
- idturn: The turn identifier.
Output¶
- report = 0: No Error. and the current turn behavior parameters are returned by the function.
- report < 0: Error.
Modify the Capacity of a Section¶
In C++ and Python¶
Explanation¶
Modify the capacity of a section that will be used when applying the models and in the route choice calculations.
Format¶
int AKISetSectionCapacity(int aid, double capacity);
Parameters¶
- aid: Section identifier.
- capacity: New capacity (veh/h) assigned to the section.
Output¶
- = 0: No Error.
- < 0: Error.
Read the Capacity of a Section¶
In C++ and Python¶
Explanation¶
Read the capacity defined for a section.
Format¶
double AKIGetSectionCapacity(int aid);
Parameters¶
- aid: Section identifier.
Output¶
- > 0: Capacity of the specified section.
- < 0: Error.
Modify the User Defined Cost of a Section¶
In C++ and Python¶
Explanation¶
Modify the user defined cost of a section used when applying the models and in the route choice calculations.
Format¶
int AKISetSectionUserDefinedCost(int aid, double userdefinedcost);
Parameters¶
- aid: Section identifier.
- userdefinedcost: New user-defined cost of the section.
Output¶
- = 0: No Error.
- < 0: Error.
Read the User Defined Cost of a Section¶
In C++ and Python¶
Explanation¶
Read the user-defined cost for a section.
Format¶
double AKIGetSectionUserDefinedCost(int aid);
Parameters¶
- aid: Section identifier.
Output¶
- > 0: User-defined cost of the specified section.
- < 0: Error.
Modify the Second User Defined Cost of a Section¶
In C++ and Python¶
Explanation¶
Modify the second user defined cost of a section that will be used when applying the models and in the route choice calculations.
Format¶
int AKISetSectionUserDefinedCost2(int aid, double userdefinedcost);
Parameters¶
- aid: Section identifier.
- userdefinedcost: New second user-defined cost of the section.
Output¶
- = 0: No Error.
- < 0: Error.
Read the Second User Defined Cost of a Section¶
In C++ and Python¶
Explanation¶
Read the second user-defined cost defined for a section.
Format¶
double AKIGetSectionUserDefinedCost2(int aid);
Parameters¶
- aid: Section identifier.
Output¶
- > 0: Second user-defined cost of the specified section.
- < 0: Error.
Modify the Third User Defined Cost of a Section¶
In C++ and Python¶
Explanation¶
Modify the third user-defined cost of a section that will be used when applying the models and in the route choice calculations.
Format¶
int AKISetSectionUserDefinedCost3(int aid, double userdefinedcost);
Parameters¶
- aid: Section identifier.
- userdefinedcost: New third user-defined cost of the section.
Output¶
- = 0: No Error
- < 0: Error
Read the Third User Defined Cost of a Section¶
In C++ and Python:¶
Explanation¶
Read the third user-defined cost defined for a section.
Format¶
double AKIGetSectionUserDefinedCost3(int aid);
Parameters¶
- aid: Section identifier.
Output¶
- > 0: Third user-defined cost of the specified section.
- < 0: Error.
Read the Number of Junctions¶
In C++ and Python¶
Explanation¶
Read the number of junctions present on the road network. This function is equivalent to ECIGetNumberJunctions(), but it does not need a control plan loaded.
Format¶
int AKIInfNetNbJunctions ();
Parameters¶
None.
Output¶
- > 0: Correct number of junctions in the road network.
- < 0: Error.
Read the Identifier of a Junction¶
In C++ and Python¶
Explanation¶
Read the elem-th junction identifier present on the road network. This function is equivalent to ECIGetJunctionId(), but it does not need a control plan loaded..
Format¶
int AKIInfNetGetJunctionId (int elem)
Parameters¶
- elem: The number of junction and must be in the range 0 ≤ elem < Number of Junctions - 1.
Output¶
- > 0: Corresponding junction identifier.
- ≤ 0: Error.
Read the Number of Centroids¶
In C++ and Python¶
Explanation¶
Read the number of centroids present in the road network.
Format¶
int AKIInfNetNbCentroids();
Parameters¶
None.
Output¶
- ≥ 0: Number of centroids in the road network.
- < 0: Error.
Read the Identifier of a Centroid¶
In C++ and Python¶
Explanation¶
Read the elem-th centroid identifier present in the road network.
Format¶
int AKIInfNetGetCentroidId(int elem)
Parameters¶
- elem: The number of centroid and must be in the range 0 ≤ elem < Number of Centroids - 1.
Output¶
- > 0: Corresponding centroid identifier.
- ≤ 0: Error.
Read the Centroid Information¶
In C++ and Python¶
Explanation¶
Read the information of a centroid.
Format¶
A2KCentroidInf AKIInfNetGetCentroidInf(int aid)
Parameters¶
- Aid: Centroid identifier.
Output¶
struct A2KCentroidInf{
int report;
int id;
bool AsDestConsider_percentage;
bool AsOrigConsider_percentage;
bool IsOrigin;
bool IsDestination;
int NumConnecTo;
int NumConnecFrom;
};
where:
- report: 0, OK, else error code.
- id: Centroid identifier.
- AsDestConsider_percentage: Centroid considers destination connectors percentages when the centroid acts as destination.
- AsOrigConsider_percentage: Centroid considers origin connectors percentages when the centroid acts as origin.
- IsOrigin: True if the centroid acts as one origin.
- IsDestination: True if the centroid acts as one destination.
- NumConnecTo: Number of connectors To the centroid.
- NumConnecFrom: Number of connectors From the centroid.
Read the Object Identifiers of all Connectors to a Centroid (deprecated function)¶
In C++ and Python¶
Explanation¶
Read the object identifier for the elem-th section connected “to” the given centroid present on the road network.
Format¶
int AKIInfNetGetIdObjectofOriginCentroidConnector(int aid, int elem, bool &isSection)
Parameters¶
- aid: Centroid identifier.
- elem: The number of the “to” connector and must be in the range 0 ≤ elem < Number of Connectors “to” - 1.
- isSection: Returns if the result is a section or a node.
Output¶
- > 0: Corresponding section or node identifier.
- ≤ 0: Error.
Read the Section Identifiers of all Connectors to a Centroid¶
In C++ and Python¶
Explanation¶
Read the object identifier for the elem-th section connected “to” the given centroid present on the road network.
Format¶
int AKIInfNetGetIdObjectANGofOriginCentroidConnector(int aid, int elem, bool &isSection)
Parameters¶
- aid: Centroid identifier.
- elem: The number of the “to” connector and must be in the range 0 ≤ elem < Number of Connectors “to” - 1.
- isSection: Returns if the result is a section or a node.
Output¶
- > 0: Corresponding section or node identifier
- ≤ 0: Error
Read the Section Identifiers of all Connectors from a Centroid (deprecated function)¶
In C++ and Python¶
Explanation¶
Read the object identifier for the elem-th section connected “from” the given centroid present on the road network.
Format¶
int AKIInfNetGetIdSectionofDestinationCentroidConnector(int aid, int elem, bool &isSection)
Parameters¶
- aid: Centroid identifier.
- elem: The number of the “from” connector and must be in the range 0 ≤ elem < Number of Connectors “from” - 1.
- isSection: Returns if the result is a section or a node.
Output¶
- > 0: Corresponding section or node identifier.
- ≤ 0: Error.
Read the Section Identifiers of all Connectors from a Centroid¶
In C++ and Python¶
Explanation¶
Read the object identifier for the elem-th section connected “from” the given centroid present on the road network.
Format¶
int AKIInfNetGetIdObjectANGofDestinationCentroidConnector(int aid, int elem, bool &isSection)
Parameters¶
- aid: Centroid identifier.
- elem: The number of the “from” connector and must be in the range 0 ≤ elem < Number of Connectors “from” - 1.
- isSection: Returns if the result is a section or a node.
Output¶
- > 0: Corresponding section or node identifier.
- ≤ 0: Error.
Read the number of turns in the Network¶
In C++ and Python¶
Explanation¶
Read the number of turns in the whole network.
Format¶
int AKIInfNetNbTurns()
Output¶
The number of turns.
Read the turn identifier of a Turn¶
In C++ and Python¶
Explanation¶
Read the turn identifier for the elem-th.
Format¶
int AKIInfNetGetTurnId (int elem)
Parameters¶
- elem: The number of the turns in the network and must be in the range 0 ≤ elem < Number of Turns returned by the AKIInfNetNbTurns() function.
Output¶
- > 0: Corresponding turn identifier.
- &le 0: Error.
Read the Turn information¶
In C++ and Python¶
Explanation¶
Read the turn information for turn identifier.
Format¶
A2KTurnInf AKIInfNetGetTurnInf (int turnId)
Parameters¶
- turnId: The turn identifier.
Output¶
struct A2KTurnInf{
int report;
int id;
double length;
int originSectionId;
int destinationSectionId;
int originFromLane;
int originToLane;
int destinationFromLane;
int destinationToLane;
bool yellowBoxBehaviour;
};
where:
- report: 0, OK, else error code.
- id: Turn identifier.
- length: Turn length calculated considering Z coordinates.
- originSectionId: Origin section identifier.
- destinationSectionId: Destination section identifier.
- originFromLane: Origin from lane.
- originToLane: Origin to lane.
- destinationFromLane: Destination from lane.
- destinationToLane: Destination to lane.
- yellowBoxBehaviour: Whether the turn will take into account the yellow box (true) or not (false).
Read the Number of Turns in a Node¶
In C++ and Python¶
Explanation¶
Read the number of turns inside a node.
Format¶
int AKIInfNetGetNbTurnsInNode ( int nodeId )
Parameters¶
- nodeId: The node identifier.
Output¶
- > : The number of turns in the Node.
- ≤ 0: Error.
Read the Origin Section ID from a Turn¶
In C++ and Python¶
Explanation¶
Read the origin section identifier from a turn.
Format¶
int AKIInfNetGetOriginSectionInTurn ( int nodeId, int elem )
Parameters¶
- nodeId: The node identifier.
- elem: Turn number, between 0 and ("Number of Turns in node" - 1) returned by the AKIInfNetGetNbTurnsInNode( int nodeId ) function.
Output¶
- > 0: The Origin section identifier.
- ≤ 0: Error.
Read the Destination Section ID from a Turn¶
In C++ and Python¶
Explanation¶
Read the destination section identifier from a turn.
Format¶
int AKIInfNetGetDestinationSectionInTurn ( int nodeId, int elem )
Parameters¶
- nodeId: The node identifier.
- elem: Turn number, between 0 and ("Number of Turns in node" - 1) returned by the AKIInfNetGetNbTurnsInNode( int nodeId ) function.
Output¶
- > 0: The destination section identifier.
- ≤ 0: Error.
Read the Turn information from a Node¶
In C++ and Python¶
Explanation¶
Read the turn information from the elem-th turn in a node.
Format¶
A2KTurnInf AKIInfNetGetTurnInfo (int nodeId, int elem)
Parameters¶
- nodeId: The node identifier.
- elem: Turn number, between 0 and ("Number of Turns in Node" - 1) returned by the AKIInfNetGetNbTurnsInNode( int nodeId ) function.
Output¶
struct A2KTurnInf{
int report;
int id;
double length;
int originSectionId;
int destinationSectionId;
int originFromLane;
int originToLane;
int destinationFromLane;
int destinationToLane;
bool yellowBoxBehaviour;
};
where:
- report: 0, OK, else error code.
- id: Turn identifier.
- length: Turn length calculated including the Z coordinates.
- originSectionId: Origin section identifier.
- destinationSectionId: Destination section identifier.
- originFromLane: Origin from lane.
- originToLane: Origin to lane.
- destinationFromLane: Destination from lane.
- destinationToLane: Destination to lane.
- yellowBoxBehaviour: Whether the turn will take into account the yellow box (true) or not (false).
Read the number of sections in a shortest path ¶
In C++ and Python¶
Explanation¶
Read the shortest path number of sections between two section identifiers on the network.
Format¶
int AKIInfNetGetShortestPathNbSections(int fromSection, int toSection, void * sectionColumnCost );
Parameters¶
- fromSection: Origin section identifier.
- toSection: Destination section identifier.
- sectionColumnCost: Cost attribute used to calculate the shortest path.
Output¶
- > 0: Number of sections.
- ≤ 0: Error.
Read the shortest path¶
In C++ and Python¶
Explanation¶
Read the shortest path between two section identifiers on the network.
Format¶
int AKIInfNetGetShortestPath (int fromSection, int toSection, void * sectionColumnCost, int* path );
Parameters¶
- fromSection: Origin section identifier.
- toSection: Destination section identifier.
- sectionColumnCost: Cost attribute that will be used to calculate the shortest path.
Output¶
- = 0: Ok, path contains the shortest path defined as a section identifier vector.
- < 0: Error.
Sample Code in Python¶
nbSections = AKIInfNetGetShortestPathNbSections( 156, 548, sectionCostColumn )
if nbSections > 0:
path = intArray( nbSections )
result = AKIInfNetGetShortestPath( 156, 548, sectionCostColumn, path )
for index in range(0, nbSections):
AKIPrintString( "%d"%path[index] )
Read the network total length¶
In C++ and Python¶
Explanation¶
Read the total network length including all section lanes and turn connections.
Format¶
double AKIGetTotalLengthSystem();
Output¶
- > 0: Ok, the network total length.
- < 0: Error.
Convert coordinates from latitude/longitude to m/feet¶
In C++ and Python¶
Explanation¶
Convert given coordinates from latitude/longitude to m/feet using the "EPSG:4326" projection.
Format¶
int AKIConvertLatitudeLongitudeToXY( double latitude, double longitude, double *x, double *y );
Output¶
- = 0: Ok.
- x: The X coordinate in meters or feet depending on the network units.
- y: The Y coordinate in meters or feet depending on the network units.
Convert coordinates from m/feet to latitude/longitude¶
In C++ and Python¶
Explanation¶
Convert given coordinates from m/feet to latitude/longitude.
Format¶
int AKIConvertXYToLatitudeLongitude( double x, double y, double *latitude, double *longitude);
Output¶
- = 0: Ok.
- latitude: The latitude of the given (x,y).
- longitude: The longitude of the given (x,y).