Have questions? Call us toll-free at 1-866-847-7510 (outside North America, call 1-785-727-4133)

Map Suite Vehicle Tracking Starter Kit Quick Start Guide

From ThinkGeo Wiki

Jump to: navigation, search
Info Balloon

This QuickStart Guide will show you how you can use the Map Suite Vehicle Tracking Starter Kit to easily develop a Web-based vehicle tracking project with ThinkGeo's Map Suite Web Edition. Please note that in order to follow the examples below, you will need to have installed Map Suite Web Edition 6.0 or higher (either the free evaluation or full licensed version).

Welcome to the Map Suite Vehicle Tracking Starter Kit from ThinkGeo®. This QuickStart Guide will show you how you can use the Starter Kit to easily develop a Web-based vehicle tracking project with ThinkGeo's Map Suite Web Edition. Using the intuitive object model, even developers inexperienced in Geographic Information Systems (GIS) can have a fully functional vehicle tracking application working in minutes.

When you open the Vehicle Tracking Starter Kit solution with Visual Studio, you are presented with four projects.

Contents

Introduction of the Four Projects

We have included two main implementations of vehicle tracking. One is a Server implementation, which uses server-side events and an Update Panel, while the other implementation is an AJAX version, which uses Callback technology. Each implementation is offered in both a C# and a VB.NET project, making for a total of four projects. The functionality is exactly the same between these four projects but the implementation methodology is totally different.

Server implementation: Almost all of the functionality is implemented by using server-side events so that you can easily understand what the events are doing and so that you can easily debug with Visual Studio. However, please note that some client states are not disposed of by the Update Panel, so that when running this application for a long time there may be memory leaks on the client side.

AJAX implementation: Almost all of the functionality is implemented by using client-side JavaScript. As such, we don't need to postback to the server side every time; instead, we use Callback technology to minimize the need to transfer data over the Internet, which enhances the user experience.

QSG VehicleTracking Img01.png


Overview of Vehicle Tracking

QSG VehicleTracking Img02.jpg


(1) Vehicle Information

QSG VehicleTracking Img03.png


Robert": Name of the vehicle driver.
"In Motion": Current vehicle's status. It is "Idle" when the vehicle is motionless for 4 minutes.
"Date": Date and time at which the vehicle was most recently tracked.
"Area": Indicates whether the vehicle is inside of a spatial fence or not. In this sample, we have defined a spatial fence as a warning district. If any vehicle enters the warning district, it shows a warning here such as:

QSG VehicleTracking Img04.png
"Speed": Current vehicle speed.
"Duration": The time, in minutes, that the vehicle has been traveling at the same speed.

(2) Auto Refresh

Click this button to simulate loading data from GPS on the fly. This will make the vehicle move and update the vehicle information as well.

QSG VehicleTracking Img05.png

(3) Pan Button

QSG VehicleTracking Img06.png

Click this button to navigate the map by using tools such as panning, mouse wheel zooming and track zoom in.

(4) Draw Spatial Fence

Click the "Draw Fence" button to open the following dialog.

QSG VehicleTracking Img07.png

QSG VehicleTracking Img08.png Click this button to draw a new spatial fence on the map.
QSG VehicleTracking Img09.png Click this button to edit existing spatial fences.
QSG VehicleTracking Img10.png Click this button to save the spatial fences to the database. It's not enabled until you click either the track spatial fence button or the edit button.
QSG VehicleTracking Img11.png Click this button to delete the selected spatial fences from the map. It's not enabled until you click the edit button.

(5) Measure Tool

QSG VehicleTracking Img12.png

Click this button to activate the measurement function on the map. When this function is activated, you can click on the map to begin drawing a polyline (a line with one or more segments). Each additional click will begin drawing a new segment of the same line. You can double-click to finish drawing the polyline. When you do, a bubble displaying the total length of the line will appear on the map.

QSG VehicleTracking Img13.png

Using SQL Server Instead of Access

It is easy to transfer this project from using a Microsoft Access Database to using Microsoft SQL Server instead. In the Vehicle Tracking Starter Kit's installation folder, there is a subfolder called App_Data that contains a file named VehicleTrackingDb.mdf.

QSG VehicleTracking Img14.png


Attach this data file to your SQL Server; three tables will be generated automatically.

QSG VehicleTracking Img15.png


Next, modify the connection string for SQL Server in the web.config file. Here is an example:

<connectionStrings>
    <add name="VehicleTrackingDbConnectionString" connectionString="Data Source=[ServerName];Initial Catalog=[DatabaseName];Persist Security Info=True;User ID=[UserName];Password=[Password]" />
</connectionStrings>

Now you have successfully configured the environment to use SQL Server. As a next step, you need to make a few changes within the project code. Let's take the "CSWebAjaxSample" project for example; to begin, please open "VehicleTracking.aspx.cs". You may notice that this file contains many comments that have been written to help you easily understand this application and how it works. In the code, you will find a data provider whose type is "TrackingAccessProvider"; in addition, there will be a commented-out snippet of code above it. It should look like this:

// using (TrackingSqlProvider dataProvider = new TrackingSqlProvider(ConfigurationManager.ConnectionStrings["VehicleTrackingDbConnectionString"].ConnectionString))
//
using (TrackingAccessProvider dataProvider = new TrackingAccessProvider(MapPath(ConfigurationManager.AppSettings["AccessDataBase"])))

This object is responsible for all of the communication with the database. To switch from using the Access provider to the SQL Server provider, uncomment the line that begins using (TrackingSqlProvider, then comment-out the line that begins using (TrackingAccessProvider. Do this everywhere this code occurs in the "VehicleTracking.aspx.cs" file. Once you have made these changes, press F5 to run the application and verify that its connection to your SQL Server is working properly.

Summary

Now you know the basic functionality of the Map Suite Vehicle Tracking Starter Kit. Please enjoy experimenting with this project and learning from the code and our comments therein. We hope the sample code provided in this Starter Kit will help guide you in the right direction toward implementing a higher performance vehicle tracking application with Map Suite Web Edition.

Personal tools
Namespaces
Variants
Actions
Products
Data
Add Ons
Navigation
Toolbox
Learn More About Map Suite, Download a Free Trial, or Buy Now

GIS Developer Components for .NET
Map Suite Extensions & Add-Ons
Map Data Sets & Icons

Try Map Suite Free

Map Suite Online Store
sales@thinkgeo.com
1-866-847-7510 (Toll-Free)
1-785-727-4133 (Outside North America)

ThinkGeo LLC
2801 Network Blvd. Suite 215
Frisco, TX 75034
Map Suite Support Center