Themes
A theme is a visual representation of a particular data layer. Conceptually, each theme is associated with a specific spatial geometry layer. For example, a theme named US_States might be associated with the GEOM column with type MDSYS.SDO_GEOMETRY in a STATES table.
There are two types of themes, static or dynamic, supported in MapViewer. The static ones are called predefined themes and their definitions are stored in the USER_SDO_THEMES view. Dynamic themes (or JDBC themes) are defined on-the-fly within each map request.
The actual definition of a predefined theme consists of the following: name of a base table or view, name of the geometry column, and one or more styling rules that associate styles to rows from the base table.
Similarly a dynamic theme definition consists of the SQL query, the name of the geometry column, the JDBC database connection information, and one or more styling rules.
The styling rules are discussed in the next section.
Styling Rules
A predefined theme can have one or more styling rules. Each styling rule tells MapViewer two things:
Which rows from the base table belong to a theme, and what feature style should be used to render the geometries from those rows. What this really means is that you can select only the desired rows (features) from the base table of a theme.
Optionally, whether the geometries in the selected rows should be annotated or labeled. If the answer is yes, then the rule must specify a column whose values will be used as the annotation text, as well as a label style for drawing the labeling text. The placement of the labeling text as relative to the geometry is however automatically determined by MapViewer at run time.
Each styling rule is encoded in XML. The following rule is part of a theme named theme_us_airports, whose base table contains airports data, and has such columns named GEOM, NAME, and RUNWAY_NUMBER.
In this rule, as in any other styling rules, there are two parts. The first is the element, which tells MapViewer which rows should be selected and which style to use when rendering the geometries from those rows. Any valid WHERE clause (minus the keyword WHERE) can be specificed as the value of the node. In this case, all rows that satisfy the SQL condition "runway_number > 1 " will be selected, and a color style c.black gray will be used to depict the airport geometry for those rows.
The second part of the preceding styling rule is the
Dynamic themes in a map request
For dynamic themes defined on a per-map request basis, there can only be one styling rule. It is implicitly specified by giving the entire SQL query and the required feature and label styles in the theme definition in a slightly different way from predefined themes. An example of such a dynamic theme as part of a map request is:
In the preceding example, we are defining a dynamic theme named sales_by_region. The query that selects rows/features for this theme is SELECT REGION. SALES, MANAGER FROM FOO_SALES_2001. The feature and label style names are specified as render_style and label_style attributes, respectively. The database connection information is explicitly listed as part of the theme definition.
Finally, although the actual data for the theme may be from a different database (as indicated by the database connection information), the referenced styles will always be retrieved from the data source as indicated in the overall map request.
Thematic mapping through Advanced Styles
Simple thematic mapping can be achieved through the use of Advanced type styles in a theme. For example, one may define an advanced style that has a series (buckets) of colors each associated with a range of (population density) values. Assume that this style is named V.POP DENSITY.
Next we define a theme that uses V.POP DENSITY as the feature style as illustrated below.
Once such a theme has been defined, one can use it just as any other predefined theme, and when rendered it will appear as shown in Figure 1.
Figure 1. A simple thematic map
Base Maps
Predefined themes can be grouped together to collectively form a base map, which serves as a convenient way of including multiple themes in a map request. The base map definitions are stored in a user's USER_SDO_MAPS view. Each theme listed in a base map has a minimum and maximum scale. This provides a powerful mechanism of selectively displaying themes based on the current map's scale. For example, at a smaller map scale one may want to display only the major roads.