3.1.2.7 jdbc_image_query Element

The jdbc_image_query element, which is used to define an image theme (described in Image Themes), has the following definition:

<!ELEMENT jdbc_image_query (#PCDATA) >
<!ATTLIST jdbc_image_query
  asis (TRUE|FALSE) "FALSE"
  image_format CDATA #REQUIRED
  image_column CDATA #REQUIRED
  image_mbr_column CDATA #REQUIRED
  image_resolution CDATA #IMPLIED
  image_unit CDATA #IMPLIED
  datasource CDATA #IMPLIED
  jdbc_host CDATA #IMPLIED
  jdbc_port CDATA #IMPLIED
  jdbc_sid CDATA #IMPLIED
  jdbc_user CDATA #IMPLIED
  jdbc_password CDATA #IMPLIED
  jdbc_srid CDATA #IMPLIED
  jdbc_mode (thin|oci8) "thin"
>

To define a theme dynamically, you must supply a valid SQL query as the content of the <jdbc_image_query> element. You must specify the JDBC connection information for an image theme (either datasource or the combination of jdbc_host, jdbc_port, jdbc_sid, jdbc_user, and jdbc_password).

jdbc_srid is an optional attribute that specifies the coordinate system (SDO_SRID value) of the data to be rendered.

jdbc_mode identifies the Oracle JDBC driver (thin or oci8) to use to connect to the database.

asis is an optional attribute. If it is set to TRUE, MapViewer does not attempt to modify the supplied query string. If asis is FALSE (the default), MapViewer embeds the SQL query as a subquery of its spatial filter query. For example, assume that you want a map centered at (-122, 37) with size 1, and the supplied query is: SELECT geometry, sales FROM crm_sales WHERE sales < 100000;

If asis is FALSE, the actual query that MapViewer executes is similar to:

SELECT * FROM
(SELECT geometry, sales FROM crm_sales WHERE sales < 100000)
WHERE sdo_filter(geometry, sdo_geometry(. . . -122.5, 36.5, -123.5, 37.5 . . .) ='TRUE';

In other words, the original query is further refined by a spatial filter query for the current map window. However, if asis is TRUE, MapViewer executes the query as specified, namely: SELECT geometry, sales FROM crm_sales WHERE sales < 100000;

image_format identifies the format (such as GIF or JPEG) of the image data. If the image format is not supported by MapViewer, you must create and register a custom image renderer for the format, as explained in Creating and Registering a Custom Spatial Data Provider.

image_column identifies the column of type BLOB where each image is stored.

image_mbr_column identifies the column of type SDO_GEOMETRY where the footprint (minimum bounding rectangle, or MBR) of each image is stored.

image_resolution is an optional attribute that identifies the original image resolution (number of image_unit units for each pixel).

image_unit is an optional attribute, except it is required if you specify the image_resolution attribute. The image_unit attribute specifies the unit of the resolution, such as M for meter. The value for this attribute must be one of the values in the SDO_UNIT column of the MDSYS.SDO_DIST_UNITS table. In Example 2–13 in Section 2.3.3.1, the image resolution is 2 meters per pixel.

For an example of using the <jdbc_image_query> element to specify an image theme, see Example 3-6.