Flylib.com

Books Software

 
 
 

Section 2.7. Where Are We?


2.7. Where Are We?

In this chapter, we have discussed how to use MapPoint 2004 APIs to develop applications with basic functionalities, such as finding places, addresses, and latitude/longitude; displaying locations on a map; zooming into a location; and panning maps. When you develop your applications using MapPoint 2004 ActiveX Control, try to reuse the UI that comes with ittoolbars, panes, dialogs, etc. We have also discussed using the MapPoint 2004 routing API to optimize, calculate, and personalize routes. It is important to keep in mind that you are working with a set of COM objects with a managed wrapper around them, so be sure to call the Quit method on the MapPoint.Application object when you are done with your tasks .

While it seems to be a lot of information, these concepts are really the core of MapPoint 2004 programming, and we will be using them more in the next chapter when we discuss dealing with business data and MapPoint 2004 data APIs.



Chapter 3. Working with Data in MapPoint 2004

MapPoint 2004 can process, analyze, and display business data based on location, and it can then create demographic maps, thematic maps, territories , time zone maps, and shapes on maps. MapPoint 2004 ships with extensive built-in demographic data and a set of APIs to import, analyze, and display your business data from variety of sources.

This chapter has three major sections that correspond to the common tasks of working with:

  • MapPoint demographic data

  • Your own data

  • Shapes on maps

I will assume that you are familiar with the basic MapPoint 2004 programming model (if not, refer to Chapter 2 of this book). The sample data and code used in this chapter is available in the book's companion material in the Chapter03 directory.



3.1. Understanding the MapPoint 2004 Data API

In MapPoint 2004, both business data and demographic data are represented using the DataSet class. An active Map object exposes the DataSets collection, which you use to access a valid DataSet object. How does a DataSets collection get its data wrapped as a DataSet object? The DataSets collection is different from traditional .NET collectionsit not only exposes a collection of DataSet objects, but it also offers methods to import external data and to access MapPoint 2004 demographic data.

A DataSet object is similar to a data table with rows and columns and regular querying capabilities. However, a DataSet object allows you to query the records or data rows based on location information. Each query results in a Recordset object containing the records that satisfy the location-based query. The DataSet object can also be used to display data on maps. In essence, if you are using any data features (such as data maps, territories , etc.) in MapPoint 2004 APIs, the DataSet class is the root for all these tasks ; Figure 3-1 shows the relationships between an active Map object, a DataSets collection, a DataSet object, and a Recordset object.

Figure 3-1. MapPoint 2004 data- related API object model

It is important to note that the DataSet and RecordSet objects shown in the MapPoint object model are different from the Dataset and RecordSet classes defined in the System.Data namespace in the .NET Framework.


Tables 3-1 and 3-2 show some of the key methods exposed on the DataSet and RecordSet objects.

Table 3-1. Key Methods in the DataSet object

Method Name

Description

DisplayDataMap

Displays a set of data on a map

QueryAllRecords

Returns all records in a DataSet as a RecordSet object

QueryShape

Returns records that fall within a specified shape on the map as a RecordSet object

ZoomTo

Zooms to the best map view of the specified DataSet object


Table 3-2. Key methods in the RecordSet object

Method Name

Description

MoveFirst

Sets the current record of the RecordSet to the first record

MoveNext

Sets the current record of the RecordSet to the next record


With this introduction, let's look at specifics of dealing with visualization of data using MapPoint 2004.