A library of higher-level programming macros to read ESRI Arc/Info generated Shape Files, including points, lines, and coverages.
Name | Type | Description | |
filename | string | name of the ShapeFile to be read | |
Name | Type | Description | |
out_mesh | Mesh | geometry mesh output | |
out_obj | DataObject | directly renderable output object | |
The ReadShape.Program library contains a suite of functional macros for reading Shape files into AVS/Express. Shape files are a binary file format that is exported by Arc/Info, and other GIS products from ESRI. The files contain point, line and polygon geometric information, generally representing vector-style map data, such as roads, cities, rivers, and area boundaries. This format is common in GIS (Geographic Information Systems) and can be used to combine data from a number of sources.
The macros in the ReadShape.Program library read Shape file contents and produce AVS/Express meshes and renderable DataObjects as output. The macros build on the low-level models found in the ReadShapeMods library by using array mapping modules to generate the appropriate output meshes. All the functional macros assume that all features in Shape files should be extracted. These macros are intended to be used in the creation of a complete visualization application that is to be used by end-users. Hence these macros do not include a user interface or automatically determine the type of the read Shape file. If this is important the read_shape user macro should be used.
More information on shape files can be obtained from:
Environmental Systems Research Institute, Inc. (http://www.esri.com/)
Generally GIS data is exported in three related files:
Shapefiles (.shp), Index files (.shx), and dBASE attribute files (.dbf).
ESRI provides a service whereby Shape data of a region can be easily obtained from the ArcData Online web-site. By selecting a region of interest and specifying the details of your own map, the appropriate Shapefiles and dBase attribute files can then be downloaded. The web-site is located at:
http://www.esri.com/data/online/index.html
The modules in the ReadShapeMacs library read all or parts of the geometric information in the ShapeFile format. Optionally, the ReadDbase project can also be used to read the attribute information contained in the dBASE files and combine all the data into one map display.
The current version of the ReadShape project adds support for 64 bit platforms. This support has currently only been tested on a SGI Origin 2000.
All of the functional macros described here have equivalent low-level modules. The table below describes the purpose of each module and which low-level module each one uses.
High-level Macro | Low-level Module | Purpose |
PointShape | ReadShapePoint | Extracts Points, attribute positions |
ArcShape | ReadShapeArc | Extracts Arc (Polyline) information |
PolygonShape | ReadShapePolygon | Extracts Polygon Coverages |
PolygonAsLineShape | ReadShapePolygonAsLine | Extracts Coverages, converting to Line boundaries |
filename
The name of the file that should be read from. The parameter is of type string. The filename should specify the full path name of the file. If no file extension is provided then the appropriate file extension is added.
out_mesh
Geometry mesh containing the data read from the ShapeFile. This mesh should be used for any further visualisations.
out_obj
The directly renderable output of the ReadShape functional macros. This output contains a DataObject object directly generated from the mesh data output. This DataObject output is intended to provide a simple way to quickly view the geometry. Most applications will require the data to be further processed before it is displayed.
The ReadDbase suite of modules can be combined with the ReadShape modules to combine attribute information with geometry information. The ReadShape functional macros are also used by the read_shape User macro to perform the actual reading of data.
Two example applications are provided that use a set of example data to illustrate how the ReadShape suite of modules and macros can be used.
The ReadShapeProgramEg application illustrates how the Program macros and ReadDbase modules can be used in a V script programming situation. If you are creating a complete application that is to be used by others then this application structure will probably work best.
The ReadShapeUserEg application illustrates how the three read_shape User macros can be used to read three series of data. The read_shape macro is intended to be used to quickly read and view ShapeFile data. Due to this the macro has a user interface and automatically determines the type of the ShapeFile being read. When this application is started it is likely that a number of error messages will be displayed. This is a transient condition caused by the order of network execution and can be safely ignored.
iac_proj/rd_shape/rshpmacs.v contains the V definitions of the suite of Functional macros. It also contains the V definitions of the read_shape User macro and its associated macros.
Not all possible shape file entities will be mapped. In particular, problems will be caused if the model contains holes or nested structures. If the attributes associated with ShapeFile entities are required the ReadDbase module system can be used. However if only the geometry is required then this is not necessary.
The low-level ReadShapeMods library containing the low-level module suite does not specify a process. By default the express process will be used.
Steve Walker Advanced Visual Systems, Inc. Hanworth Lane, Chertsey Surrey, UK KT16 9JX
Andrew Dodd International AVS Centre
International AVS Centre Manchester Visualization Centre Manchester Computing University of Manchester Oxford Road Manchester United Kingdom M13 9PL