PC*MILER Connect includes several functions you can use to look up city/state pairs, postal and ZIP codes, and addresses. (Street-level data must be licensed and installed for addresses.) You may also want to spell check and validate city names before committing the engine to run the route.

  • PCMSLookup creates a list of matching cities and returns how many match your input.
  • PCMSGetMatch passes the index of the match wanted and a buffer to store the name.
  • PCMSGetFmtMatch formats the length of the place name before returning it.
  • PCMSGetFmtMatch2 formats the length of the place name before returning it, and also returns the address, city, state, ZIP code, and county.
  • PCMSGetFmtMatch3 returns the information in PCMSGetFmtMatch2 as well as the time zone in GMT offset format and whether it is in Daylight Savings Time.
  • PCMSGetFmtMatch4 returns the information in PCMSGetFmtMatch2 as well as the decimal latitude and longitude.


TIP: To validate place names with addresses, addresses must be separated from place names by a semi-colon in your input file; for example: 08540 Princeton, NJ;457 North Harrison St.


To look up a city and print the list of all matching cities, use code like this:

char buffer[255];
  
  \* Lookup all cities that match *\
  matches = PCMSLookup(trip, "PRI*, NJ", 0);
  printf ("%d matching cities to 'PRI*, NJ'\n", matches);
  
  \* Show all the matching cities. Note: You could use variable ‘matches’ below instead, since PCMSNumMatches() == matches.*\
  
  for (i = 0; i < PCMSNumMatches(trip); i++)
  {
    PCMSGetMatch(trip, i, buffer, 25);
    printf ("[%s]\n", buffer);
  }