| Working with Spatial Data Using SAS/GIS Software |
|
SPATIAL <operation>
<libref.catalog.>spatial-entry </
options>;
|
The SPATIAL statement
A spatial entry is a SAS catalog entry of type GISSPA
that defines the components of a SAS/GIS spatial
database. The definition specifies which SAS data sets contain spatial information,
how the data sets are related, and what roles the variables play.
Any composites, polygonal indexes, and lattice hierarchies
created or updated during an invocation of the GIS procedure are stored in
the current spatial entry. Any subsequent COVERAGE statements issued within
the PROC GIS step subset the data in the current spatial entry.
No additional arguments (other than the spatial entry
name) are used when the operation keyword is
omitted. An error occurs if there is no existing spatial entry with the specified
name.
Note: When creating or replacing spatial entries,
you can either define entirely new spatial entries or merge two or more existing
spatial entries.
In a SPATIAL statement, the operation argument can be one of the following:
Note: If
you omit the operation keyword, the SPATIAL statement makes the specified
GISSPA entry the current spatial entry for subsequent operations.
The following list contains descriptions of the SPATIAL
statement operations:
-
CONTENTS
- CONTENTS prints information about the contents
of the specified GISSPA entry to the OUTPUT window, including
No additional arguments (other than the spatial entry
name) are used with this operation. An error occurs if the specified spatial
entry does not exist.
Note: The specified spatial entry
does not become the current spatial entry for subsequent operations unless
no spatial entry is currently selected.
![[cautend]](../common/images/cautend.gif)
-
CREATE
- CREATE generates a new GISSPA entry in which
subsequent composites, polygonal index names, and lattice hierarchies specified
in the GIS procedure are stored. The new spatial entry becomes the current
spatial entry for the subsequent operations.
An error occurs if a spatial entry with the specified
name already exists. The SPATIAL CREATE statement does not overwrite existing
spatial entries. Use SPATIAL REPLACE to replace an existing entry.
For a SPATIAL CREATE statement, you must also specify
both the CHAINS= and NODES= arguments or the MERGE= argument.
-
DELETE
- DELETE deletes the specified GISSPA entry.
By default, any polygonal index data sets referred to in the GISSPA entry
are also deleted. The chains, nodes, or detail data sets referred to in the
spatial entry are not deleted. To retain existing polygonal index data sets
when the spatial entry is deleted, use the KEEP argument in the SPATIAL DELETE
statement.
KEEP is the only additional argument (other than the
spatial entry name) that can be used with this action. An error occurs if
the specified spatial entry does not exist.
Note: For
the DELETE operation, you can also specify the special value _ALL_ for the spatial entry name argument to delete all GISSPA
entries in the current catalog.
![[cautend]](../common/images/cautend.gif)
- CAUTION:
- Use the DELETE
operation with care.
The GIS procedure does
not prompt you to verify the request before deleting the spatial entry. Be
especially careful when using the
_ALL_ keyword.
![[cautend]](../common/images/cautend.gif)
-
REPLACE
- REPLACE re-creates the specified GISSPA
entry and removes any previously defined composites, polygonal index names,
and lattice hierarchies. If an entry with the specified name does not exist,
REPLACE creates a new GISSPA entry. The new spatial entry becomes the current
spatial entry for subsequent operations. The SPATIAL REPLACE statement has
the effect of canceling all previously issued SPATIAL CREATE, COMPOSITE, POLYGONAL
INDEX, and LATTICE statements for the specified spatial entry.
For the SPATIAL REPLACE statement, you must specify
both the CHAINS= and NODES= arguments or the MERGE= argument.
-
UPDATE
- UPDATE updates the specified GISSPA entry
by applying new values for specified arguments. The updated spatial entry
becomes the current spatial entry for the GIS procedure.
An error occurs if there is no existing spatial entry
with the specified name.
- Spatial Entry Name
- In a SPATIAL statement, the spatial entry
name argument identifies the GISSPA entry that you want to create, replace,
update, delete, or make the current spatial entry. The general form of the
argument
is
|
<libref.catalog.>spatial-entry
|
If you
specify a one-level name, the spatial entry is
assumed to be in the catalog specified in the CATALOG= option of the PROC
GIS statement or in the most recently issued CATALOG statement. An error occurs
if no catalog has previously been specified.
- CAUTION:
- Do not use
host commands to move or rename SAS data sets that are referenced in GISSPA
entries.
Moving or renaming a data set that
is referred to in a spatial entry breaks the association between the GISSPA
entry and the data set. To prevent breaking the association, use the GIS MOVE
statement with the CHECKPARENTS option instead of a host command.
![[cautend]](../common/images/cautend.gif)
When you specify CREATE, REPLACE, or UPDATE for the operation keyword,
you can specify one or more of the following
optional arguments following the spatial entry name.
Note: Separate the list of arguments from the spatial entry name with a slash
(/).
The following list contains descriptions of the
optional
SPATIAL statement arguments:
-
CARTESIAN | LATLON
- CARTESIAN | LATLON specifies the coordinate
system used in the stored spatial data.
- CARTESIAN
- data are in an arbitrary rectangular coordinate
system
- LATLON
- data are in a geographic (spherical) coordinate
system.
The default is LATLON.
Note: This argument is ignored when the MERGE= argument is
used.
![[cautend]](../common/images/cautend.gif)
-
CHAINS
- CHAINS=data-set
names the SAS data set that contains chain definitions for the spatial database.
A chain is one or more line segments that connect one node (or point on the
map) to another. For example, a series of chains can represent a railroad
or a river.
Note: The CHAINS= argument is required when
you use the CREATE or REPLACE keyword and do not specify the MERGE= argument.
If you use a one-level name, the data set will be created
(or replaced) in the library specified in the CATALOG= option on the PROC
GIS statement. Use a two-level name to override the default library.
![[cautend]](../common/images/cautend.gif)
-
DEGREES | RADIANS | SECONDS
- DEGREES | RADIANS | SECONDS specifies the
coordinate units for the stored spatial data when the coordinate system is
geographic (LATLON). The default is RADIANS.
Note: This argument is ignored when the CARTESIAN or MERGE= arguments are
used.
![[cautend]](../common/images/cautend.gif)
-
DETAILS
- DETAILS=data-set
names the SAS data set that contains detail definitions for the spatial database.
Details are the points at angle breaks in chains. They provide a finer granularity
for the chain's line segments. A data set containing detail definitions might
describe the curvy outline of a coastal road.
If you use a one-level name, the data set will be created
(or replaced) in the library specified in the CATALOG= option on the PROC
GIS statement. Use a two-level name to override the default library.
-
EAST | WEST
- EAST | WEST specifies the hemisphere in
which the spatial data points lie. The default is EAST. EAST refers to points
east of the Prime Meridian (0 degrees) at Greenwich, England, while WEST refers
to points west of the Prime Meridian.
Note: This argument
is ignored when the CARTESIAN or MERGE= arguments are used.
![[cautend]](../common/images/cautend.gif)
-
KEEP
- KEEP specifies that polygonal index data
sets are retained when the spatial entry is deleted. This option is valid
only with the DELETE operation.
-
MERGE
- MERGE=(<libref.catalog.>spatial-entry-1<,
..., <libref.catalog.>spatial-entry-n>) <EDGEMATCH | OVERLAP> builds a new spatial
entry which references two or more existing GISSPA entries. The dependent
data sets for the spatial entries are not physically merged.
An error occurs if any of the specified spatial entries
do not exist.
If you specify a one-level name for any of the entries
to be merged, the spatial entry is assumed to be in the catalog specified
in the CATALOG= argument with the PROC GIS statement or in the most recently
issued CATALOG statement. An error occurs if no catalog has previously been
specified.
You can specify either of the following additional arguments
in conjunction with the MERGE= argument:
-
EDGEMATCH <LINKONLY>
- matches common boundaries between the merged
spatial entries. Missing values along common boundary chains are filled in
where possible using values from the adjoining spatial data sets. The affected
chains data sets are rewritten unless the LINKONLY option is specified, and
there is no way to reverse the operation.
-
OVERLAP
- merges spatial entries without attempting
to match boundaries. The chains data sets for the merged entries are not updated.
This is the default behavior.
-
MULT
- MULT=multiplier-value
specifies a constant value by which spatial data coordinates are multiplied.
The default is MULT=1.
Note: This argument is ignored
when the MERGE= argument is used.
![[cautend]](../common/images/cautend.gif)
-
NODES
- NODES=data-set
names the SAS data set that contains node definitions for the spatial database.
A node is a point on the map, usually representing the intersection of latitude
and longitude positions. For example, a node can represent the intersection
of two streets.
If you use a one-level name, the data set will be created
(or replaced) in the library specified in the CATALOG= option on the PROC
GIS statement. Use a two-level name to override the default library.
Note: The NODES= argument is required
when you use the CREATE or REPLACE keyword and do not specify the MERGE= argument.
![[cautend]](../common/images/cautend.gif)
-
NORTH | SOUTH
- NORTH | SOUTH indicates the hemisphere in
which the spatial data points lie. The default is NORTH.
Note: This argument is ignored when the CARTESIAN or MERGE= arguments are
used.
![[cautend]](../common/images/cautend.gif)
-
DESCRIPTION
- DESCRIPTION='string'
specifies a descriptive string, up to 256 characters long, that is stored
in the description field of the GISSPA entry. The default description is blank.
The following code fragment makes MAPS.NC.NC.GISSPA
the current spatial entry:
proc gis cat=maps.nc;
spatial nc;
The following code fragment replaces the existing detail
data set with MAPS.USAD for an existing spatial entry:
spatial update maps.usa.usa / details=maps.usad;
The following code fragment creates a new spatial entry
named TRIANGLE.GISSPA in the current catalog by merging three existing spatial
entries, ORANGE, DURHAM, and WAKE. In this example, each of the GISSPA entries
to be merged is stored in a different library.
spatial create triangle / merge=(gmap1.orange.orange,
gmap2.durham.durham,
gmap3.wake.wake);
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.