3.5 Annotation Text Type and Views
Oracle Spatial supports annotation text as specified in the OpenGIS Implementation Specification for Geographic information - Simple feature access - Part 1: Common architecture, which defines annotation text as "simply placed text that can carry either geographically-related or ad-hoc data and process-related information as displayable text. This text may be used for display in editors or in simpler maps. It is usually lacking in full cartographic quality, but may act as an approximation to such text as needed by any application."
The ST_ANNOTATION_TEXT object type can be used to store annotation text. This type has a constructor for inserting annotation text into a table, as explained in Using the ST_ANNOTATION_TEXT Constructor.
The USER_ANNOTATION_TEXT_METADATA and ALL_ANNOTATION_TEXT_METADATA views store metadata related to annotation text, as explained in Annotation Text Metadata Views.
Parent topic: SQL Multimedia Type Support
3.5.1 Using the ST_ANNOTATION_TEXT Constructor
An annotation text object contains an array of objects, where each object consists of a text label, the point at which to start rendering the text label, a leader line (typically from the text label to the associated point on the map), and optionally extra attribute information. A single annotation text object may typically contain all the text labels for a map.
Each text label object has the following definition:
Name Null? Type ----------------------------------------- -------- ---------------------------- PRIVATEVALUE VARCHAR2(4000) PRIVATELOCATION MDSYS.SDO_GEOMETRY PRIVATELEADERLINE MDSYS.SDO_GEOMETRY PRIVATETEXTATTRIBUTES VARCHAR2(4000)
Example 3-3 Using the ST_ANNOTATION_TEXT Constructor
To insert the annotation for a single point, use the ST_ANNOTATION_TEXT constructor. This constructor specifies the information for a single point using an array, as shown in Example 3-3, which creates a table with a column of type ST_ANNOTATION_TEXT and inserts one row, using the ST_ANNOTATION_TEXT constructor in the INSERT statement.
CREATE TABLE my_annotations (id NUMBER, textobj ST_ANNOTATION_TEXT); INSERT INTO my_annotations VALUES (2, ST_ANNOTATION_TEXT( ST_ANNOTATIONTEXTELEMENT_ARRAY( ST_ANNOT_TEXTELEMENT_ARRAY( ST_ANNOTATIONTEXTELEMENT( 'Sample Label 2', SDO_GEOMETRY(2001,null,sdo_point_type(10,10,null),null,null), SDO_GEOMETRY(2002,null,null, SDO_ELEM_INFO_ARRAY(1,2,1), SDO_ORDINATE_ARRAY(5,10, 10,10)), NULL)))));
In the ST_ANNOTATION_TEXT constructor in Example 3-3, the ST_ANNOTATIONTEXTELEMENT subelement specifies the following:
-
The text for the label, in this case
Sample Label 2
-
A point geometry specifying where to start rendering the label, in this case location (10,10)
-
A line string geometry specifying the start and end points of the leader line between the point of interest and the text label, in this case a line between locations (5,10) and (10,10)
-
No text display attribute information (NULL), which means that the information TEXT_ATTRIBUTES column of the annotation text metadata views is used (see Table 3-2 in Annotation Text Metadata Views)
Parent topic: Annotation Text Type and Views
3.5.2 Annotation Text Metadata Views
The annotation text metadata is stored in a global table owned by MDSYS (which users should never directly update). Each Spatial user has the following views available in the schema associated with that user:
-
USER_ANNOTATION_TEXT_METADATA contains metadata information for all annotation text in tables owned by the user (schema). This is the only view that you can update, and it is the one in which Spatial users must insert metadata related to spatial tables.
-
ALL_ANNOTATION_TEXT_METADATA contains metadata information for all annotation text in tables on which the user has SELECT permission.
Spatial users are responsible for populating these views. For each annotation text object, you must insert an appropriate row into the USER_ANNOTATION_TEXT_METADATA view. Oracle Spatial ensures that the ALL_ANNOTATION_TEXT_METADATA view is also updated to reflect the rows that you insert into USER_ANNOTATION_TEXT_METADATA.
The USER_ANNOTATION_TEXT_METADATA and ALL_ANNOTATION_TEXT_METADATA views contain the same columns, as shown Table 3-2, except that the USER_ANNOTATION_TEXT_METADATA view does not contain the OWNER column. (The columns are listed in their order in the view definition.)
Table 3-2 Columns in the Annotation Text Metadata Views
Column Name | Data Type | Purpose |
---|---|---|
OWNER |
VARCHAR2(32) |
Owner of the table specified in the TABLE_NAME column (ALL_ANNOTATION_TEXT_METADATA view only). |
TABLE_NAME |
VARCHAR2(32) |
Name of the table containing the column of type ST_ANNOTATION_TEXT. |
COLUMN_NAME |
VARCHAR2(1024) |
Name of the column of type ST_ANNOTATION_TEXT. |
TEXT_EXPRESSION |
VARCHAR2(4000) |
A value that can be used if text is not specified for a label. As explained in the OpenGIS specification: "Text to place is first derived from the contents of VALUE in the current element, if VALUE is not null. Otherwise, text is derived from the first non-null preceding element VALUE. If all preceding elements have null VALUE fields, VALUE is derived from the TEXT_EXPRESSION in the metadata table." |
TEXT_ATTRIBUTES |
VARCHAR2(4000) |
Default text display attributes (font family and size, horizontal and vertical spacing, and so on) for the label text style and layout, unless overridden in the PRIVATETEXTATTRIBUTES attribute of the ST_ANNOTATION_TEXT constructor (described in Using the ST_ANNOTATION_TEXT Constructor). Use the format specified in the "XML for Text Attributes" section of the OpenGIS specification. |
Parent topic: Annotation Text Type and Views