Guchuan Liu, Rick Ayers, Blake Murillo, and Wing Tam


Using Visual Basic and MapObjects to Develop Mapping Applications


In 1995, Microsoft released one of its flagship products, Visual Basic 4.0, to software developers worldwide. Visual Basic 4.0 is a full 32-bit development system for Windows 95, NT 3.51 or later. Two of the major new features in Visual Basic 4.0 are OLE automation objects and new data access features. In the Fall of 1996, Esri released its first OLE product, MapObjects 1.0, which comprises 35 objects. These OLE objects are for use in object-oriented programming environments such as Visual Basic, Delphi or PowerBuilder.

So far, the combination of Visual Basic (VB) and MapObjects (MO) has been regarded as a positive step forward for mapping application development. Compared with other mapping applications developed with AML or Avenue, applications developed with Visual Basic and MapObjects have some significant advantages. First, it is easier to build programs with VB and MapObjects. The developers can apply nearly any OLE automation objects provided by Microsoft or other vendors into an application. Second, the application will have a small memory footprint. VB EXE files consume a small to modest portion of the system's memory. Third, the data from MapObjects draws much quicker than other windows mapping software. This is due to MapObjects running directly on the Microsoft Foundation Class (MFC). Another important advantage is, with VB Database Jet Engine the application handles large database queries and searches with extreme speed.

At Psomas and Associates, several applications have been developed using Visual Basic and MapObjects. These applications are for the City of Los Angeles' Stormwater Management Division. Job efficiency has been improved and response time has been shortened by the implementation of these applications. In this paper, a number of application examples will be demonstrated and several VB and MO technical issues for developing mapping applications will be explored. The DDE, OLE, Database Jet Engine, and functionality of MO will be discussed in some detail as well.


1. Integrating Visual Basic and ArcView through DDE Technology

One of Stormwater Management Division's chartered responsibilities in meeting with the National Flood Insurance Program, is to provide for public education to its citizenry. As an example, a "School Canopy and Curriculum GIS" application was developed to monitor and track stormwater education programs that were being presented at local elementary schools. With this application, Dynamic Data Exchange (DDE) technology has been used in conjunction with ArcView's Avenue. DDE is a mechanism supported by the Microsoft Windows operating system that allows two applications to "talk" to each other. It is used to continuously communicate and exchange data within an application environment.

Figure 1. Visual Basic interface for making selections and sending DDE requests to ArcView applications.

While developing the "School Canopy and Curriculum GIS", it was found that building an interface in VB would be much easier and more user-friendly than attempting to do the same in Avenue for ArcView (AV). With the VB form, various option buttons and list boxes can be placed on a single interface (see Figure 1), making navigation and use of the application intuitive for the user.

While applying DDE technology during the development of the "School Canopy and Curriculum GIS" there was a certain degree of caution that needed to be maintained. It was noticed that some applications developed using DDE were unstable and did not function properly. Usually, the problems occurred when there were too many DDE requests between two or more programs. One solution was to limit the DDE communication between the VB interface and the AV application to one-way communication. Meaning, all DDE requests will be sent from the VB interface to the AV application, but no communication from AV to VB. This design ensured application stability. Also, it made the VB interface and AV application easier to use and maintain.

There were three major functional components to the "School Canopy and Curriculum GIS" that should be pointed out.

For the first and the third functional components, two VB interfaces were developed. The first interface was used as the main interface (see Figure 1) and the second interface was used for updating database files. The option to modify the database files could be accessed by clicking the "Review/Update" button. For generating thematic maps, a specific AV application was developed. The AV application is directly engaged from the VB main interface and generates a thematic map layout based on information sent by DDE requests from the VB front-end. Using this integrated approach, high quality thematic maps could be generated by users of the application without requisite GIS skills.

2. Using MapObjects OLE objects with VB

In the suite of current applications that have been developed for SMD, three have used object linking and embedding (OLE) technology instead of DDE. The "Floodplain Determination GIS", "Floodplain Determination Internet GIS", as well as the "Repetitive Loss GIS" were developed using OLE objects from MapObjects.

Both DDE and OLE can be used to exchange information between applications. In fact, Microsoft strongly recommends VB developers to use OLE as opposed to DDE as their application's form of communication. As "OLE is a powerful and flexible technology for sharing data between applications in a manner that will continue functioning properly in future versions of Windows" (Microsoft, 1995).

One of the most obvious disadvantages to using DDE, as opposed to OLE, is the fore-grounding capability of the applications at work. While using DDE, the user is required to switch back and forth between two or more application windows. However, if using OLE objects, even from another sources, VB provides the tools to combine and communicate between application windows. For the end-users, the result is a single uniform environment that is much easier to use, maintain, and update (see figure 2).

Figure 2. The VB interface with a map window as an OLE object.

Using OLE from within MapObjects allows map windows to be placed in a VB form. Shapefiles can be loaded directly into the map window either at design time or at run time. Various manipulations can be applied to the map layer in the map windows. For example, spatial searching can be performed. Maps can be shaded according to its value. Layers can be turned on or off and controlled by scale. The user may also zoom in, zoomed out, or pan to other areas of the map display.

While developing mapping and GIS applications with VB, OLE objects can be used for both GIS and non-GIS related functions. For example, in the "Floodplain Determination GIS", we used Microsoft Word OLE objects for report generation of a FIRM legend and any other descriptive information.

In the testing of the developed applications, it was found that as long as shapefiles were spatially indexed, display speeds for operations such as zoom in, zoom out, or panning, could be increased significantly. On the other hand, if the spatial index was not built prior to using shapefiles in the application, the speed would be reduced by 3 to 5 times, especially for spatial searching and street labeling. So, prior to using shapefiles in MO applications, it is highly recommended that spatial indexes be built using either ArcView or the BuildIndex method in MO.

In the example of "Floodplain Determination GIS", it was found that extremely large shapefiles can be used in MO, as long as certain procedures were incorporated. In this application, the parcel polygon shapefile for the City of Los Angeles is approximately 500 Mb, which equates to nearly one million parcels within the city's administrative boundary. To use this large shapefile in the application, the spatial index was built first. While loading it into the MO box at run time, the extent is set as 1/30 of the full extent. This would ensure the map displayed almost instantly. At the parcel level, only a small area needs to be displayed each time. So, as long as the zoom in or zoom out is limited to a relatively small area, the display speed will be as fast as using a smaller shapefile. To prevent users from zooming to an extent that is undesirable for display, the full extent function for the map display was turned off at design time.

3. Searching Addresses with Microsoft's Database Jet Engine

There is now perhaps a new solution for querying large database files for address geocoding. When an address database file is large and the mapping application's speed is important, perhaps using Microsoft's Database Jet Engine is the solution. This new technology allows for extraordinary access speeds to extremely large database files.

The foundation for data access capability in Visual Basic is the Microsoft Database Jet Engine, the same database engine that powers Microsoft Access. "The Jet engine handles the mechanics of storing, retrieving, and updating data, and provides you with a powerful object-oriented programming interface: data access objects (DAO)." (Microsoft, 1995).

In the development of the previous application, there were often times that user was required to query very large database files. For example, the house-number address file for the City of Los Angeles. There are 8 columns (Parcel Identification Number, House Number, Street Direction, Street Name, Street Type, Zipcode, X coordinate and Y coordinate) and 960,000 rows, which represent all addresses within the City of Los Angeles administrative boundary. The size for this file is approximately 100 MB in dbf format. When address searching is performed on this file in ArcView and a moderately powerful machine is used (Pentium 90 with 64 MB RAM), it may take 10 seconds or more to locate an individual address match. Finding this speed to be unacceptable in most cases, we explored Visual Basic as a means for improved database query and retrieval.

The original house-number address file was originally provided in dbf format. We decided to convert the database file into Microsoft Access Database (MDB) format, which is the native database format for VB. The MDB files can then be manipulated directly by the VB Database Jet Engine and provide maximum flexibility and speed. After the MDB file was ready, indexes on all four address columns (house number, street direction, street name, and street type) were built in order to make the address searching quicker. Next, a VB procedure needed to be built for address searching. After some testing and modification, the address searching routine was optimized to allow for the most basic of address elements to be entered in order to get a match. Only three steps were needed:

Finally, this procedure was tested on the house-number address file. We had found that the address search speeds were much faster than those from ArcView. In 80 % of the time, a query can be completed within 1 second. In 15 % of the time, a query can be completed in 2 or 3 seconds. In 4 % of the time a query would take between 4 and 6 seconds. The overall performance is at least 5 times faster than the similar procedure built in Avenue.

When defining SQL, the Rushmore technology was used. "Rushmore is a data-access technology used in the Database Jet Engine that permits sets of records to be queried very efficiently." (Microsoft, 1995). For address searching in the "Floodplain Determination GIS" project, both bulk address searching and precise address searching were made available. For bulk address searching, the Rushmore technology was applied for quick speed. When the user inputs a few key characters, a scrolling list of addresses will be returned in one to two seconds. For example, if the user only enters "600" and "Spring" in the address input field boxes, several addresses that satisfy this query criteria will be returned. Here are some examples ("600 S. Spring St.", "6009 E Springvale Dr.", and "6002 E Springvale Dr.").

4. Building A GIS Web Site Using MapObjects Internet Map Server

"The explosion in Internet and WWW use has prompted thousands of organizations to build Web sites and home pages. The Web is a compelling and cost-effective way to share information within an organization or provide public access to information worldwide on the Internet." (Esri, 1996). Historically, the Web has only taken advantage of text and images. Now, with the introduction of new technologies, such as Java and ActiveX, Internet GIS can be developed for a variety of needs.

At this time, there are three major Internet GIS solution providers. They are Esri, Autodesk, and Intergraph. There are two solutions for serving GIS data via the Internet. For Autodesk's MapGuide and Intergraph's GeoMedia Web Map, both of them serve vector-based files over the Net. For Esri's MapObjects (MO) Internet Map Server (IMS), it serves a rasterized rendering of a map over the Net. When using MapGuide or GeoMedia, vector files are shipped directly to the client and downloaded. Functional advantages to this method are spatial in nature. Meaning, spatial operations like zoom in or zoom out will be performed locally in the computer's cache and very quickly. On the other hand, Esri's MO IMS serves a gif raster file to the client. So, spatial operations like zoom in or zoom out require a "round-trip" to be re-displayed. Meaning, when the user sends a new request to the server, the server application must generate a new gif file and send it back to the client.

The vector-based solution is quicker because vector files on the whole are much more compact than raster files. Also, any operation, which is run locally, will be much quicker than those running over the network. Unfortunately at this time, the standard Web browser (Netscape or Internet Explorer) can not support client-side display of vector files. So, specific plug-ins are required for both MapGuide and GeoMedia. Other significant limitations would include platform specific availability of plug-ins and also security.

Even though the raster-based solution from Esri requires a "round-trip" for screen refreshing, it does work with almost all Internet Web browsers and there is no need for a plug-in. In addition, Internet applications can be built with a variety of object-oriented languages, such as Visual Basic, Visual C++, and DELPHI that support ActiveX Controls (OCXs).

The application that was ported for Internet service was "Floodplain Determination GIS" (see figure 3). Considering the application had been developed using VB 4.0 and MO 1.1 it was an easy migration to the Internet environment. In addition, since MO IMS does not require any plug-ins, the Internet application developed with MO IMS can be accessed through virtually any browser on almost any platform.

The Internet version of "Floodplain Determination GIS" has kept a majority of its desktop functionality. There were two major functions to this version of the application.

Figure 3. The Internet GIS application running on an NT 4.0 server.

Subsequent to some additional modifications and the addition of the WebLink procedure, the application was Internet enabled. The average response time to address queries has been approximately 15 seconds, which was more than adequate for the project's needs. So far, our testing has determined that the developed Web site is accessible via PCs, Macs and UNIX workstations as well. The Web browser can be Internet Explorer (see figure 4), Netscape, America Online or any other that supports industry standard HTML files.

Figure 4. Accessing Floodplain Determination GIS Web page using Internet Explorer.

A limitation that was discovered in the development of our application was that MO IMS cannot handle multiple user requests or access automatically. To mitigate for this feature, procedures on the VB side should be designed to return all attributes needed for the next query. In our application, this concept was applied to make possible unlimited, multiple-user access.

Another note of interest in developing this application is that different browsers treat the attributes returned from the server slightly different. For example, for multiple spaces, Internet Explorer will keep all the spaces, while Netscape will truncate multiple spaces to a single space. It is minute difference like these, that if not addressed, could have a significant impact on the performance and overall functionality of the Internet application.

5. Conclusion

In this paper, VB and MO technologies have been discussed for GIS and mapping application development. Both the desktop and Internet environments have been explored for dissemination of GIS data as well. All of these elements have shown that mainstream technologies like ActiveX and Microsoft Database Jet Engine can be utilized as the primary development tool for GIS and mapping applications. The performance of these applications will also be significantly better than that of a traditional GIS technology. In 1997, the release of VB 5.0 and MO 2.0, means an even more powerful suite of desktop and Internet GIS solutions for mapping and information systems technology.

6. Acknowledgments

Thanks to Esri MapObjects team for their expert technical support during the application design and development. Thanks for the enormous support from Stormwater Management Division whom provided significant input on the applications needs assessments, application review and implementation. Thanks to everyone at Psomas and Associates who made this paper possible.  

7. References

Building Applications with MapObjects. Environmental Systems Research Institute, INC. 1996.

MapObjects Programmer's Reference. Environmental Systems Research Institute, INC. 1996.

Microsoft Visual Basic Programmer's Guide. Microsoft Corporation, 1995.

Microsoft Visual Basic Professional Features. Microsoft Corporation, 1995.

The Windows NT Web Server Handbook. Tom Sheldon, 1996. McGraw-Hill.

Author Information

Guchuan Liu, GIS Programmer

Psomas and Associates, Los Angeles Office

600 South Spring Street, Suite 1608

Los Angeles, California 90014

Tel: 213-623-3905, Fax: 213-623-3813, Email:


Rick Ayers, Assistant Project Manager and GIS Analyst

Psomas and Associates, Los Angeles Office

600 South Spring Street, Suite 1608

Los Angeles, California 90014

Tel: 213-623-3905, Fax: 213-623-3813, Email:


Blake Murillo, Vice President

Psomas and Associates, Santa Monica Office

600 South Spring Street, Suite 1608

Los Angeles, California 90014

Tel: 213-623-3905, Fax: 213-623-3813, Email:


Wing Tam, Engineering Manager

Stormwater Management Division, City of Los Angeles

650 South Spring Street, Suite 700

Los Angeles, California 90014

Tel: 213-847-5225, Fax: 213-847-5443, Email: