Spatial Support in SQL Developer

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:

Context Menu Operations on Spatial Data and Metadata

In the Connections navigator display, the context menu (right-click) for a table includes a Spatial submenu, which includes the following commands:

Map Visualization of Spatial Data

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.)

Map View window

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:

Visualizing Geometries by Creating and Executing a Query

To visualize geometries by creating and executing a SQL query, follow these steps:

  1. Click View, then Map View to display the Map View window.

  2. Optionally, resize and reposition the Map View window.

  3. 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.

  4. 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.

  5. Click OK to complete the definition.

  6. 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.

Visualizing Geometries from the Table Data Grid

To visualize one or more geometries by from the table data grid, follow these steps:

  1. Display the information for a spatial table by clicking its name in the Connections navigator hierarchy display.

  2. Click the Data tab to display the data in the table.

  3. 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.)

  4. 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

Entering and Modifying Data

Spatial Support in SQL Developer