How to Buy

TransCAD Brochure

Travel Demand Brochure

TransModeler Traffic Simulation Software

TransCAD Transportation Planning Software

Accessing TransCAD as a COM Object

GISDK provides an environment for accessing GISDK functions in a variety of ways. Using Caliper Script, you can write add-ins or custom applications composed of GISDK macros that call GISDK functions. These add-ins or custom applications are run from within TransCAD.

GISDK also allows you to call GISDK functions and macros from another application, written in another programming language such as Visual Basic. You do this using COM. TransCAD is accessed as a COM Object, which can provide map, data, and geographic analysis services. You write your application in a programming language that can make COM calls, and when you need map services you call the TransCAD object to supply those services.

You can call GISDK functions directly, or you can call GISDK macros, compiled in a UI Database, that call GISDK functions. Calling GISDK functions directly is good for simple operations, while using GISDK macros is helpful when doing more complex or frequently needed operations.

The COM model is designed so that clients have access to the full range of Caliper Script functions through the main TransCAD object. This object includes the methods for calling GISDK functions and macros with the necessary arguments.

The subsidiary MacroVal object provides a wrapper for the custom compound types that are used by many of the GISDK functions.


It is possible to work with GISDK classes (more…) from VBA. TransCAD provides a COM interface for accessing the GISDK via VBA and other COM client applications. This is documented in the TransCAD Help under the topic, "Accessing TransCAD as a COM Object" described above.

The CreateObject method requires a 2nd parameter, which is the path to the compiled GISDK user interface (UI) database which contains the class. Often the standard TransCAD UI database is referenced, and in the case this 2nd value can just be the empty string.

You can then use the COM methods named Get, Set and Method to get and set properties and call methods on the GISDK object from VBA.

Here is an example of how you would work with the Routing API:

Set Gisdk = CreateObject("TransCAD.AutomationServer")

coords = Array(Gisdk.Function("Coord", -71206120, 42321660), _
     Gisdk.Function("Coord", -71208932, 42349258))

Set router = Gisdk.CreateObject("Routing.Router", "")
router.Set "Minimize", "Distance"
Set path = router.Method("GeneratePath", coords)

How To

From VBA, you would use the References dialog ( ) to add a reference to the TransCAD Type Library. You can then use all the functionality of the TransCAD Automation Server API to work with TransCAD functionality. The example that we ship in GISDK\Samples\ACTIVEX is most applicable to this scenario.

If you were developing a Microsoft Access add-in in a .NET language, then you could alternatively use the CaliperForm API (more…).

Programming Examples:

Below are two VBA examples.

Private Sub Form_Load() 
     Set Gisdk = CreateObject("TransCAD.AutomationServer")
     Gisdk.RunMacro "MinimizeWindow", "Frame|"
     Gisdk.RunMacro "SetMapUnits", "Miles"
     ' Open the map used by this application '
     Gisdk.RunMacro "OpenMap", "gisdk\samples\activex\", Null
     ' Change its size to the size required by the client '
     Gisdk.RunMacro "SetWindowSizePixels", Null, 340, 270
     ' Change the current layer to the cities and towns layer '
     Gisdk.RunMacro "SetLayer", "Cities & Towns"
End Sub 

Private Sub GetMap_Click()
     ' Convert the town_name to upper case '
     town_name = UCase(TownName.Text)
     ' Locate the county specified by the client '
     Dim srch_value(1 To 1)
     srch_value(1) = town_name
     rh = Gisdk.RunMacro("LocateRecord", "Cities & Towns|", "[City Name]", srch_value, Null)
     If IsNull(rh) Then GoTo no_town       'No matching record was found'
     ' Read the name of the town located '
     layer = "Cities & Towns"
     Dim fldnm(1 To 1)
     fldnm(1) = "City Name"
     info = Gisdk.RunMacro("GetRecordValues", layer, rh, fldnm)
     found_name = info(1)(2)
     ' Check that the name matches the name requested '
     If Mid(found_name, 1, Len(town_name)) <> town_name Then GoTo no_town
     ' Zoom to that town '
     Set scp = Gisdk.RunMacro("GetRecordScope", rh)
     scp.Width = 15.1    'miles'
     scp.Height = 15.1   'miles'
     Gisdk.RunMacro "SetMapScope", Null, scp
     Gisdk.RunMacro "RedrawMap", Null
     ' Copy the map to the clipboard '
     Gisdk.RunMacro "CopyMapToClipboard", Null, Null
     ' Show the name of the located town in the edit text '
     TownName.Text = found_name
     ' Copy the map off the clipboard '
     Bitmap.Picture = Clipboard.GetData(CF_BITMAP)
     Exit Sub 
     MsgBox ("Town not found.")
     Exit Sub
     End Sub 
End Sub