Previous Page | Next Page

Details of SAS/GIS Spatial Databases

SAS/GIS Spatial Database Structure

A SAS/GIS spatial database consists of a set of SAS data sets that store the spatial data and a set of SAS catalog entries that define the functions of, and the relationships between, the spatial data elements.


Spatial Data Sets

As a component of SAS, SAS/GIS software stores all of its spatial data in SAS data sets. The data sets for a SAS/GIS spatial database work together as one logical file, even though they are split into multiple physical files.

The spatial data sets implement a network data structure with links that connect chains to their two end nodes and each node to one or more chains. This structure is implemented by using direct pointers between the nodes and chains data sets. The details data set provides curvature points between nodes of chains, while the polygonal index data set provides an efficient method of determining the correct sequence of chains to represent polygons.


Common Spatial Data Set Variables

The following spatial data variables appear in the chains, nodes, and details data sets:

Variable Description
ROW row number (used as a link when the spatial data set is used as a keyed data set as well as for database protection)
DATE SAS datetime value when the record was last modified
VERSION data version number
ATOM edit operation number
HISTORY undo history record pointer


Variable Linkages in the Spatial Data

The following linkages exist between and within the spatial data sets:

Data Set Variable Links to...
chains ROW (table note 1) self

FRNODE this chain's from-node record in the nodes data set

TONODE this chain's to-node record in the nodes data set

D_ROW first detail record in the details data set for this chain
nodes ROW self

C_ROW1-C_ROW5 records in the chains data set of chains that are using this node

NC (table note 2) node record in the nodes data set used to store additional chain records
details ROW self

C_ROW parent chain record in the chains data set or next detail continuation record in the details data set
index (table note 3) C_ROW record in the chains data set for the first chain in this polygon

TABLE NOTE 1:   The ROW variable is used as a link between records in the spatial data sets. The ROW variable value for the first record of a feature in the chains or nodes data sets is considered the feature ID. Because some records in the nodes data set are continuations of other records, not every row number in the nodes data set is a feature ID. As a result, node feature ID numbers are not necessarily sequential.
The ROW variable also provides protection against corruption of the database that is caused by the accidental insertion or deletion of records. If records were linked by physical record number rather than by ROW value, an improper record insertion or deletion would throw off all linkages to subsequent records in the database. In the event the database is corrupted, the ROW variable can be used to move the records back into their proper locations with minimal data loss. [arrow]

TABLE NOTE 2:   A negative value indicates that the variable points to a continuation record. The absolute value of the variable is the row number of the next record used for that feature's data. In newly imported spatial data, continuation records always point to the next record in the data set, but this is not required. New chains can be attached to existing nodes without having to insert records, which would require extensive printer reassignments. [arrow]

TABLE NOTE 3:   The index data set has no ROW variable because it can be easily rebuilt from the chains, nodes, and details data sets from which it was originally constructed. [arrow]

Because the data sets are linked together by row number, the chains, nodes, and details data sets must be radix-addressable and might not be compressed.


Chains Data Set

The chains data set contains coordinates for the polylines that are used to form line and polygon features. A polyline consists of a series of connected line segments that are chains. The chains data set also contains the information that is necessary to implement nodes in the database.

The following system variables are unique to the chains data set:

Variable Description
FRNODE (table note 1) starting from-node record for the chain
TONODE ending to-node record for the chain
D_ROW first detail point record
ND number of detail points in the chain
RANK sorting key used to sort all the chains around an arbitrary node by their angle, starting from 0 and proceeding counter-clockwise. See Calculating Chain Rank for information about sorting a chain around its to- and from-node and for examples of calculating the to-node value, from-node value, and chain rank.
XMIN minimum X coordinate of chain
XMAX maximum X coordinate of chain
YMIN minimum Y coordinate of chain
YMAX maximum Y coordinate of chain

TABLE NOTE 1:   The TONODE and FRNODE variables can point to the same record. [arrow]

The XMIN, YMIN, XMAX, and YMAX variables define a bounding box for the chain. These variables are included in the chains data set to make it possible to select all the chains in a given X-Y region by looking only at the chains data set.

In addition to the system variables, the chains data set might contain any number of attribute variables, some of which might be polygon IDs. Because the chains have left and right sides, there are typically paired variables for bilateral data such as polygon areas or address values. The names of the paired variables typically end with L or R for the left and right sides, respectively. For example, the data set might contain COUNTYL and COUNTYR variables with the codes for the county areas on the left and right sides of the chain, respectively. However, this naming convention is not required.


Nodes Data Set

The nodes data set contains the coordinates of the beginning and ending nodes for the chains in the chains data set and the linkage information that is necessary to attach chains to the correct nodes. A node definition can span multiple records in the nodes data set, so only the starting record number for a node is a node feature ID.

The following system variables are unique to the nodes data set:

Variable Description
C_ROW1-C_ROW5 chain records for the first five chains connected to the node. If fewer than five chains are connected to the node, the unused variables are set to 0.
NC number of chain pointers (if five or fewer chains are connected to the node) or the negative of the next continuation node record number (if more than five chains are connected to the node). See Variable Linkages in the Spatial Data for more information about how NC is used to string continuation node records.
X X coordinate of node.
Y Y coordinate of node.


Details Data Set

The details data set stores curvature points of a chain between the two end nodes. Therefore, it contains all the coordinates between the intersection points of the chains. The node coordinates are not duplicated in the details data set.

The following system variables are unique to the details data set:

Variable Description
C_ROW parent chain record (if the chain has ten or fewer detail points) or the negative of the next continuation detail record (if the chain has more than ten detail points). See Variable Linkages in the Spatial Data for a description of how C_ROW is used to string continuation detail records.
X1-X10 X coordinates of up to 10 detail points.
Y1-Y10 Y coordinates of up to 10 detail points.

Detail coordinate pairs (X2, Y2) through (X10, Y10) contain missing values if they are not used. The missing values ensure that the unused coordinate pairs are never used in any coordinate range calculation. The various importing methods set unused detail coordinates to missing as a precautionary measure.


Polygonal Index Data Set

Polygonal indexes are indexes to chains data sets. The index contains a record for each boundary of each polygon that was successfully closed in the index creation process. The same rules that are used to construct polygons are also used to construct polygonal indexes.

The following system variables are unique to polygonal index data sets:

Variable Description
C_ROW starting chain from which a polygon can be dynamically traversed and closed. This chain is sometimes referred to as the seed chain for the polygon. Any chain on a polygon's boundary can be the seed chain.
FLAGS control flag for polygons.
NC number of chains in the polygon boundary.

Polygonal index data sets are created with the POLYGONAL INDEX statement in the GIS procedure. See POLYGONAL INDEX Statement for more information about using the GIS procedure to create polygonal index data sets.


Catalog Entries

SAS/GIS software uses SAS catalog entries to store metadata for the spatial database--that is, information about the spatial data values in the spatial data sets.

Note:   Using host commands to move, rename, or delete SAS/GIS catalogs entries can break internal linkages. For details of how to manage catalog entries, see the COPY, MOVE, and SYNC statements in The GIS Procedure.  [cautionend]

SAS/GIS spatial databases use the following entry types.


Spatial Entries

A spatial entry is a SAS catalog entry of type GISSPA that identifies the spatial data sets for a given spatial database and defines relationships between the variables in those data sets.

Spatial entries are created and modified using the SPATIAL statement in the GIS procedure.

Note:   You can also create a new spatial entry by making the following selections from the GIS Map window's menu bar: File [arrow] Save As [arrow] Spatial  [cautionend]

SAS/GIS software supports simple spatial entries and merged spatial entries as follows.

Simple spatial entries contain the following elements:

  • references to the chains, nodes, and details data sets that contain spatial information.

  • references to any polygonal index data sets that define the boundaries of area features in the spatial data.

  • definitions for composite associations that specify how the variables in the spatial data sets are used. See Composites for more information.

  • the definition for a lattice hierarchy that specifies which area features in the spatial data enclose or are enclosed by other features.

  • the parameters for the projection system that is used to interpret the spatial information that is stored in the spatial data sets.

  • the accumulated bounding extents of the spatial data coordinates of its underlying child spatial data sets, consisting of the minimum and maximum X and Y coordinate values and the ranges of X and Y values.

Merged spatial entries have the following characteristics:
  • consist of multiple SAS/GIS spatial databases that are linked together hierarchically in a tree structure.

  • contain logical references to two or more child spatial entries. A child spatial entry is a dependent spatial entry beneath the merged spatial entry in the hierarchy.

  • contain specifications of how the entries were merged (by overlapping or edgematching).

  • do not have their own spatial data sets.

  • reference the spatial data sets that belong to the child spatial entries beneath them on the hierarchy.

  • do not have references to any polygonal index data sets that define the boundaries of area features in the spatial data.

  • do not have definitions for composites that specify how the variables in the spatial data sets are used. See Composites for more information about composites.

  • do not have the definition for a lattice hierarchy that specifies which area features in the spatial data enclose or are enclosed by other features.

  • do not have parameters for the projection system that is used to interpret the spatial information that is stored in the spatial data sets.

  • contain the accumulated bounding extents of the spatial data coordinates of their underlying child spatial entries, consisting of the minimum and maximum X and Y coordinate values and the ranges of X and Y values.

Merged spatial entries can help you to manage your spatial data requirements. For example, you might have two spatial databases that contain the county boundaries of adjoining states. You can build a merged spatial entry that references both states and then you can view a single map containing both states' counties. Otherwise, you would have to import a new map that contains the two states' counties. This new map would double your spatial data storage requirements.

The following additional statements in the GIS procedure update the information in the spatial entry:

COMPOSITE statement

creates or modifies composites that define the relation and function of variables in the spatial data sets. See COMPOSITE Statement for details about using the GIS procedure to create or modify composites.

POLYGONAL INDEX statement

updates the list of available index names that are stored in the spatial entry. SeePOLYGONAL INDEX Statement for details about using the GIS procedure to create or modify polygonal indexes.

LATTICE statement

updates the lattice hierarchy that is stored in the spatial entry. See LATTICE Statement for details about using the GIS procedure to define lattice hierarchies.

You can view a formatted report of the contents of a spatial entry by submitting a SPATIAL CONTENTS statement in the GIS procedure.

See SPATIAL Statement for more information about using the GIS procedure to create, modify, or view the contents of spatial entries.


Coverage Entries

A coverage entry is a SAS catalog entry of type GISCOVER that defines the subset, or coverage, of the spatial data that is available to a map. SAS/GIS maps refer to coverages rather than directly to the spatial data.

a coverage entry contains the following elements:

Multiple coverage entries can refer to the same spatial entry to create different subsets of the spatial data for different maps. For example, you could define a series of coverages to subset a county into multiple sales regions according to the block groups that are contained in each of the regions. The spatial data for the county would still be in a single spatial database that is represented by the chains, nodes, and details data sets and by the controlling spatial entry.

Coverage entries are created and modified using the COVERAGE statement in the GIS procedure. You can view a formatted report of the contents of a coverage entry by submitting a COVERAGE CONTENTS statement in the GIS procedure. (The contents report for a coverage entry also includes all the contents information for the root spatial entry as well.)

See COVERAGE Statement for more information about using the GIS procedure to create, modify, or view the contents of coverage entries.


Layer Entries

A layer entry is a SAS catalog entry of type GISLAYER that defines the set of features that compose a layer in the map. A layer entry contains the following elements:

See LAYER Statement for more information about using the GIS procedure to create, modify, or view the contents of layer entries.

Map Entries

A map entry is a SAS catalog entry of type GISMAP. Map entries are the controlling entries for SAS/GIS maps because they tie together all the information that is needed to display a map. A map entry contains the following elements:

Map entries are created using the MAP CREATE statement in the GIS procedure. However, much of the information that is stored in the map entry is specified interactively in the GIS Map window.

You can view a formatted report of the contents of a map entry by submitting a MAP CONTENTS statement in the GIS procedure. (The contents report for a map entry includes all the contents information for the spatial, coverage, and layer entries as well.)

See MAP Statement for details about the items that can be specified with the GIS procedure. See Chapter 10, "SAS/GIS Windows" in SAS/GIS Software: Usage and Reference, Version 6 for details about the items that can be specified interactively in the GIS Map window.

Previous Page | Next Page | Top of Page