Use Geometry Data Type Columns in Visualizations

Oracle Analytics supports the geometry data type which lets users visualize and work with geometry columns and layers in visualizations.

About the Geometry Data Type

Oracle Analytics automatically recognizes geometry columns from Oracle databases and CSV files, so you can easily import and connect to spatial data.

A geometry data type in Oracle Analytics can represent a wide range of spatial shapes, including points, polygons, and lines, enabling detailed and dynamic geographic visualizations. You can use Geometry data types for visualizing data on maps or as inputs for advanced spatial calculations, enabling detailed spatial analysis.

Geometry columns are special first-class objects in Oracle Analytics that you can use for the following operations:

  • To create map visualizations
  • In custom calculations for spatial measurements and correlations (either on a canvas or in a data flow)
  • As part of custom SQL sourcing (meaning that you can create a dataset using Spatial SQL defined through the Manual SQL query mode)

When you use a geometry column many other operations are disabled or extremely limited. You can't use geometry columns as filters in a workbook or as components (visualization definition grammar) in any visualizations other than maps. You can’t set the geometry data type manually on a data column, it must be recognized as a geometry data type when importing as a dataset.

About the Business Value of the Geometry Data Type

You can easily use Geometry columns from Oracle databases and CSV files, so that you can easily import and connect to spatial data.

Accelerate Map Design and Visualization

You can quickly visualize geographic information by dragging and dropping geometry columns onto a canvas where the shapes render automatically as a map visualization, without having to manually set up any map layers. Spatial data objects, whether sourced directly from an Oracle database or a CSV file, are effortlessly rendered in Oracle Analytics as maps, allowing you to quickly create dynamic spatial insights. This native feature boosts visual performance and ensures the smooth and responsive rendering of spatial data objects.

Optimize Map Layer Maintenance

In scenarios where geometry definitions frequently change—such as delivery routes, flood zones, or custom sales regions—using the geometry data type ensures that maps in Oracle Analytics are automatically updated with the latest shape information. There’s no need to preconfigure or ensure a specific map layer exists in your Oracle Analytics environment, the geometry data automatically shows in a map visualization. There’s also no need to manually update any data or map layers to reflect changes, as the maps dynamically adjust by querying the updated geometry data. This eliminates extra maintenance of data layers or map layers and ensures that maps always display the most current data.

Support Spatial Calculations

You can compute calculations to perform spatial measurements using the geometry data type. Spatial calculations enable you to calculate the area and length of geometry shapes, measure distances between two geographic data types (assuming proper joining is defined), determine spatial relationships, and perform condition-based calculations that return true or false. These calculations help you analyze geographic data more effectively, leading to powerful spatial data-driven decisions.

Work with Geometry Data Type Columns

Oracle Analytics supports the geometry data type which lets users visualize and work with geometry columns.

Topics:

Content authors can use the geometry data type in their workbooks.

Prepare Geometry Columns for Visualizing Maps

You can prepare and connect to geometry data types in Oracle Analytics from either an Oracle database, using the Spatial Data Object Geometry data type (SDO.Geometry), or a CSV file.

The CSV source data must include geometry data in the Well-Known Text (WKT) format to be recognized by Oracle Analytics. For data sourcing from an Oracle database, you use a direct connection or through a semantic model. The value stored in geometry columns appears as [GEOMETRY] Geometry column and can only be used in map visualizations or custom calculations.
  1. On the Home page, click Create, and then click Dataset.
  2. In the Create Dataset dialog, select an already configured connection to an Oracle database which has the SDO.Geometry column, or select a CSV file with a WKT column.




    Joins between geometry columns from two different datasets aren’t supported. For use cases where you need to relate between the geometry columns, you must create and establish a distinct join using existing columns.

Add Geometry Columns to a Workbook

You can start visualizing shapes from a geometry column by using a dataset that holds geometry data.

A geometry column can be consumed from a dataset created based on a SDO.Geometry data type from an Oracle database or a Well-Known Text (WKT) format from a CSV file.
  1. On the Home page, click the Create, and then click Workbook.
  2. In the Add Data dialog, click a dataset with a geometry column Geometry column, then click Add to Workbook.
  3. Click Save.
    After you add the dataset to your workbook, you simply drag and drop the geometry column, for example WKT, onto the Visualize canvas to start to create visualizations.

Visualize Geometry Column Data

You can use the geometry column to start building a visualization.

  1. In the Data panel, locate the geometry column Geometry columnand drag it to the Visualize canvas.
    This is an example of a geometry data type column from an Oracle database visualizing the shape of US Counties with the metric Sales for Color.

    This is an example of a geometry data type WKT column from a CSV file visualizing the shape of US Counties with the metric Quantity Ordered for Color.

    By default, the map visualization renders without any background map layer. If required, you can overlay the map shape on a background map layer.

    This is an example of US Counties and the buffer area from a storm path visualized with no background layer in the top row of the figure, and with the Oracle DataViz map background layer in the bottom row of the figure



Work with Geometry Data Layers and Layer Properties

You can make changes to geometry data layers and layer properties.

Overlay Multiple Data Layers with Geometry Columns

You can add geometry columns to multiple data layers.

  1. In the Grammar pane, click Layer Options for an existing layer, click Add Layer, and then select Add Data Layer.


    Note that geometry columns can be used only in a data layer. If you need to use them in a reference layer, you must generate a GeoJSON file to support that reference layer.

  2. In the Data pane, locate the dataset from which the new layer needs to be overlaid and drag the geometry column Geometry column to the new data layer.


    This example visualizes the new data layer over the existing one and shows how the Storm Line layer is added on top of US Counties.



Adjust the Size of a Geometry Data Layer

If your geometry data layer is a line or a point you can adjust the size of the data layer.

  1. In the Properties pane, click Layers, and then locate and expand the layer you want to adjust the size for.
  2. Click the Size field and use the slider to adjust the size.


    This example shows how the size of a geometry line layer representing a storm line is now adjusted in the visualization. The point size is adjusted to the value of 2.



Change the Colors of Geometry Shapes

You can change the colors of geometry shapes when no default colors are specified in the Grammar pane.

  1. Right-click a map visualization and select Layer.

    This example shows how to adjust the color for the storm line overlaid on top of US Counties.



  2. Select a color, and then click OK.

    This example shows the Storm Line is now red.



Order the Geometry Layers

You can order geometry layers if there are multiple layers to be overlaid.

  1. In the Grammar pane, click Layer Options for an existing layer, and then click Order Layer.
  2. Click Send Backward. The new layer is sent backwards behind the previous layer, and the previous layer moves in front of the latest layer added

    This example shows how a new layer called Storm Buffer is added on top of an existing layer which has the geometry column Geometry column from a layer called Storm Line. Since it’s overlaid on top of an existing layer, the Storm Line layer is no longer visible



    This example shows the map layers for US Counties, Storm Line, and Storm Buffer in the right order.



Work with Background Map Layers and Geometry Data Type Layer Properties

You can make changes to background map layers and geometry layer properties.

Apply a New Background Map Layer for Geometry Data Type Layers

You can apply a new background map layer for all of the geometry data type layers.

  1. In the Properties pane, click Map.
  2. Click Background Map and select a layer.

Modify Properties of Each Geometry Data Type Layer

You can still make changes to the layers by modifying the properties of each geometry data type layer.

  1. In the Properties pane, click Layers, and expand the geometry data type layer you want to modify.
  2. Click Color and select .Custom.
  3. Click Fill Color and choose a color.


    This example shows the Storm Buffer layer with the new color.



    You can see the statistics on how many shapes are used in the visualization at the bottom of the Visualize page. Example shows that there are 3,223 polygons and one line used as part of all the data layers in the map



Create a Unique Name for Each Geometry Data Type Layer

You should always create a unique name for each geometry data type layer.

  1. In the Properties pane, click Layers.
  2. Click Name, choose Custom, and enter a name for the layer.

Work with Toggle Off, Toggle On, and Legends for Geometry Data Type Layers

You can toggle the geometry type data layers on and off when the map legend is enabled.

  1. In the Properties pane, click General, and check the Legend Position field. The legend displays by default.

    This example shows the legend and layer names for the map visualization.



  2. In the map legend, click a data layer to toggle it on or off.

    This example shows the Storm Buffer data layer toggled off, and Storm Line with US County data layers toggled on. Statistics now shows 3,222 Polygons and one Line. One Polygon for the Storm Buffer is now excluded from the visualization.



    This example shows the US County data layer toggled off, and Storm Line with Storm Buffer data layers toggled on. Statistics now shows one Polygon and one Line. 3,222 Polygons for the US County data layer are now excluded from the visualization.



Work with the Selection Tool for Geometry Data Type Layers

You can use the Selection tool to interact with geometry data type map layers.

You can only select content based on geometry columns if an attribute ID column (for example the name of the shape, or its ID), is added to the map visualization. For example, the Keep Selected and Remove Selected options are only available once an attribute is added as a Color, Tooltip, or Shape.

This example shows the Storm Line layer and a layer with assets in different cities. City as an attribute column is used as a tooltip here to enable the Keep Selected and Remove Selected options.
Description of maps_geodatatype_layer_keepremove_selected.png follows
Description of the illustration maps_geodatatype_layer_keepremove_selected.png

  1. Hover over the top right of the map visualization and locate the options for selection: Rectangle, Radial, and Polygon The map selection area options: rectangle, radial, polygon.
  2. Click an option to select it, then drag and draw a custom selection area on top of the data layer.

    This example shows how a Polygon selection is used and enables users to draw and select specific attributes.



    This example shows how selected locations are highlighted once the polygon drawing is released.



    This example shows how users can interact with the custom selection by either keeping the selection or removing the selection.



    This example shows how the option Keep Selected keeps only the filtered members



    This example shows the Radial selection.



    This example shows the Rectangle selection.



Work with the Information Option for Geometry Data Type

You can use the Information option with a map visualization tool to get information about geometry shapes that may not be displayed on the map.

For example, shapes or polygons that are greater in size than 128 KB (per record) aren’t displayed in the map visualization. In this case, the Information icon (The Information icon before it's clicked.) appears toward the bottom right of the map visualization. When you click the icon, its color changes from grey to green (After you click the Information icon, it turns on the Information option near the title of the map visualization.) and turns on the Information option near the map visualization title. When you hover over this option, you can see which shapes don't render as part of the layer. The information displayed is more detailed if the attribute ID column is part of the map visualization (as a tooltip, color, or shape).

This example shows how the Information option provides more information on shapes that have issues, or that didn’t render.



In this example the polygons are shown in a Trellis Column, and polygons poly_4 and poly_5 aren’t displayed due to shape size beyond 128 KB, whereas poly_6 and poly_7 are displayed since the shape size is within 128 KB.



About Calculations that Require Only One Geometry Column

You can create calculations that use only one geometry column.

Calculate the Area of a Geometry

You can calculate the area of a geometry using one column.

Use the function GeometryArea() to calculate the area that a shape occupies.

This example shows an aggregate function max() applied on the GeometryArea() calculation.



This example shows how Top 10 counties in US based on area is visualized alongside all counties colored by the calculated area.



Calculate the Length of a Geometry

You can calculate the length of a geometry using one column.

Use the function GeometryLength() to calculate the length that a shape occupies.

This example shows the aggregate function max() applied to the GeometryLength() calculation.



This example shows the visualization on the right selecting top 10 counties based on GeometryLength() alongside all counties colored by length of the shape.



Generate a Spatial Data Object Definition in Standard Text Format

You can use the function GeometryAsText() to convert the longvarbinary values of the geometry column into Well-Known Text (WKT) format.

The function GeometryAsText() is also useful to troubleshoot when a specific shape isn’t being represented in the visualization.

This example shows the usage of GeometryAsText().



This example shows the standard format of the Storm Buffer geometry column.



You can also use standard calculation functions along with GeometryAsText(). For example, you can use the string function Length() to calculate the size of a shape, which is useful when identifying if a shape is beyond the acceptable limit of 128 kilobytes.

Usage: Length(GeometryAsText(Geometry_Column)) returns the size of the geometry shape in bytes.

About Calculations that Require Two Geometry Columns

You can create calculations that use two geometry columns.

Calculate the Distance Between Two Geometry Data Types

You can use the function GeometryDistance() to calculate the distance between two shapes.

If your data holds two geometry columns in different datasets, then this function requires you to properly join the two datasets so that all geometry records inter-relate (mimicking a spatial join). It’s advisable to establish the join while you prepare and create the dataset, and avoid blending the columns within the workbook canvas as an ad hoc mashup. It’s critical that you always consume these joins with some filter value on one side of the join. Either design the dataset with an embedded filter value, or design the canvas with an explicit filter value when using these in advanced geometry calculations. A good practice is to always filter the values while using calculations like GeometryDistance, GeometryRelate, and GeometryWithinDistance.

Usage: GeometryDistance(geometry_column1,geometry_column2).

This example shows an aggregate function max() applied on the GeometryDistance() calculation.



This example shows a join defined between two different database tables when you create the dataset.



Relate Two Geometry Data Types

You can use the function GeometryRelate() to determine whether one shape is related to another shape.

A shape from one geometry column can be inside, outside, adjacent inside, adjacent outside, or touching another shape from a different geometry column. The shapes are categorized as Inside, Outside, or Touch. This function may require a Cartesian join.

Usage: GeometryRelate(geometry_column1,geometry_column2).

This example shows the usage of the GeometryRelate() calculation.



The sequence in which the geometry columns are selected within the GeometryRelate() calculation has a direct impact on the result in which shapes are identified as relating to each other.

This example shows the visualization on the right relating all the counties that are touching the storm buffer or inside the storm buffer for potential impact.



This example shows shapes from US counties that are touching the storm buffer shape, calculated using the GeometryRelate() calculation.



This example shows shapes from US counties that are inside the storm buffer shape, calculated using the GeometryRelate() calculation.



Determine if Two Geometry Data Types Are Within a Specific Distance

You can use the function GeometryWithinDistance() to determine whether two shapes are within a specified distance of each other.

Based on the calculation, this function returns a True or a False as the result, and you can design visualizations based on the result. This function may require a Cartesian join. The sequence in which the geometry columns are selected within the calculation has a direct impact to the result.

Usage: GeometryWithinDistance(geometry_column1,geometry_column2,distance_in_meter).

This example shows the usage of the GeometryWithinDistance () calculation with two geometry columns within a numerical value of 350,000 meters or 350 kilometers.



This example shows the visualization on the right with all US Counties within a 350 kilometer range of the storm buffer. Only those counties that return the result as True are filtered and shown.



This example shows all the US Counties that return False and hence don’t have any direct impact from the storm.



What Are the Limitations of the Geometry Data Type?

The geometry data type offers exciting possibilities for map-based visualizations and advanced spatial analysis. While there are some limitations to the geometry data type, understanding them helps you make the most of its capabilities.

Limitations with the geometry data type columns:

  • Geometry columns can't be:
    • Used as joins between database tables
    • Used as objects to drill on
    • Dragged into any Filter grammar field
    • Used to pass context in a custom data action
    • Clicked to filter a selection of shapes
    • Rendered in maps on mobile devices
    • Used in advanced analytics functions like Forecasting, Clustering, Outlier/Non-Outlier, Reference Line, and Trend Line
  • Geometry columns:
    • Can only be placed in the Category grammar field for a map visualization. The content of a geometry column is only valid when used in a map or as an argument for a spatial calculation
    • Are only valid when used in a map, or as an argument for a spatial calculation
  • Geometry data have limitations for use in data flows.
  • Spatial joins or joins between geometry data types from different database tables or datasets aren’t supported.
  • Geometry data type records must each be under 128 kilobytes. If a record in a data source has a geometry expression where the size is above 128 kilobytes, the projection for this record doesn’t show on a map.
    • For example, suppose a table contains data about US states. The table has 50 rows, each containing a geometry data type column with the polygon representing the state shape. Assume one of the states has a very high resolution for its border definition, and the size of the geometry object string for this state amounts to more than 128 kilobytes. Now suppose Oracle Analytics creates the dataset, and queries made to the dataset honor every single column from the dataset. If geometries are projected on a map, then only 49 states are shown on the map. The state that's larger than 128 kilobytes isn't shown on the map, and a warning displays in the dialog for the Information icon on the map.

      If the size of a geometry shape is over 128 kilobytes, then you can try these alternative workarounds:

      • Simplify the definition of the polygon (reduce the number of points to delimit the polygon), and therefore reduce its technical storage.
      • Split the polygon into two or more distinct polygons to break down the size of each piece.
  • Oracle Analytics supports 2-D map coordinate systems only. Any known coordinate system defined in the data source is projected to WGS 84 (EPSG 4326).
  • File-based data sources containing geometry data must be Text/CSV files with the Geometry field expressed as Well-Known Text (WKT) formats. WKT is a text markup language for representing vector geometry objects. It can represent distinct geometry objects such as Points, MultiPoints, LineString, Polygons, and MultiPolygons. WKT format syntaxes such as GeometryCollection or FeatureCollection aren’t supported.
  • Files with the GeoJSON format with geometry data aren’t supported for importing as datasets with geometries in Oracle Analytics. In order to create a dataset with a geometry column, you must first convert GeoJSON files into CSV with WKT geometry formats, or load them into an Oracle database with the SDO.Geometry format.

What Are the Performance Considerations for the Geometry Data Type?

The geometry data type has some performance considerations that you should understand to help you make the most of its capabilities.

You should consider the following performance considerations for the Geometry data type:

  • Physical size of the data retrieved by the map
    • For large datasets with many distinct geometry records, the performance when rendering a map visualization might be impacted by the size of the geometry data that transits over the network to the browser in which Oracle Analytics is running. The performance is a combination of how many distinct geometries are represented on the map, and the average size (in kilobytes) of each geometry. As the map visualization builds, it fetches the geometry definitions through the network for each distinct shape on the map, and for each distinct layer. Very large lists of geometries take longer to render when geometries have a very fine definition (large average size).
    • Mitigation Avoid using too many geometries in a map. Even if the system supports up to 125,000 geometries, using too many can cause the map to render slowly. If you do need to show many shapes at once, filter specific areas so that users can display one area at a time.
  • Spatial Cartesian joins
    • Spatial calculation functions such as GeometryDistance, GeometryRelate, and GeometryWithinDistance, may require you to have two joined datasets. These functions might require a many to many join type in order to compute every pair of geometries in your data. You must design this modelling with care to minimise the impact on query performance.
    • Mitigation
      • Use a data model, and most importantly, data filtering on geometry records to avoid Cartesian joining effects.
      • When using a database, spatial calculations ship down the function to the database and let Oracle Analytics retrieve the results of the calculation. When you optimize performance, try to ensure this function-shipping is happening properly. There may be cases where other calculations are added (in data flows or workbooks) that prevent Oracle Analytics from pushing down the work to the database. In the context of troubleshooting performance, it’s important to check the context that allows function shipping.

List of Oracle Spatial Calculations

You can use this list of spatial functions from the Oracle Analytics Calculation Library when you work with the geometry data type.

Spacial Function Syntax Description
GeometryArea GeometryArea(shape_expr) Calculates the area that a shape occupies.
GeometryLength GeometryLength(shape_expr) Calculates the circumference of a shape.
GeometryAsText GeometryAsText(shape_expr) Converts the longvarbinary values of the geometry column into Well-Known Text (WKT) format, a standard format for representing geometry objects.
GeometryDistance GeometryDistance(shape_expr1,shape_expr2) Calculates the distance between two shapes.
GeometryRelate GeometryRelate(shape_expr1,shape_expr2) Determines whether one shape is inside another shape.
GeometryWithinDistance GeometryWithinDistance(shape_expr1, shape_expr2,distance_expr) Determines whether two shapes are within a specified distance of each other.

Descriptions of the arguments that you can use with the geometry data type:

  • shape_expr - Represents any valid geometry column or shape expression.
  • shape_expr1,shape_expr2 - Represents any valid geometry column or shape expression.
  • distance_expr - Represents any expression that evaluates to a numeric value in meters.