MapWindow:UsingActiveX

From MapWindow GIS

Jump to: navigation, search

The core MapWindow component is the ActiveX control, "MapWinGIS.ocx". This is an programming object that can be added to a form in Visual Basic, or other languages that support ActiveX, providing a built-in GIS data map. As engineers, we have tried to optimize it for use as a fully functional model interface, not just as a map viewer. This involved speeding up image and grid display, limiting the amount of redrawing that the user sees, and including application programmer interfaces (APIs) for low-level access to grid, shape, table and image data.

The full MapWinGIS ActiveX control documentation is an indispensable resource for learning to use the ActiveX control.

Here is an example of the simplest MapWindow project you can build:

Image:activex-screenshot-simplemap.gif

The code that adds this shape file to the map is:

Image:activex-screenshot-simplemap-code.gif

With a shape file layer loaded in the map, the user can navigate the map using the left and right mouse buttons to zoom-in and zoom-out.

Note that although I said this is the simplest MapWindow project you can build, I lied. Actually the simplest project would be to just put the map on a form and compile with no code. Although the program would start with an empty white box, a user could grab any shape file or geo-referenced bitmap and drop it in the map, and the map will display it.

The MapWindow core component can be more interesting when you add a few layers of data to it and provide other means for navigation.

For example, with just a few lines of code, the project above can be extended to display this:

Image:activex-screenshot-simplemap2.gif
The code for the above applicaton is:

Image:activex-screenshot-simplemap2-code.gif
Granted, these are very basic demonstrations, but the idea is to let you get a taste for what the control can do and how it can be used.

Additional functions of the core component ActiveX control include:

  • Open, create, edit, and save geo-referenced image, grid, shapefile, triangulated irregular network (TIN), and dbf (shape attribute) data directly;
  • View, label, color, highlight, shape file data in the map;
  • Perform spatial queries on the data;
  • Search for features with specific attributes;
  • Dynamically edit the spatial data and immediately see the changes in the map;
  • Interact with the data through the map;
  • Build TINs from Grids, Images from Grids, Shape files from TINs and Grids, Grids from Shape files, etc.
  • Much, much, more...
Personal tools