Home > SQL Developer Concepts and ... > Spatial Support in SQL Deve...
SQL Developer lets you work with Oracle Spatial and Graph data and metadata. Oracle Spatial and Graph (referred to as Spatial and Graph) facilitates the storage, retrieval, update, and query of collections of Spatial and Graph features in an Oracle database. Spatial and Graph includes a schema (MDSYS), a data type (SDO_GEOMETRY), a spatial indexing mechanism and index type, and operators, functions, and procedures for performing area-of-interest queries, spatial join queries, and other spatial analysis operations.
For complete information about Oracle Spatial and Graph, including the differences between Spatial and Graph and Oracle Locator (a subset of Spatial and Graph), see Oracle Spatial and Graph Developer's Guide.
SQL Developer support for Spatial and Graph includes the following:
In the Connections navigator display, the context menu (right-click) for a table includes a Spatial submenu, which includes the following commands:
Update Spatial Metadata displays the Maintain Spatial Metadata dialog box, which enables you to update the spatial metadata for data in columns of type SDO_GEOMETRY in the table.
Validate Geometry Using Tolerance performs a consistency check, based on the tolerance value that you specify, for valid geometry types in the spatial data in the table, and returns context information if any geometries are invalid. Displays the Validate Geometry dialog box.
Validate Geometry Using Dimension Information performs a consistency check, based on the dimensional information associated with the spatial data (using the USER_SDO_GEOM_METADATA view), for valid geometry types in the spatial data in the table, and returns context information if any geometries are invalid. Displays the Validate Geometry dialog box.
Drop Spatial Metadata deletes the spatial metadata for the specified spatial column (but does not delete the column definition or the data).
Create Spatial Index creates a spatial index (INDEXTYPE IS MDSYS.SPATIAL_INDEX) on the specified spatial geometry column.
Drop Spatial Index deletes the specified spatial index.
You can use the Map View window for displaying spatial geometry objects that are returned by a query. The SQL Developer Map View display lacks the rich features of a visualizing tool such as Oracle MapViewer, but it provides a quick and flexible way to see simple representations of spatial data.
To display the Map View, click View, then Map View. You can resize and reposition the Map View window so that it adequately displays the geometries you want to see.
The following figure show the Map View window display of a query that returns all geometries for counties in the U.S. state of South Carolina. On the left is a map display pane with some icons above it. On the right is a Query List pane with one query (named South Carolina Counties
) and some icons above it. (Not shown is the database connection drop-down selector to the right of the Query List.)
You can visualize geometries in the Map View window by creating and executing a SQL query, or by selecting a geometry in a table data grid cell and using the context menu:
To visualize geometries by creating and executing a SQL query, follow these steps:
Click View, then Map View to display the Map View window.
Optionally, resize and reposition the Map View window.
Using the connection selector drop-down on the right above Query List (not shown in the figure), select the database connection to be used for the query.
Click the Add New Query (+) icon above Query List to display a query dialog box, and specify the information for the query:
Map Title: Short descriptive name for the display to result from the query. Example: South Carolina Counties
Map Query: SELECT statement to return the desired geometries. Example (for a table named COUNTIES that includes a geometry column named GEOM and a STATE_ABRV column for 2-character state abbreviations): SELECT geom FROM counties WHERE state_abrv = 'SC'
Map Styles: Optionally, customize the Line Color and Fill Color for the geometries, and select an Annotation Column. For the colors, you can click the square to display a dialog box for specifying a color using a swatch or an HSB or RGB value.
Click OK to complete the definition.
Optionally, repeat steps 4 and 5 to create one or more additional queries. (For a query using a different database connection, repeat steps 3 through 5.)
To execute the query and display the map in the left pane of the window, select (check mark) the query and click the Execute Checked Queries icon above Query List.
To modify a query, select (check mark) it and click the Edit Query (pencil) icon above Query List.
To delete a query from the list, select (check mark) it and click the Remove Query (X) icon above Query List.
In the map display pane on the left, you can click icons above the pane to control aspects of the display:
Zoom In expands the display and makes the objects appear larger.
Zoom Out contracts the display and makes the objects appear smaller.
Fit adjusts the display so that all objects fit in the pane.
Marquee Zoom lets you select a rectangle (press, drag, release), after which the display zooms to fit the selected rectangle in the pane.
To visualize one or more geometries by from the table data grid, follow these steps:
Display the information for a spatial table by clicking its name in the Connections navigator hierarchy display.
Click the Data tab to display the data in the table.
In the grid display of table data, click the cell with the spatial data for a geometry object. For example, if the spatial column is named GEOM
, click one of the cells under GEOM
. (The cell content will start with MDSYS.SDO_GEOMETRY
.)
Right-click, and select one of the following from the context menu:
Display Geometry Shape displays the selected geometry object in a standalone box.
Identify Geometry Shape in Map View highlights the selected geometry object in the Map View window (if it is included in the window).
Invoke Map View on Result Set displays all geometry objects in the column (that is, it displays the layer).
For information about icons and options in the Map View window, see Visualizing Geometries by Creating and Executing a Query.
Related Topics