Extending ArcIMS MapServices with ArcXML Continued...
Querying Data and Joining Tables
Querying data, based on a spatial constraint or
a tabular database, is fundamental to GIS. Spatial and tabular query
statements can be made using the SPATIALQUERY element. This element
draws features on the map based on a query--a spatial query,
a tabular query, or a combination of the two. The SPATIALQUERY also
enables simple tabular joins.
Tabular query statements, located in the where
attribute of the SPATIALQUERY element, define the WHERE portion
of a SQL statement. The features that meet criteria set in the where
attribute are drawn on the map. In query statements that require
the use of symbols, such as specifying values using greater than
or less than signs, the escape values for these symbols (>
and < in this example) must be used inside the where attribute.
A spatial filter defines the envelope for a spatial
query. The envelope can be a rectangle, point, line, polygon, or
buffer. All features within the spatial filter will be drawn on
the map. The SPATIALFILTER child element, used within the SPATIALQUERY
element, is most commonly defined as an ENVELOPE element that uses
a rectangular spatial filter or as a POLYGON element that uses a
ring of points. Either will determine where the spatial filter will
be drawn. The relation attribute, required by the SPATIALFILTER
element, determines whether the spatial filter shape is a rectangular
envelope around the extents of a shape (envelope intersection) or
is limited to the shape of the spatial filter itself (area intersection).
The SPATIALQUERY element can also be used to join
dBASE (DBF) files to shapefiles and to relate tables in ArcSDE based
on a common field. Shapefile layers can only be joined to other
DBF files located in the same directory, and ArcSDE tables must
be in the same DBMS. The TO (or master) table and common field name
and the FROM (or join) table and common field name and the type
of join are identified inside the element. An exact join is appropriate
for one-to-one or many-to-one relationships. A scan join is most
effective for one-to-many or many-to-many relationships.
Conclusion
By understanding the structure of ArcXML and elements
and attributes, the functionality of ArcIMS can be extended by modifying
elements in the map configuration file. Try the three companion
tutorials for this article. Each gives detailed instructions for
manually editing the map configuration files. Read more about ArcXML
and the map configuration file in the ArcXML Programmer's Reference
Guide.
About the Author
Esri Educational Services team member Mark Ho is
an ArcIMS and ArcView 3.x instructor and the coauthor and
course manager for the three-day instructor-led course, Introduction
to ArcIMS.
|