Defined layers can display and query data from any combination of standard Esri data sources.
LAYERDRAW is the most common command for drawing coverage features from a defined layer.
A spatial constraint was used on data from a coverage and a shapefile to select hotels for this query.
With the release of ArcInfo Version 7.2.1, you have a more open geodatabase environment. The new define layer functionality allows handling of all Esri data formats in a similar fashion.
Using defined layers, you can display and query any combination of Esri's standard data sources ArcInfo coverages, ArcStorm and map libraries, shapefiles, and Spatial Database Engine (SDE) Version 3.0 layers without having to reformat them. For example, if you could use defined layers functionality to find the addresses of all hotels in De Kalb County, Illinois and display them on a single map by combining hotel data in a shapefile with county data kept in an SDE layer. The result of the query could be exported to an SDE layer, a coverage, or a shapefile.
A defined layer usually has an associated set of query constraints. These constraints can be spatial (within this polygon) or attribute (county_nam = "De Kalb"). A defined layer can also contain joins to SDE tables or relates to INFO files for accessing associated attributes. All of this information on data source, feature type, query constraints, and joins is used to retrieve features from the source data. Since the defined layer command accesses the actual features directly from source data, the data retrieved are always current.
Arcplot: LAYERDEFINE hotels COVER hotels97 POINT
Arcplot: LAYERDEFINE counties SHAPEFILE counties.shp POLY
To access SDE data, you must first connect to SDE using the DATASET command. In the following example, the DATASET command is used before defining the layer.
Arcplot: DATASET CONNECT ds1 abbey esri_sde georgia password Arcplot: LAYERDEFINE cities SDE ds1 georgia_cities feature POINT
Once you've specified layer definitions, you have several operations for managing and exploring your defined layers. You can describe, save, and list current layer definitions as well as listing attributes for a layer or identifying features graphically.
Features are retrieved from the data source when they are drawn. The most common command for drawing features from a defined layer is LAYERDRAW. Drawing features for a defined layer is similar to drawing coverage features: Set the map extent to the layer, specify symbols, and draw. The commands LAYERDRAW, LAYERDOTS, LAYERSPOT, LAYERTEXT, and LAYERANNO offer additional display capabilities. In the following example, LAYERSPOT is being used to display a pie chart representing male and female populations in each county.
Arcplot: MAPEXTENT LAYER fourcounty Arcplot: SHADESYMBOL 9 Arcplot: LAYERDRAW fourcounty Arcplot: LAYERDRAW fourcounty OUTLINE Arcplot: LAYERSPOT fourcounty CIRCLE pop90 males90,4 females90,6 .02 OUTLINE
Constraints for Defined Layers
Attribute constraints are always executed before spatial constraints. SDE requires a valid "SQL where" clause. All other data sources use INFO logical expressions. In the following example, only hotels with an "A" rating will be retrieved when displayed with LAYERDRAW.
Arcplot: LAYERQUERY hotels grade = 'A' Arcplot: LAYERDRAW hotels
When a spatial constraint is used, features are retrieved based on spatial relationships with a search feature (e.g., touching or intersecting). The search methods available-COMMON.POINT, COMMON.LINE, AREA.INTERSECT, CONTAINED.BY, CONTAINING-are the same ones supported by SDE, ArcView GIS, and MapObjects. Use LAYERSEARCH to specify a spatial constraint and LAYERFILTER to refine it.
Spatial constraints can use data from differing data sources. For example, you can select hotels within De Kalb County even though the hotel data are stored in a coverage and the county data are stored in a shapefile. In the following example, an attribute query is first used to retrieve De Kalb County from the counties layer. Then, a spatial query is used on the hotels layer to select hotels in De Kalb County.
Arcplot: LAYERQUERY counties county_name = 'De Kalb'
Arcplot: LAYERSEARCH hotels contained by layer counties Arcplot: LAYERDRAW hotels