A user macro (including User Interface) 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. | |
ShapeSelection | int | Type of ShapeFile to be read. | |
Name | Type | Description | |
out_mesh | Mesh | Geometry mesh output. | |
out_obj | DataObject | Directly renderable output object. | |
The read_shape user macro enables the user to select both which Shape file should be read and how that data should be read 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. When the user selects a ShapeFile the user macro selects whichever geometry type is most appropriate for the file. If this selection is not correct the user can choose an alternative. The user macro assumes that all features in the Shape file should be extracted.
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 read_shape macro reads 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.
filename
A member of the ReadShapeParams parameter block group, this string value specifies the name of the Shape file that should be read from. The filename should specify the full path name of the file. If no file extension is provided then the appropriate file extension is added.
ShapeSelection
A member of the ReadShapeParams parameter block group, this integer value specifies the type of the Shape file that is being read. The read_shape macro initially sets the value of this parameter. However if the automatically selected type is not correct the user can change the value so that a different type is assumed when read the shape file. If the user attempts to select an invalid Shape file type an error message will be given. The table below illustrates which values this parameter can have:
Number | Reading Macro | Geometry types read |
0 | PointShape | Point or Multipoint features |
1 | ArcShape | Arc (Polyline) features |
2 | PolygonShape | Coverage (Polygon) features |
3 | PolygonAsLineShape | Coverage (Polygon) features |
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 read_shape user macro. 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 read_shape modules to combine attribute information with geometry information. The ReadShape.Program functional macros are used by the read_shape user macro to perform the actual reading of data. The read_shape macro also makes use of the common parameter block, ReadShapeParams, and two switch modules, Mesh_switch and DefaultObject_switch.
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 read_shape user macro and its associated macros. It also contains the V definitions of the suite of Program 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