Home ~ IIS 6 ~ My Books ~ Articles ~ Serving you

Using ESRI's MapObjects to Build Database Client Applications   (continued)
Page 2 of 5 Next Page ->

One of the most powerful features of using a map control interface is the ability to perform spatial queries. Please refer to Figure 1 for an example of a spatial query as compared to a SQL statement. Users of any experience level can perform spatial queries because of the intuitive what you see is what you get (WYSIWYG) environment offered through the map control. Since the user is provided a map metaphor to interact with, MapObjects is an easily learned idiomatic paradigm. Of all the user interfaces available today, a map control like MapObjects makes one of the most complicated tasks of querying tabular data, one of the simplest activities a user can perform on a PC these days.

IIS 6: The Complete Reference is the most comprehensive book on IIS 6 - covering programming and administrative topics.

cover

IIS 6: The Complete Reference

Figure 1 - Comparison between Spatial Query and SQL Query Statement

Which method would you prefer to use? The above spatial query produces the same data set as the SQL query statement below except the SQL query statement was truncated for the purposes of brevity for this comparison.

SELECT [DDMND_DEMO].[DDMND_CUST_KEY], Sum([DDMND_DEMO].[DDMND_VOLUME]) AS Volume INTO SumVolumeQueryResult FROM [DDMND_DEMO], MITEM, MMODE WHERE (([DDMND_DEMO].[DDMND_MODE_KEY] = [MMODE].[MMODE_CODE] AND [DDMND_DEMO].[DDMND_ITEM_KEY] = [MITEM].[MITEM_CODE] AND [DDMND_DEMO].[DDMND_BUNDLE] = "*" AND [MITEM].[MITEM_WEIGHT] = 0.25 OR [MITEM].[MITEM_WEIGHT] = 20 OR [MITEM].[MITEM_WEIGHT] = 400 OR [MITEM].[MITEM_WEIGHT] = 551 OR [MITEM].[MITEM_WEIGHT] = 2000 AND [MITEM].[MITEM_TYPE] = "FN" OR [MITEM].[MITEM_TYPE] = "RW" OR [MITEM].[MITEM_TYPE] = "RW2" AND [MMODE].[MMODE_TYPE] = "LTL" OR [MMODE].[MMODE_TYPE] = "RL")) GROUP BY [DDMND_DEMO].[DDMND_CUST_KEY];

Great C++ Book 

cover
C++ All-in-One Desk Reference For Dummies

To demonstrate how to utilize existing database tabular relationships to perform spatial querying of data tables, an application was created which will be used to demonstrate the following tasks:

  1. Produce a spatial query on a MapObjects MapLayer object and output the results to a table grid control,
  2. Create a virtual join between an external database table and a MapObjects MapLayer object using the MapLayer AddRelate method,
  3. Perform a spatial query on a MapObjects MapLayer object that has an established virtual join with a table from an external database via the MapLayer AddRelate method,
  4. Perform a spatial query on a MapObjects MapLayer object and generate an SQL statement that will generate records from a non-AddRelated table in an external database and,
  5. Create a new shapefile from a MapObjects MapLayer object that has an established virtual join with a table from an external database via the MapLayer AddRelate method.

Great introduction to MySQL book

cover
MySQL: Your visual blueprint for for creating open source databases

Support Files and Resources

A sample application called ARDemo was built using Microsoft Visual Basic 5, to demonstrate the concepts presented in this article. The uncompiled sample code, sample database, and sample shapefile are all included in a zip file at: http://mapobject.com/images/ararticle/ardemo.zip. Although this article describes the systematic processes occurring within the application ARDemo, there are many other comments offered in the code at the proper context that may provide the reader a greater understanding of the principles presented in this article.

ESRI has released a 90-day evaluation version of MapObjects available as a free download at http://www.esri.com/software/mapobjects/download.html . This may be useful for testing and experimenting with MapObjects without having to make the purchase.

Fun and challenging C++ book.

cover
Windows Game Programming For Dummies®

Place the Northwind.mdb file and the files associated with the country.shp file in the same directory where the ARDemo executable program will run. If those files are not placed in the prescribed locations then the program will open with error messages. The files can be opened by entering the appropriate file paths in the respective text boxes at the top of the application.

Controls were kept at a minimum to simplify the code in the application ARDemo. The program was produced solely to demonstrate MapObjects functionality for the purposes of this article. The code standards adhere to the Visual Basic naming conventions presented in TechNet. The code is well commented to show the reader how to perform the tasks that are described in this article. ARDemo also writes variable values and object status information to a log file called AREventLog.txt in the same directory that the executable file resides. This log file grows considerably with use and should be deleted on occasions.

Introductory book to Access 2000

cover
Access 2000 For Dummies

Setting up Visual Basic to use MapObjects

The project was created on NT4 client with Service Pack 3 installed using Visual Basic 5 with Service Pack 3 installed. Required controls include MapObjects 1.2 (or MapObjects 1.1 with service pack 1 installed) and Microsoft Flexgrid, which comes with Service Pack 2, or Service Pack 3 for Visual Basic. Service Pack 3 for Visual Basic 5 is available as a free download at the Microsoft web site.

Required references, in addition to the typical Visual Basic references, include the associated references that accompany MapObjects and Microsoft Flexgrid and DAO 3.0. I have been given some reports (and even experienced this myself) that since the release of VB6, you might need to use DAO 3.51 or DAO 3.50 to make this work. When I set up a computer without any old versions of VB, Access or DAO, I had to use DAO 3.50 because I could not get DAO 3.0 to function. Quite honestly, I do not understand why DAO 3.0 is required for VB5 and DAO 3.51/3.50 is required for VB6 (or if this is even a valid assessment). I would recommend to start using DAO 3.0 and try DAO 3.50 or 3.51 if DAO 3.0 does not work.

For whatever it is worth, ESRI has produced a DAO 3.0 install program available as a free download at http://www.esri.com/devsupport/devconn/mapobjects/downloads/files/dao30.exe . Honestly, I have never used it because I always had DAO 3.0 installed. Subsequent installations that had DAO included with them (MS Access or Visual Basic) never uninstalled DAO 3.0 from my developement computer. I think this is a resource that is provided for users of the Borland products.

Next Page ->

MySQL Bible For Dummies is a great all around book for using and administering MySQL.

cover
MySQL Bible For Dummies

Next Page ->

Home ~ IIS 6 ~ My Books ~ Articles ~ Serving you

© Copyright 2000 Scott Hofmann. All Rights Reserved. Distribution of this document unedited in it's entirety is encouraged.