| Working with Spatial Data Using SAS/GIS Software |
|
LAYER operation
<libref.catalog.>layer-entry </ options>;
|
The LAYER statement
A layer entry is a SAS catalog entry of type GISLAYER that
stores information about a layer in a map. Each layer represents a different
set of features on the map and defines how the features are displayed. For
example, you could create a layer entry, RIVERS, to represent the water features
in your spatial data.
You can define layers as either static or thematic.
A static layer has a fixed set of graphical attributes (fill colors, outline
colors, and so forth). A thematic layer uses values of a response variable
in an associated attribute data set to determine the graphical attributes
for the layer. Information about the theme value ranges and the attribute
data are stored in the layer entry.
In a LAYER statement, operation
can be one of the
following:
The
following list contains descriptions of the LAYER
statement operations:
-
CONTENTS
- CONTENTS displays the contents of the specified
GISLAYER entry in the OUTPUT window, including the WHERE clause that defines
the layer and lists of the layer's parameters and graphical attributes.
An error occurs if the specified layer entry does not
exist.
-
CREATE
- CREATE creates a new GISLAYER entry to define
a layer in the spatial database.
An error occurs if a layer entry with the specified
name already exists. The LAYER CREATE statement does not overwrite existing
layer entries. Use LAYER REPLACE to replace an existing entry.
For a LAYER CREATE statement, you must also specify
either the COMPOSITE= argument or the WHERE= argument. (For area layers, you
must use the COMPOSITE= argument.)
-
DELETE
- DELETE removes the specified GISLAYER entry.
No additional arguments (other than the layer entry
name) are used with this operation. An error occurs if the specified layer
entry does not exist.
For the DELETE operation, you can also specify the special
value _ALL_ for the layer-entry
name to delete all GISLAYER entries in the current catalog.
Note: You must specify a new layer list for any map entries that refer to the deleted
GISLAYER entry.
![[cautend]](../common/images/cautend.gif)
- CAUTION:
- Use DELETE with care.
The GIS procedure does not prompt you to verify the
request before deleting the layer entry. Be especially careful when using
the
_ALL_ keyword.
![[cautend]](../common/images/cautend.gif)
-
REPLACE
- REPLACE overwrites the specified GISLAYER
entry or creates a new GISLAYER entry if an entry with the specified name
does not exist. The LAYER REPLACE statement has the effect of canceling the
previously issued LAYER CREATE statement for the specified layer entry.
For a LAYER REPLACE statement, you must also specify
either the COMPOSITE= argument or the WHERE= argument. (For area layers, you
must use the COMPOSITE= argument.)
-
UPDATE
- UPDATE modifies the specified GISLAYER entry
by applying new values for specified arguments.
An error occurs if there is no existing layer entry
with the specified name.
- Layer-entry Name
- In a LAYER statement, the layer-entry name identifies the GISLAYER entry you want to create, delete, replace,
or update. The general form of the argument
is
|
<libref.catalog.>layer-entry
|
If
you specify a one-level name, the layer entry is
assumed to be in the catalog specified in the PROC GIS statement or in the
most recently issued CATALOG statement. An error occurs if no catalog has
previously been specified.
The layer-name must conform to the rules
for SAS names:
When you specify CONTENTS, CREATE, REPLACE, or UPDATE
for operation in a LAYER statement, you can specify
one or more of the following additional arguments following the layer entry
name.
Note: Separate the list of arguments from the layer-entry name with a slash
(/).
The
following list contains descriptions of additional
LAYER statement arguments:
-
COMPOSITE
- COMPOSITE=composite-name
specifies a composite that defines the common characteristic of the features
in the layer. The COMPOSITE= argument is an alternative to specifying a WHERE
clause using the WHERE= argument. For example, if you use specify COMPOSITE=STATE
in the LAYER statement and the composite named STATE was created with the
variable association VAR=(LEFT=STATEL,RIGHT=STATER), then the implied WHERE
clause for the layer is WHERE STATEL NE STATER.
Note: Either the COMPOSITE= argument or the WHERE= argument is required when you
use the CREATE or REPLACE keyword. For area layers, you must use the COMPOSITE=
argument.
![[cautend]](../common/images/cautend.gif)
-
DESCRIPTION
- DESCRIPTION='string'
or DES='string' specifies a descriptive string,
up to 256 characters long, that is stored in the description field of the
GISLAYER entry. The default description is blank.
-
DETAILON
- DETAILON=scale-value specifies
the scale at or below which detail coordinates are displayed, provided that
detail coordinates are available. This argument helps keep the detail level
of a layer to a minimum when the map is zoomed to a large scale. By default,
detail is displayed at all scales when detail is turned on.
Note: The DETAILON= argument is only effective when detail coordinates are read
for the layer. The DETAILS argument controls whether detail coordinates are
read.
![[cautend]](../common/images/cautend.gif)
-
DETAILS | NODETAILS
- DETAILS | NODETAILS specifies whether the
detail coordinates are read for this layer. The default is NODETAILS.
If you specify DETAILS to read the detail coordinates
from the database, you can use the DETAILON= argument to control the scale
at which the detail coordinates are actually displayed.
-
MAP
- MAP=<libref.catalog.>map-entry identifies
a GISMAP entry that provides theme information for layers created in version
6.11 of SAS/GIS. This option is ignored for later version layers. For thematic
layers, the link to the associated data set and the name of the response variable
for the theme are stored in the map entry rather than in the layer entry.
If you omit this argument, the LAYER CONTENTS statement is unable to provide
thematic display information for Version 6.11 layers.
Note: The MAP= argument is valid only in conjunction with the CONTENTS keyword and
is the only option permitted with the CONTENTS operation.
![[cautend]](../common/images/cautend.gif)
-
LABELON
- LABELON=scale-value
specifies the scale at or below which map labels are displayed. This argument
helps keep the number of items in the map window to a minimum when the map
is zoomed to a large scale. By default, labels are displayed at all scales.
-
OFFSCALE
- OFFSCALE=scale-value
specifies the scale at or below which the layer display is turned off. When
you zoom in below the specified scale, the layer is hidden. When you zoom
out beyond the specified scale, the layer is displayed. By default, the layer
is displayed at all zoom scales.
Note: If you specify
both the OFFSCALE= and ONSCALE= arguments, the scale-value
for OFFSCALE= must be less than the scale-value
for ONSCALE=.
![[cautend]](../common/images/cautend.gif)
-
ONSCALE
- ONSCALE=scale-value
specifies the scale at or below which the layer display is turned on. When
you zoom in below the specified scale, the layer is displayed. When you zoom
out beyond the specified scale, the layer is hidden. This argument helps prevent
clutter by enabling you to suppress selected layers when the map is zoomed
to a large scale. By default, the layer is displayed at all zoom scales.
Note: If you specify both the ONSCALE= and OFFSCALE= arguments,
the scale-value for ONSCALE= must be greater
than the scale-value for OFFSCALE=.
![[cautend]](../common/images/cautend.gif)
-
STATIC
- STATIC toggles the current theme in the
layer off so it is not displayed when the map is opened. It does not remove
the theme from the layer entry. If the layer has no theme, STATIC is ignored.
-
THEMATIC
- THEMATIC toggles the current theme in the
layer on so it is displayed when the map is opened. If the layer has no theme,
this option has no effect. Use the THEME=(...) option to create a theme in
a layer.
-
TYPE
- TYPE=POINT | LINE | AREA specifies the type
of layer. The TYPE argument affects how the layer is displayed in a map. The
default is TYPE=LINE.
- POINT
- the layer's features are discrete points
and have no length or area associated with them. If a POINT feature has left
and right attributes, the values of the attributes are identical.
- LINE
- the layer's features have length, and they
can have different values for their left and right attributes. However, a
LINE feature can enclose an area, even though it is displayed as a line.
- AREA
- the layer's features have length and area
associations and the layer is displayed as filled polygons.
Note: Each area layer must have a polygonal index for the composite that defines
the area boundaries.
![[cautend]](../common/images/cautend.gif)
-
UNITS
- UNITS=unit-specification
specifies the scale units for subsequent ON=, OFF=, and DETAILON= argument
values. The default is UNITS=METRIC (kilometers per centimeter).
Unit-specification can
be one of the following:
- ENGLISH
- selects miles per inch (MI/IN) as the scale
units.
- METRIC
- selects kilometers per centimeter (KM/CM)
as the scale units.
- real-units/map-units
- selects a user-defined combination of units.
Valid values for real-units and map-units are as follows:
The value of
real-units is
typically KM, M, MI, or FT, and the value of map-units
is usually either CM or IN.
-
WHERE
- WHERE=('where-string-1' <... 'where-string-n'>) specifies
a WHERE clause that subsets the chains data set to define a geographic layer
of a spatial database. Where-string can contain
a complete valid WHERE expression of 200 characters or less.
To specify a WHERE expression greater than 200 characters,
you must break the expression up into separate quoted strings. When WHERE=
is processed, the strings are concatenated, with a space between each string,
and the entire expression is evaluated.
If you are using multiple strings, each string does
not have to contain a complete WHERE expression, but the concatenated expression
must be valid.
You can use any of the variables in the chains data
set in the WHERE expressions, not just the coordinate variables. However,
the layer definition must not delineate a bounded geographic region, but rather
a particular subset of the spatial data that is independent of the coverage.
For example, a STREETS layer may apply to all the spatial data, even if streets
do not exist in many areas. Specify WHERE='1' to define a layer that contains
all the features in the map.
Note: Either the WHERE=
argument or the COMPOSITE= argument is required when you use the CREATE or
REPLACE keyword. For area layers, you must use the COMPOSITE= argument. If
you use the WHERE= argument, the default layer type is LINE.
![[cautend]](../common/images/cautend.gif)
-
FORCE
- FORCE allows you to create more than one
theme using the same variable from the same attribute data set.
-
THEME
- THEME=(options) allows you to manipulate
thematic layers. When you specify CONTENTS, CREATE, REPLACE, or UPDATE for
the operation keyword in a LAYER statement and
specify THEME as an option, you can specify the following additional arguments.
The following list contains descriptions of the THEME
arguments:
- THEME Operations
- In the LAYER statement THEME argument, the operation argument can be one of the following:
- THEME
CREATE
- CREATE creates a new theme for the specified
GISLAYER entry.
An error occurs if a theme already exists for the layer
that uses the same variable in the same attribute data set, unless you also
specify FORCE. The THEME CREATE statement does not overwrite existing theme
entries. Use THEME REPLACE to replace an existing entry.
For a THEME CREATE statement, you must also specify
the LINK= and VAR= arguments.
- THEME REPLACE
- REPLACE overwrites the specified theme for
the GISLAYER entry. The THEME REPLACE statement has the effect of canceling
the previously issued THEME CREATE statement for the specified layer entry.
For a THEME REPLACE statement, you must also specify
both the LINK= argument and the VAR= arguments.
- THEME UPDATE
- UPDATE updates the specified theme for the
GISLAYER entry by applying new values for specified arguments.
An error occurs if the specified layer does not have
at least one existing theme. For a THEME UPDATE statement, you must specify
a value for at least one of the arguments LINK=, VAR=, RANGE=, NLEVELS=, or
MAKE_CURRENT | NOT_CURRENT.
If you do not specify LINK=, the current data set link
is used. If you do not specify THEMEVAR=, the current thematic variable is
used.
- THEME DELETE
- DELETE removes the specified theme for the
specified GISLAYER entry.
For a THEME DELETE statement, you must specify a value
for THEMEVAR=varname or POSITION=int. An error occurs if you specify THEMEVAR=varname and a theme based on
varname
does not exist.
- CAUTION:
- Use DELETE with care.
The GIS procedure does not prompt you to verify the request
before deleting the layer theme.
![[cautend]](../common/images/cautend.gif)
- THEME LINK
- LINK=link-name
specifies the attribute data set containing the theme variable to be used.
If you do not specify link-name and you are performing
an update, the current data set link is used.
- THEMEVAR
- THEMEVAR=var-name
specifies the theme variable in the linked attribute data set (specified in
LINK=link-name). If you do not specify var-name and you are performing an update, the current theme
variable is used.
THEMEVAR=var-name also
specifies the theme to delete or to make current.
- THEME RANGE
- RANGE= DEFAULT | DISCRETE | LEVELS specifies
the thematic range type.
- DEFAULT
- increments are calculated automatically
using a SAS/GRAPH statistical algorithm.
- DISCRETE
- the range is treated as a series of discrete
values instead of a continuous variable. If the variable specified in the
VAR= option is a character variable, only RANGE=DISCRETE is allowed.
- LEVELS
- the range is divided into evenly spaced
increments. You do not have to specify RANGE=LEVELS if you specify NLEVELS=int instead.
If you do not specify
RANGE=, DEFAULT is used for numeric
variables and DISCRETE is used for character variables.
- THEME NLEVELS
- NLEVELS=int
specifies the number of range breaks in the theme. The value for NLEVELS must
be an integer greater than one. You cannot specify both NLEVELS and RANGE=DEFAULT
or RANGE=DISCRETE. If you specify NLEVELS, RANGE=levels is assumed
and can be omitted.
- THEME POSITION
- POSITION=int
specifies the position number of the target theme. 1 is the first theme, 2
is the second theme, and so on. Negative values of int
are the position number counting backward from the last theme. POSITION=-1
specifies the last theme; POSITION=-2 specifies the second to the last theme,
and so on. POSITION=0 specifies the current theme, whatever position that
theme is in the series.
If you do not specify a value for POSITION, new themes
are created at the end of the theme list, UPDATE operations are performed
on the last theme, and DELETE fails unless you specify the target theme with
THEMEVAR=var-name.
If you use POSITION to specify a new theme position, layer-name must not already contain a theme at that
position.
- THEME MAKE_CURRENT
- MAKE_CURRENT specifies that the specified
theme is to be the current theme when the map opens. MAKE_CURRENT is the default
when a theme is created or updated.
- THEME NOT_CURRENT
- NOT_CURRENT specifies that the specified
theme should be created or modified, but is not to be made the current theme.
If the chains data set contains pairs of variables that
indicate values for the areas on the left and right sides of the chains, then
you can use these variable pairs to define area layers. The following code
fragment defines a composite that identifies county boundaries (chains for
which the area values on the left and right sides are unequal) and uses that
composite to define an area layer:
composite create county /
var=(left=countyl,right=countyr)
class=area;
run;
polygonal index create county /
composite=county
out=gmaps.cntyx;
run;
layer create county /
composite=county
type=area;
run;
Note: The polygonal index must be defined
for the composite in order to display this area layer in a map.
Assume that the spatial database contains a variable
named CFCC with values that identify what each chain represents. Assume also
that the values of the CFCC variable for all roads begin with the letter A
(A0, A1, and so forth, depending on the category of road). The following code
fragment defines a line layer that consists of all features that are roads:
layer create roads / where='cfcc =: "A"'
type=line;
run;
Note: The colon (:) modifier on the equals
operator restricts the comparison to only the first n
characters of the variable value, where n is
the number of characters in the comparison string. In the preceding example,
the WHERE clause tests for "where the value of CFCC begins with A."
This example creates a new theme for the SASUSER.MALL.STORES
map, supplied with the SAS/GIS tutorial. The theme uses the sqft
variable in the mallstor attribute data set to define the theme.
proc gis;
layer update sasuser.mall.store /
map = sasuser.mall.stores
theme = (create
themevar = sqft
link = mallstor
range = discrete
pos = -1
not_current );
run;
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.