Related Topics |
---|
You may want to occasionally put constraints on your layer and data. Constraining your data not only protects it but is important when considering performance. The less data accessed, processed, and returned, the faster the response is. You can use SPATIALQUERY in your map configuration file to add constraints. Some common uses of SPATIALQUERY are:
In addition to setting constraints, SPATIALQUERY is also used for joining tables in ArcSDE and with shapefiles. In general, joining tables decreases performance. Therefore, you should limit the number of joined tables in ArcIMS.
The values you set in the configuration file cannot be overridden by a request. This is an important consideration when trying to protect your data or your site.
For more information, see SPATIALQUERY.
Note: Once you have added SPATIALQUERY to a map configuration file, you should not open and save the file in Author. Your edits will be deleted by Author.
<LAYER type="featureclass" name="Countries" visible="true" id="1"> <DATASET name="countries" type="polygon" workspace="shp_ws-0" /> <COORDSYS id="4326" /> <SPATIALQUERY featurelimit="100" /> <SIMPLERENDERER> <SIMPLEPOLYGONSYMBOL fillcolor="255,255,153"/> </SIMPLERENDERER> </LAYER> |
<LAYER type="featureclass" name="Countries" visible="true" id="1"> <DATASET name="countries" type="polygon" workspace="shp_ws-0" /> <COORDSYS id="4326" /> <SPATIALQUERY subfields="NAME POPULATION #SHAPE# #ID#" /> <SIMPLERENDERER> <SIMPLEPOLYGONSYMBOL fillcolor="255,255,153"/> </SIMPLERENDERER> </LAYER> |
Some symbols must be "escaped" inside a where expression:
ampersand (&) is escaped to &
double quotes (") are escaped to "
single quotes (') are escaped to '
greater than (>) is escaped to >
less than (<) is escaped to <
<LAYER type="featureclass" name="Countries" visible="true" id="1"> <DATASET name="countries" type="polygon" workspace="shp_ws-0" /> <COORDSYS id="4326" /> <SPATIALQUERY where= "POPULATION > 5000000" > <SPATIALFILTER relation="area_intersection"> <ENVELOPE maxy="-140" maxx="30" miny="-60" minx="70" /> </SPATIALFILTER> </SPATIALQUERY> <SIMPLERENDERER> <SIMPLEPOLYGONSYMBOL fillcolor="255,255,153"/> </SIMPLERENDERER> </LAYER> |
<LAYER type="featureclass" name="Countries" visible="true" id="1"> <DATASET name="countries" type="polygon" workspace="shp_ws-0" /> <COORDSYS id="4326" /> <SPATIALQUERY where="POPULATION > 5000000" searchorder="attributefirst" /> <SIMPLERENDERER> <SIMPLEPOLYGONSYMBOL fillcolor="255,255,153"/> </SIMPLERENDERER> </LAYER> |
<LAYER type="featureclass" name="Countries" visible="true" id="1"> <DATASET name="DB.COUNTRIES" type="polygon" workspace="shp_ws-0" /> <COORDSYS id="4326" /> <SPATIALQUERY order_by="ORDER BY DB.COUNTRIES.NAME" /> <SIMPLERENDERER> <SIMPLEPOLYGONSYMBOL fillcolor="255,255,153"/> </SIMPLERENDERER> </LAYER> |
Follow the syntax carefully for the join expression. In the following example, "COUNTRIES" refers to the shapefile DBF name. "CITIES" refers to the DBF file you want to join. "ID" is the name of the fields being joined. The jointables attribute lists all the tables you want to join, separated by a space.
<LAYER type="featureclass" name="Countries" visible="true" id="1"> <DATASET name="countries" type="polygon" workspace="shp_ws-0" /> <COORDSYS id="4326" /> <SPATIALQUERY joinexpression="To=[COUNTRIES.ID],From=[CITIES.ID],Type=[scan]" jointables="CITIES" /> <SIMPLERENDERER> <SIMPLEPOLYGONSYMBOL fillcolor="255,255,153"/> </SIMPLERENDERER> </LAYER> |
<LAYER type="featureclass" name="Countries" visible="true" id="1"> <DATASET name="DB.COUNTRIES" type="polygon" workspace="shp_ws-0" /> <COORDSYS id="4326" /> <SPATIALQUERY where="DB.COUNTRIES.FIPS = DB.COUNTRIES_INFO.FIPS" jointables="DB.COUNTRIES_INFO" /> <SIMPLERENDERER> <SIMPLEPOLYGONSYMBOL fillcolor="255,255,153"/> </SIMPLERENDERER> </LAYER> |