This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
map_suite_routing_quick_start_guide [2015/09/10 09:43] admin [Summary] |
map_suite_routing_quick_start_guide [2017/03/17 05:12] (current) tgwikiupdate |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== Map Suite Routing Quick Start Guide ====== | ====== Map Suite Routing Quick Start Guide ====== | ||
+ | |||
+ | {{section>upgrade_map_suite_to_10.0}} | ||
<div msgbox> | <div msgbox> | ||
Line 18: | Line 20: | ||
While the Map Suite Routing extension takes care of the business of routing and providing directions, in order to display it on an interactive map you need to use a control like Map Suite Desktop Edition. | While the Map Suite Routing extension takes care of the business of routing and providing directions, in order to display it on an interactive map you need to use a control like Map Suite Desktop Edition. | ||
- | If you installed the ThinkGeo Product Center in the default location, your Map Suite Routing 9.0 assemblies will be located in <kbd>C:\Program Files (x86)\ThinkGeo\Map Suite 9.0\Map Suite Routing</kbd>. | + | If you installed the ThinkGeo Product Center in the default location, your Map Suite Routing 9.0 assemblies will be located in //C:\Program Files (x86)\ThinkGeo\Map Suite 9.0\Map Suite Routing//. |
===== Download Routing Explorer ===== | ===== Download Routing Explorer ===== | ||
- | <faicon fa fa-download fa-lg> {{:File:MapSuite Routing Explorer.zip|Download Routing Explorer}} //(1.95 MB)// | + | <faicon fa fa-download fa-lg> {{filehistory:MapSuite Routing Explorer.zip|Download Routing Explorer}} //(1.95 MB)// |
===== Download the Sample ===== | ===== Download the Sample ===== | ||
- | <faicon fa fa-download fa-lg> {{:File:HelloWorld Routing.zip|Download Sample Code From This Exercise}} //(1.76 MB)// | + | <faicon fa fa-download fa-lg> {{https://github.com/ThinkGeo/RoutingSample-ForWinForms|Download Sample Code From GitHub}} |
===== Setting up the Environment ===== | ===== Setting up the Environment ===== | ||
Let's start with a new Windows Forms project in Microsoft Visual Studio (2012 or newer) and call it HelloWorld (see Figure 1). We can create the project with .NET Framework 4.0 or 4.5. | Let's start with a new Windows Forms project in Microsoft Visual Studio (2012 or newer) and call it HelloWorld (see Figure 1). We can create the project with .NET Framework 4.0 or 4.5. | ||
- | {{routing|QSG_Routing_Img001.png|Figure 1. Creating a new project in Microsoft Visual Studio.}} | + | {{routing:QSG_Routing_Img001.png}} |
+ | \\ | ||
+ | //Figure 1. Creating a new project in Microsoft Visual Studio.// | ||
The project "HelloWorld" is created in a new solution called "HelloWorld". The wizard creates a single Windows Form. | The project "HelloWorld" is created in a new solution called "HelloWorld". The wizard creates a single Windows Form. | ||
Line 41: | Line 45: | ||
Hover on the Toolbox and right click anywhere on the list of controls. You will get a pop-up menu. Select "Choose items..." | Hover on the Toolbox and right click anywhere on the list of controls. You will get a pop-up menu. Select "Choose items..." | ||
- | {{Figure|QSG_Routing_Img02.png}} | + | {{routing:QSG_Routing_Img02.png}} |
**2.** The Choose Toolbox Items dialogue will appear. You will need to select the ".NET Framework Components" tab and then click the "Browse..." button. Finally, navigate to the // C:\Program Files (x86)\ThinkGeo\Map Suite 9.0\Map Suite Routing\Current Version\Managed Assemblies// folder and select the "DesktopEdition.dll" file. | **2.** The Choose Toolbox Items dialogue will appear. You will need to select the ".NET Framework Components" tab and then click the "Browse..." button. Finally, navigate to the // C:\Program Files (x86)\ThinkGeo\Map Suite 9.0\Map Suite Routing\Current Version\Managed Assemblies// folder and select the "DesktopEdition.dll" file. | ||
- | {{Figure|QSG_Routing_Img03.png}} | + | {{routing:QSG_Routing_Img03.png}} |
**3.** You should now have the Map control available in your Toolbox as shown below. | **3.** You should now have the Map control available in your Toolbox as shown below. | ||
- | {{Figure|QSG_Routing_Img04.png|Figure 2. The Map Controls under the Toolbox window.}} | + | {{routing:QSG_Routing_Img04.png}} |
+ | \\ | ||
+ | \\Figure 2. The Map Controls under the Toolbox window.\\ | ||
Draw the Map control on the form by clicking on the Map control in the Toolbox and then dragging the map onto the form. You can also size the map to your desired width and height. You can leave the name of Map control as winformMap1. | Draw the Map control on the form by clicking on the Map control in the Toolbox and then dragging the map onto the form. You can also size the map to your desired width and height. You can leave the name of Map control as winformMap1. | ||
- | {{Figure|QSG_Routing_Img05.png}} | + | {{routing:QSG_Routing_Img05.png}} |
===== Adding References to the Map Suite Routing "Hello World" Sample ===== | ===== Adding References to the Map Suite Routing "Hello World" Sample ===== | ||
We now have the "DesktopEdition.dll" referenced. Next, we need to add "MapSuiteCore.dll" and "MapSuiteRouting.dll" to the references. Right-click the project in the Solution Explorer and select "Add Reference...", navigate to the // C:\Program Files (x86)\ThinkGeo\Map Suite 9.0\Map Suite Routing\Current Version\Managed Assemblies// folder and select those two files. | We now have the "DesktopEdition.dll" referenced. Next, we need to add "MapSuiteCore.dll" and "MapSuiteRouting.dll" to the references. Right-click the project in the Solution Explorer and select "Add Reference...", navigate to the // C:\Program Files (x86)\ThinkGeo\Map Suite 9.0\Map Suite Routing\Current Version\Managed Assemblies// folder and select those two files. | ||
- | {{Figure|QSG_Routing_Img06.png}} | + | {{routing:QSG_Routing_Img06.png}} |
Now we are ready to add code. | Now we are ready to add code. | ||
Line 70: | Line 76: | ||
Build the routing routable file(.routable.shp). | Build the routing routable file(.routable.shp). | ||
- | {{Figure|QSG_Routing_Img06_1.png}} | + | {{routing:QSG_Routing_Img06_1.png}} |
- | {{Figure|QSG_Routing_Img06_2.png}} | + | {{routing:QSG_Routing_Img06_2.png}} |
Build the routing index file (.rtg/.rtx) using the included Map Suite Routing Explorer tool. (See Figure 4) | Build the routing index file (.rtg/.rtx) using the included Map Suite Routing Explorer tool. (See Figure 4) | ||
- | {{Figure|QSG_Routing_Img06_3.png}} | + | {{routing:QSG_Routing_Img06_3.png}} |
- | {{Figure|QSG_Routing_Img07.png|Figure 4. Building the routing index file with Map Suite Routing Explorer.}} | + | {{routing:QSG_Routing_Img07.png}} |
+ | \\ | ||
+ | // Figure 4. Building the routing index file with Map Suite Routing Explorer. // | ||
- | (**NOTE:** The data used in this sample can be found in the attached sample project's <kbd>App_Data</kbd> folder. Please download the {{:File:MapSuite Routing Explorer.zip|Map Suite Routing Explorer}} tool to acquire it.) | + | (**NOTE:** The data used in this sample can be found in the attached sample project's //App_Data// folder. Please download the {{filehistory:MapSuite Routing Explorer.zip|Map Suite Routing Explorer}} tool to acquire it.) |
==== Map Suite Routing Extension "Hello World" ==== | ==== Map Suite Routing Extension "Hello World" ==== | ||
Line 120: | Line 128: | ||
Figure 4 shows what you'll see when you run your application. | Figure 4 shows what you'll see when you run your application. | ||
- | {{Figure|QSG_Routing_Img08.jpg|Figure 4. Initialize the map for finding a route.}} | + | {{routing:QSG_Routing_Img08.jpg}} |
+ | \\ | ||
+ | // Figure 4. Initialize the map for finding a route.// | ||
2. Find the shortest route and render it on the map. | 2. Find the shortest route and render it on the map. | ||
Line 151: | Line 161: | ||
Run the sample and click the "Find The Shortest Path" button. You will see the result as shown in Figure 5. | Run the sample and click the "Find The Shortest Path" button. You will see the result as shown in Figure 5. | ||
- | {{Figure|QSG_Routing_Img09.jpg|Figure 5. The shortest path between points has been generated.}} | + | {{routing:QSG_Routing_Img09.jpg}} |
+ | \\ | ||
+ | // Figure 5. The shortest path between points has been generated.// | ||
(**NOTE:** We can also use ''InMemoryFeatureLayer'' to render the routing result; ''RoutingLayer'' is just a shortcut to make it more convenient.) | (**NOTE:** We can also use ''InMemoryFeatureLayer'' to render the routing result; ''RoutingLayer'' is just a shortcut to make it more convenient.) | ||
Line 286: | Line 298: | ||
Let's run the application and click the "Find The Shortest Path" button. You will see the path and stops rendered on the map as shown in Figure 6. | Let's run the application and click the "Find The Shortest Path" button. You will see the path and stops rendered on the map as shown in Figure 6. | ||
- | {{Figure|QSG_Routing_Img10.jpg|Figure 6. Finding path with intermediate stops.}} | + | {{routing:QSG_Routing_Img10.jpg}} |
+ | \\ | ||
+ | // Figure 6. Finding path with intermediate stops.// | ||
(**NOTE:** The Map Suite Routing Extension doesn't support finding a path between Matrix points (Points-to-Points Route), so the intermediate stops must be added in order.) | (**NOTE:** The Map Suite Routing Extension doesn't support finding a path between Matrix points (Points-to-Points Route), so the intermediate stops must be added in order.) | ||
Line 297: | Line 311: | ||
-The ''RoutingLayer'' is a convenient class for finding and rendering a route. It allows us to add sequential intermediate stops. | -The ''RoutingLayer'' is a convenient class for finding and rendering a route. It allows us to add sequential intermediate stops. | ||
- | <faicon fa fa-download fa-lg> {{:File:HelloWorld Routing.zip|Download Sample Code From This Exercise}} //(1.76 MB)// | + | <faicon fa fa-download fa-lg> {{filehistory:HelloWorld Routing.zip|Download Sample Code From This Exercise}} //(1.76 MB)// |