Syntax 

int PCMSGetRoadSpeed(Trip trip, const char *state, long type, bool urban = false)


Parameters 

Trip trip – Handle to a trip.


const char *state – The state/province/country abbreviation of the desired jurisdiction. Examples in North America are “NY” for New York or “QC” for Quebec. If PC*MILER|Worldwide or DTOD data is installed, country abbreviations for areas outside of North America can be used.


long type – A new set of defined constants that begin with ROADTYPE. Below are the valid road types, which are identical to the road types in the PC*MILER user interface:


#define
ROADTYPE_INTERSTATE
1
#define
ROADTYPE_MAJORHIGHWAY
2
#define
ROADTYPE_PRIMARY
3
#define
ROADTYPE_FERRY
4
#define
ROADTYPE_SECONDARY
5
#define
ROADTYPE_RAMP
6
#define
ROADTYPE_LOCAL
7

 

bool urban – Indicates if the roads are urban or not. Defaults to false.


Description

Gets the road speed for the given jurisdiction and road type.


Return Values 

Returns the road speed for the indicated values. Returns a -1 and an INVALID ARGUMENT error code if any supplied parameters are out of range, or if an invalid state is passed in.

 

Sample Code

int _CALLCONV PCMSGetRoadSpeed(Trip trip, const char *state, long type, bool urban)
{
      LOG_PROLOG4(PCMSSetRoadSpeed, trip, state, type, urban);
      if (type < ROADTYPE_INTERSTATE || type > ROADTYPE_LOCAL)
      {
              SetError(PCMS_INVALIDINPUT);
              LOG_RETURN1(-1);
      }
      GET_RT_ENGINE();
      GET_ROUTE(trip);
      GET_OPTIONS();
      int roadSpeed = pRt->GetRoadSpeed(state, type, urban);
      if (roadSpeed < 0)
      {
              SetError(PCMS_INVALIDINPUT);
              LOG_RETURN1(-1);
      }
      LOG_RETURN1(roadSpeed);
}


Supported Since: PC*MILER|Connect 29

Category: Trip Options