Introduction to
Oracle Spatial
EHSAN HAMZEI
DECEMBER, 2016
Oracle Spatial??
Oracle Spatial Technology Products :
Storage data model using the SDO_GEOMETRY data
type
Query and analysis using the Index Engine and
Geometry Engine
Location-enabling using the geocoder by converting
address data into SDO_GEOMETRY data
Visualization using Map Viewer and Oracle Maps
Advanced Spatial Engine functionality such as network
analysis and routing
Oracle Spatial Architecture
SDO_GEOMETRY
Spatial Data Type in Oracle DB
How To Create a Table with Spatial Column??
SDO_GEOMETRY
What is a Geometry Data??
SDO_GEOMETRY
SDO Geometry Data Type:
SDO_G-Type
SDO_SRID
SDO_POINTS
SDO_ELEM_INFO_ARRAY
SDO_ORDINATE_ARRAY
SDO_GEOMETRY: G-TYPE
attribute specifies the type of shape (point, line,
polygon, collection, multi-point, multi-line, or multi-
polygon) that the geometry actually represents.
D00T
Example: 2003, 2001,3006
SDO_GEOMETRY: SRID
This attribute specifies the spatial reference system, or
coordinate system, for the geometry.
Geo-referenced vs. Local Coordinates!
Geodetic vs. Projected? (WGS84, UTM-Z39N)
European Petroleum Standards Group (EPSG)
Example: 4326 (WGS84),
SDO_POINTS
Its just a syntactic sugar!!
This attribute specifies the location of a point
geometry
Example:
SDO_ELEM_INFO
SDO_ELEM_INFO
SDO_ELEM_INFO
SDO_ORDINATE
Insert Coordinate Based on provided ElEM_INFO
Example:
SDO_ORDINATE
Insert Coordinate Based on provided ElEM_INFO
Example:
SDO_ORDINATE
Insert Coordinate Based on provided ElEM_INFO
Example:
SDO_ORDINATE
Insert Coordinate Based on provided ElEM_INFO
Example:
SDO_ORDINATE
Insert Coordinate Based on provided ElEM_INFO
Example:
SDO_ORDINATE
Insert Coordinate Based on provided ElEM_INFO
Example:
Complex Geometry
Complex Geometry
Complex Geometry
Complex Geometry
Complex Geometry
Collections
Collections
Collections
Collections
Creating Collections: The Easy Way :
For NON-OVERLAPPING geometries!!!
Collections
More Sophisticated Examples!!
Spatial Operators!
Spatial operators:
Just as you can specify relational operators in a SQL
statement, such as
“< (less than), > (greater than), or = (equal to), and
so on”, you can likewise use a spatial operator to search
the location (SDO_GEOMETRY) columns of a table for
proximity with respect to a query location
Need Spatial Index First !!!
Spatial Index!
Create Spatial Index
Need Spatial Meta Data First!!!
Spatial Meta Data Table
USER_SDO_GEOM_METADATA
DIM INFO >> INFORMATION ABOUT:
SDO_DIM_ELEMENT
DIM_NAME
MIN/MAX DATA
TOLERANCE
Spatial Meta Data Table
INSERTION EXAMPLE:
REVIEW
FIRST>> CREATE TABLE
THEN>> INSERT METADATA
NEXT>> CREATE SPATIAL INDEX
FINALLY>> INSERT DATA AND QUERY FROM THE
TABLE
SPATIAL OPERATORS
GENERAL SYNTAX:
EXAMPLE:
SPATIAL OPERATORS
SDO_WITHIN_DISTANCE
Operator
Concept:
Syntax:
Example:
SDO_NN Operator
Concept:
Syntax:
Example:
SDO_NN Operator (more
examples)
SDO_RELATE
CONCEPT:
SYNTAX:
EXAMPLE:
SDO_RELATE
CONCEPT:
SDO_RELATE
CONCEPT:
SDO_RELATE
Syntax:
Example:
SDO_RELATE
More Example:
Geometry Processing
Functions
No Need For Spatial Index!
more detailed analyses
can appear in the SELECT list (as well as the WHERE
clause)
GP Function:
1-Buffering Function
2- Relationship Function
3- Geometry Combination Function
4- Geometric Analysis Function
5- Aggregate Function
Buffering Function
Concept
Buffering Function
Syntax:
Example:
Relationship Analysis
Functions
SDO_DISTANCE
Concept:
Relationship Analysis
Functions
SDO_DISTANCE
Syntax:
Example:
Relationship Analysis
Functions
Relate
Syntax
Relationship Analysis
Functions
Relate Example:
Geometry Combination
Functions
Concept
Geometry Combination
Functions
Syntax:
Examples:
Geometry Combination
Functions
Geometric Analysis
Functions
Numeric
Area
Length
Volume
Geometric Analysis
Functions
Geometric
MBR
Convex Hall
Centroid
Aggregate Functions
AGGR_MBR
AGGR_CONVEXHULL
AGR_UNION
Aggregate Functions
REVIEW
CREATE SPATIAL TABLE
SDO_GEOMETRY (DML)
CREATE SPATIAL INDEX
INSERT SPATIAL METADATA
SPATIAL OPERATORS
SPATIAL FUNCTIONS
REFERENCE
Pro Oracle Spatial for Oracle Database 11g
Oracle® Spatial and Graph Developers’ Guide
(E49172-06)
THANKS