3.1.2.2 bounding_themes Element
The <bounding_themes>
element has the following
definition:
<!ELEMENT bounding_themes (#PCDATA) >
<!ATTLIST bounding_themes
border_margin CDATA #IMPLIED
preserve_aspect_ratio CDATA "TRUE"
size_hint CDATA #IMPLIED
>
You can specify one or more themes as the bounding themes when you cannot
predetermine the data size for a map. For example, you may have one dynamic theme
that selects all data points that meet certain criteria, and you then want to plot
those data points on a map that is just big enough to enclose all the selected data
points. In such cases, you can use the <bounding_themes>
element
to specify the names of such dynamic themes. MapViewer first processes any themes
that are specified in the <bounding_themes>
element, generates a
bounding box based on the resulting features of the bounding themes, and then
prepares other themes according to the new bounding box.
The <bounding_themes>
element is ignored if you specify the
<box>
or <center>
element in the map
request.
border_margin
is an optional attribute that specifies the percentage
to be added to each margin of the generated bounding box. For example, if you
specify a value of 0.025, MapViewer adds 2.5% of the width to the left and right
margins of the generated bounding box (resulting in a total 5% width expansion in
the x-axis); similarly, 2.5% of the height is added to the top and bottom margins.
The default value is 0.05, or 5% to be added to each margin.
preserve_aspect_ratio
is an optional attribute that indicates
whether or not the bounding box generated after processing the bounding themes
should be further modified so that it has the same aspect ratio as the map image or
device. The default is TRUE, which modifies the bounding box to preserve the aspect
ratio, so as not to distort the resulting map image.
size_hint
is an optional attribute that specifies the vertical span
of the map in terms of the original data unit. For example, if the user's data is in
decimal degrees, the size_hint attribute specifies the number of decimal degrees in
latitude. If the user's data is projected with meter as its unit, MapViewer
interprets size_hint in meters.
The size_hint
attribute can be used to extend the boundary limit.
This is useful when the bounding theme has just one point feature. For example, the
bounding theme can be a point resulting from a geocoding query, and you want to
place this point in the middle of the map and extend the boundary from that
point.
The element itself contains a comma-delimited list of names of the bounding themes.
The theme names must exactly match their names in the map request or the base map
used in the map request. The following example shows a map request with two bounding
themes, named theme1
and theme3
, and with 2.3
percent (border_margin="0.023"
) added to all four margins of the
minimum bounding box needed to hold features associated with the two themes:
<?xml version="1.0" standalone="yes"?>
<map_request title="Bounding Theme Example"
title_style="titleText"
datasource="mvdemo"
basemap="demo_map"
width="600"
height="500"
bgcolor="#a6cae0"
antialiase="false"
mapfilename="tilsmq202"
format="PNG_STREAM">
<bounding_themes border_margin="0.023">theme1, theme3</bounding_themes>
<themes>
<theme name="theme1"
min_scale="5.0E7"
max_scale="0.0">
<jdbc_query datasource="mvdemo"
jdbc_srid="8307"
spatial_column="geom"
label_column="STATE"
render_style="myPattern"
label_style="myText">SELECT geom, state from states where state_abrv='IL'</jdbc_query>
</theme>
<theme name="theme3"
min_scale="5.0E7"
max_scale="0.0">
<jdbc_query datasource="mvdemo"
jdbc_srid="8307"
spatial_column="geom"
label_column="STATE"
render_style="myPattern"
label_style="myText">SELECT geom,state from states where state_abrv='IN'</jdbc_query>
</theme>
</themes>
<styles>
<style name="myPattern">
<svg width="1in"
height="1in">
<desc />
<g class="area"
style="stroke:#6666e0;fill:#d6ccff;fill-opacity:128;line-style:L.STATE BOUNDARY" />
</svg>
</style>
<style name="myText">
<svg width="1in"
height="1in">
<g class="text"
float-width="1.0"
style="font-style:bold;font-family:Arial;font-size:16pt;fill:#6600ff">
Hello World!
</g>
</svg>
</style>
<style name="titleText">
<svg width="1in"
height="1in">
<g class="text"
float-width="1.0"
style="font-style:bold;font-family:Helvetica;font-size:18pt;fill:#333333">
Hello World!
</g>
</svg>
</style>
</styles>
</map_request>
The preceding example displays a map in which the states of Illinois and
Indiana are displayed according to the specifications in the two
<theme>
elements, both of which specify a rendering style
named myPattern
. In the myText
style, the text
"Hello World!" is displayed only when the style is being previewed in a
style creation tool, such as the Map Builder tool. When the style is applied to a
map, it is supplied with an actual text label that MapViewer obtains from a
theme.
The following figure shows the display from the preceding example.
Parent topic: Map Request DTD