Skip to main content

PCMSGetRoadSpeed

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 Road Type Value
ROADTYPE_INTERSTATE Interstate 1
ROADTYPE_MAJORHIGHWAY Major Highway 2
ROADTYPE_PRIMARY Primary 3
ROADTYPE_FERRY Ferry 4
ROADTYPE_SECONDARY Secondary 5
ROADTYPE_RAMP Ramp 6
ROADTYPE_LOCAL 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 -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

Last updated July 19, 2025.