2-20 Oracle Fusion Middleware Users Guide for Oracle MapViewer
■
Any column whose name or alias matches that specified in the JDBC theme’s label_column attribute is treated as the labeling column, whose values are used
as text for labels.
■
Any other columns are treated as attribute data columns, which may or may not be used by MapViewer. For example, if the rendering style is an advanced style,
any attribute columns are processed by that style in the order in which they appear in the SELECT list in the query. Thus, if you are performing thematic
mapping and using an advanced style, you must specify all attribute columns that are needed for the thematic mapping, in addition to the geometry column and
optional labeling column. A labeling column can also be an attribute column, in which case you do not need to specify that column in the SELECT list.
Example 2–8 is a map request that includes a JDBC theme.
Example 2–8 JDBC Theme in a Map Request
?xml version=1.0 standalone=yes? map_request title=My MAP datasource = mvdemo
themes theme name=jdbc_theme_1
jdbc_query datasource=mvdemo
jdbc_srid=41052 spatial_column=geometry
render_style=C.RED SELECT geometry from states where name=MA
jdbc_query theme
themes
map_request The full query that MapViewer executes for the JDBC theme in
Example 2–8 is:
SELECT geometry FROM states WHERE name=MA’; For this request, MapViewer generates a map that contains only the selected geometry
as a result of executing this JDBC themes query. In a more typical case, however, the map request will need to use several JDBC themes to plot additional dynamic data on
top of the base map. Furthermore, the map request may have a query window associated with it; that is, the user may want to see only a portion of the area included
in the whole base map. In this case, the SQL queries in the JDBC themes will be subjected to a spatial window query, to eliminate any unwanted results.
For more information about JDBC themes, see the information about the jdbc_ query element in
Section 3.2.9 .
2.3.2.1 Defining a Point JDBC Theme Based on Two Columns
If a database table uses two columns such as longitude and latitude to represent a point coordinate, you can define a JDBC theme based on the two columns to render
points. The table does not need to have a spatial geometry column, but it can have one; however, if the theme request defines the point columns and also the geometry
column, MapViewer will try to render the points using the two columns, not the geometry column.
Example 2–9 is a JDBC theme that renders points from two columns, named LONG_
LOC and LAT_LOC, of a table named POI. The x_column and y_column attributes
MapViewer Concepts 2-21
specify the columns containing the point coordinate values. In this example, the points are rendered using the C.RED style, and the table values from the NAME column are
rendered using the T.POI_NAME style.
Example 2–9 JDBC Theme Based on Columns
map_request . . .
center . . .
center themes
theme name=theme1 jdbc_query
datasource=mvdemo jdbc_srid=8265
x_column=long_loc y_column=lat_loc
render_style=C.RED label_column=name
label_style=T.POI_NAME SELECT long_loc, lat_loc,name FROM poi
jdbc_query theme
themes map_request
If the request specifies a valid query window that is, not the full extent, a WHERE expression based on the size of the request window is automatically added to the
query.
If the table has a geometry column, you can specify SQL code to use the geometry column as a filter.
Example 2–10 is similar to
Example 2–9 , but it adds the use of the
SDO_FILTER operator to specify a query window based on the geometry in the column named GEOMETRY. In
Example 2–10 , the question mark ? characters
indicate that the lower-left and upper-right coordinates of the query window rectangle are taken from values supplied at run time not shown in this example.
Example 2–10 JDBC Theme Based on Columns, with Query Window
map_request . . .
center . . .
center themes
theme name=theme1 jdbc_query
datasource=mvdemo jdbc_srid=8265
x_column=long_loc y_column=lat_loc
render_style=C.RED label_column=name
label_style=T.POI_NAME SELECT long_loc, lat_loc FROM poi WHERE
SDO_FILTERgeometry,MDSYS.SDO_GEOMETRY2003, 8265, NULL, MDSYS.SDO_ELEM_INFO_ARRAY1, 1003, 3,
MDSYS.SDO_ORDINATE_ARRAY?,?,?,?, querytype=WINDOW = TRUE
2-22 Oracle Fusion Middleware Users Guide for Oracle MapViewer
jdbc_query theme
themes map_request
2.3.2.2 Storing Complex JDBC Themes in the Database