This sample shows how to programmatically create a web-based geocoding and
routing solution. This sample demonstrates in particular:
- using the TGIS_Geocoding class
- using the TGIS_ShortestPath class
- street address querying
- optimal routing using StartPos and StopPos features
- cost based routing
Cost based routing is of particular interest, because it allows the on-line
user to specify a cost (or preference) factor for each road type. (This
particular TIGER sample contains only two road types, one representing local
streets and one representing main roads.) For instance, if the speed limit is
higher on the main roads than on the local streets, the major roads can be
assigned a lower cost (higher preference) factor than the local streets. The
result is that the "optimal route" is calculated taking this preference into
consideration, not simply the shortest route.
To use this sample, first identify the starting position by entering one of
the following in the "From:" field: a street name, street name and number,
or the names of two streets which intersect at some point. To just query for
the map location of this place, click on the "Find Address" button.
Use the same method to specify a second location in the "To:" field and then
click on the "Find Route" button to calculate the optimal route between the
two map locations which reflects on the preference (cost) settings. The starting
location is presented on the map by the green point, the destination location is
presented by the red point, and the route between the two locations is presented
by the red line.
Just entering the first few letters of a street name generally works fine. When
entering only a street name with no address number, the query will return the
first segment of the specified street contained in the database. (This is because
each street segment in a raw TIGER dataset is a separate record.) When entering
the names of two intersecting streets in one field to specify a location, use
" & " to separate the names. An example would be
"Lafayette & Illinois".