Pinde Fu, Paul Rich, and Jue Wang
In many areas of scientific and engineering research, there is a fundamental need to integrate GIS software with users' own models and programs. Integration is difficult because of differences in data structure, function, methods for data I/O, user interface, and procedure communication. This leads to inconveniences and inefficiency. Herein, we demonstrate our approach to these problems using our design of the Solar Analyst and TopoView, tools for calculation of incoming solar radiation model (insolation) over landscape scales. The calculation engine of these models was implemented in DLL format using C++. The DLLs were then loaded into ArcView to create the Solar Analyst extension. ArcView GRIDIO library was used to read a DEM as input and write insolation GRIDs as output. This paper explains such techniques as ArcView GRIDIO usage, procedure communication (system call/DDE/DLL/ActiveX), design of DLLs, and on-line help systems for use with ArcView.
A major obstacle to GIS applications is the difficulty to integrate GIS with users' own models (Goodchild 1993). This difficulty is caused by incompatibility in data structures, data input and output, user interface, and capabilities of procedure communication. The use of GIS with other models is generally time consuming and costly. Both GIS and user models are underutilized due to the absence of a bridge between them. There is a crucial need to integrate them at the operational level.
This paper discusses issues concerning the integration of GIS with user models, including extending point-specific models to landscape and regional scales, as well as techniques for integration of model components.
Many user models, in particular non-GIS based models, are point-specific. Most physical and ecological models are developed for use in specific locations at a limited number of study sites. These models are often not easily generalized to other locations and broader spatial scales. Integration of these models in a GIS environment and extension to larger areas is essential for a more complete understanding of spatial patterns of key physical and ecological processes, as well as consequences of these processes (Forman and Godron 1986, Goodchild et al. 1996).
For example, incoming solar radiation (insolation) intercepted on the ground surface is influenced by topographic effects, including elevation, surface orientation, and topographic obstruction. For specific locations, the topographic effects are typically accounted for by visual estimation, or by the aid of upward-looking hemispherical photographs (Rich 1989, 1990, Rich et al. 1999). How can such point–specific models be integrated with GIS to calculate insolation for every location over an area? Two new insolation modeling tools, the Solar Analyst and TopoView, were designed for iterative calculation to produce insolation maps at landscape and regional scales.
Often it is difficult to acquire site–specific information needed to run point-based models in different locations. The key question is how to parameterize such models.
For example, to calculate insolation for any location using point-specific models, the following parameters are needed: elevation, slope, aspect, upward-looking hemispherical viewshed, atmospheric transmittivity, and diffuse proportion. The area-based model, the Solar Analyst or TopoView, requires these parameters for each location in a landscape (Fu and Rich 1999, Fu and Rich 2000, Rich and Fu 2000).There are two approaches to address the issue of providing appropriate parameters for different landscape positions:
For example, in the design of the Solar Analyst and TopoView, atmospheric parameters (transmittivity and diffuse proportion) are parameters the user must specify. The user can choose different values that apply to different atmospheric conditions conditions (clear sky, overcast…).
There are various ways to create parameter surfaces. The following are examples:
For example, the Solar Analyst and TopoView can optionally use slope and aspect surfaces created based on actual field measurements (which are more accurate than those calculated from a DEM), and can use different calculation assumptions (e.g. surface orientation corresponding to sensors or leaf orientation).
For example, in the Solar Analyst and TopoView, slope and aspect can also be calculated from the DEM (Hodgson 1995).
For example, point-specific models such as Canopy (Rich 1989) and HemiView (Delta-T 1999) account for the effects of sky obstruction by surrounding ground features using upward-looking hemispherical viewsheds obtained from photographs. Such approach are not practical for areas, and the calculation of upward-looking hemispherical viewsheds is not available in existing GIS software. The Solar Analyst and TopoView calculate upward-looking hemispherical viewshed for each cell of a DEM using customized C++ programs.
Integration of GIS with user models takes many forms, including file conversion, system calls, dynamic data exchange (DDE) / Remote Procedure Calls (RPCs), dynamic link libraries (DLLs), and ActiveX Control. These approaches offer different advantages and disadvantages, and vary in sophistication and effort required.
2.3.1 Usage of ArcView GRIDIO Library
ArcView GRIDIO is a grid data set input/output library that allows users to read and write Esri grid data sets directly. It includes a run-time library and C API. The usage of GridIO is not documented in the ArcView manual.
GRIDIO DLLs are always installed. By default they are located at c:\Esri\av_gis30\arcview\bin32. To install the C API, select custom installation while setting up the Spatial Analyst, then check the C API for grid data set I/O. This installation installs gioapi.h, avgridio.lib, several examples of C programs at c:\Esri\av_gis30\arcview\gridio.
Include gioapi.h: C++ uses the same calling convention and parameter-passing techniques as C, but its naming conventions are different because of C++ declaration of external symbols. The extern "C" syntax is needed in order to use GRIDIO with C++. The following is an example:
#ifndef _EsriGRIDIO_
extern "C" {
#include "c:\Esri\av_gis30\arcview\gridio\gioapi.h"
}
#define _EsriGRIDIO_
#endif
Link avgridio.lib: avgridio.lib should be specified as link library.
Specify Path to AVGRIDIO DLLs: The directory to the GRIDIO DLLs (e.g. c:\Esri\av_gis30\arcview\bin32) should be included in the PATH environment variable.
Other important details involve memory allocation and use of large grids. Before reading grids into computer RAM, memory needs to be allocated. The GRIDIO library requires that the underlying data array for a two–dimensional buffer is 1–Dimensional contiguous. GetWindowRow, GetWindowBand, and GetWindowRectangle can not read gridbbs that have more than 1024 columns. In such situations, GetWindowCell should be used.
2.3.2 Design of DLLs for use with ArcView
The topic of designing DLLs for use with ArcView is not well documented in the ArcView Manual. The following is our approach:
Exporting functions
// C Source Code for math.dll
#include <windows.h>
long AddLongs(long a, long b)
{
return a + b;
}
'Avenue Script to Call AddLongs
myDLL = DLL.Make("c:\lib\math.dll".AsFileName)
add = DLLProc.Make(myDLL, "AddLongs", #DLLPROC_TYPE_INT32,
{#DLLPROC_TYPE_INT32, #DLLPROC_TYPE_INT32})
x = add.Call({500, 200})
MsgBox.Info("The result is " + x.asString, "")
In our experience, the following math.def should be added and linked at compilation time in order to make the example work.
; math.def
LIBRARY math.dll
CODE PRELOAD MOVEABLE DISCARDABLE
DATA PRELOAD SINGLE
EXPORTS
AddLongs
Calling C++ class member functions:
GIS does not provide all functions needed by all users. Most GIS users face the challenge of integrating their own models with GIS software. Some user models can be implemented using the programming language of the GIS software, while some can not. Many user models are point-specific and not easily ported to a GIS environment. Extending these models to large areas in a GIS environment can be accomplished by obtaining data layers of parameters for the areas. System integration can be accomplished by using common files, system calls, DDE/RPC, DLLs, or Active X controls, according to specific user needs. There is growing interest in extending point-specific processes to broader spatial scales, using spatially explicit raster models. ArcView GRIDIO provides an easy way for non-Esri products to directly access Esri grid data. This paper addresses ways to export C++ functions and workarounds to call C++ member functions when developing DLLs for use with ArcView. As GIS is used in more and more ways to solve more complex problems, the topic of integrating GIS with user models becomes increasingly important.
Burrough P.A. and R.A. McDonnell. 1998. Principles of Geographical Information Systems. Oxford University Press, New York, USA.
Forman, R.T. and M. Godron. 1986. Landscape Ecology. Wiley, New York, USA.
Fu, P. and P.M. Rich. 1999. Design and implementation of the Solar Analyst: an ArcView extension for modeling solar radiation at landscape scales. Proceedings of the 19th Annual Esri User Conference, San Diego, USA.
Fu, P. and P.M. Rich. 2000. The Solar Analyst 1.0 Manual. Helios Environmental Modeling Institute (HEMI), USA.
Goodchild, M.F., L.T. Steyaert, B.O. Parks, C. Johnston, D. Maidment, M. Crane, and S. Glendinning (eds). 1996. GIS and Environmental Modeling: Progress and Research Issues. GIS World Books, Fort Collins, USA.
Goodchild, M.F. 1993. The state of GIS for environmental problem-solving. Environmental Modeling with GIS, Oxford University Press, p8-15.
Hodgson, M.E. 1995. What cell size does the computed slope/aspect angle represent? Photogrammetric Engineering and Remote Sensing, 61:513-517.
Rich, P.M. and P. Fu. 2000. Enlightenment for mapping systems – solar radiation modeling looks to the sun for answers, Resource Magazine, 7(2):7-8.
Rich, P.M., J. Wood, D.A. Vieglais, K. Burek, and N. Webb. 1999. Guide to HemiView: software for analysis of hemispherical photography. Delta-T Devices, Ltd., Cambridge, England.
Rich, P.M. 1990. Characterizing plant canopies with hemispherical photography. In: N.S. Goel and J.M. Norman (eds). Instrumentation for studying vegetation canopies for remote sensing in optical and thermal infrared regions. Remote Sensing Reviews 5:13-29.
Rich, P.M. 1989. A manual for analysis of hemispherical canopy photography. Los Alamos National Laboratory Report, LA–11733–M.