9-6 Part II Reference Information 10 SQL Statements for Indexing Spatial Data ALTER INDEX..... The Oracle Spatial User’s Guide and Reference provides usage and reference information fo
Trang 2Oracle Spatial User’s Guide and Reference, 10g Release 1 (10.1)
Part No B10826-01
Copyright © 1999, 2003 Oracle Corporation All rights reserved.
Primary Author: Chuck Murray
Contributors: Dan Abugov, Nicole Alexander, Bruce Blackwell, Janet Blowney, Dan Geringer, Albert Godfrind, Ravi Kothuri, Richard Pitts, Siva Ravada, Jack Wang, Jeffrey Xie
The Programs (which include both the software and documentation) contain proprietary information of Oracle Corporation; they are provided under a license agreement containing restrictions on use and disclosure and are also protected by copyright, patent and other intellectual and industrial property laws Reverse engineering, disassembly or decompilation of the Programs, except to the extent required
to obtain interoperability with other independently created software or as specified by law, is prohibited The information contained in this document is subject to change without notice If you find any problems
in the documentation, please report them to us in writing Oracle Corporation does not warrant that this document is error-free Except as may be expressly permitted in your license agreement for these Programs, no part of these Programs may be reproduced or transmitted in any form or by any means, electronic or mechanical, for any purpose, without the express written permission of Oracle Corporation.
If the Programs are delivered to the U.S Government or anyone licensing or using the programs on behalf of the U.S Government, the following notice is applicable:
Restricted Rights Notice Programs delivered subject to the DOD FAR Supplement are "commercial computer software" and use, duplication, and disclosure of the Programs, including documentation, shall be subject to the licensing restrictions set forth in the applicable Oracle license agreement
Otherwise, Programs delivered subject to the Federal Acquisition Regulations are "restricted computer software" and use, duplication, and disclosure of the Programs shall be subject to the restrictions in FAR 52.227-19, Commercial Computer Software - Restricted Rights (June, 1987) Oracle Corporation, 500 Oracle Parkway, Redwood City, CA 94065.
The Programs are not intended for use in any nuclear, aviation, mass transit, medical, or other inherently dangerous applications It shall be the licensee's responsibility to take all appropriate fail-safe, backup, redundancy, and other measures to ensure the safe use of such applications if the Programs are used for such purposes, and Oracle Corporation disclaims liability for any damages caused by such use of the Programs
Oracle is a registered trademark, and Oracle8i, Oracle9i, Oracle Store, PL/SQL, and SQL*Plus are
trademarks or registered trademarks of Oracle Corporation Other names may be trademarks of their respective owners.
Trang 3List of Examples
List of Figures
List of Tables
Send Us Your Comments xxi
Preface xxiii
Audience xxiv
Documentation Accessibility xxiv
Organization xxv
Technologies Released Separately xxvii
Related Documentation xxviii
Conventions xxviii
New and Changed Features xxxi
GeoRaster xxxi
Topology and Network Management xxxi
Spatial Analysis and Mining xxxii
Geocoding xxxii
Quadtree Indexing Discouraged; R-Tree Indexing Encouraged xxxii
New Utility Subprograms xxxii
New Operators xxxiii
SDO_NN Operator Behavior Changes xxxiv
New Spatial Aggregate Function xxxiv
New Coordinate Systems Function: VALIDATE_WKT xxxiv
MBRs Supported with Geodetic Data xxxiv
New and Changed LRS Subprograms xxxv
Trang 4Tolerance with LRS Subprograms xxxv
New Tuning Function: ESTIMATE_RTREE_INDEX_SIZE xxxv
Deprecated Tuning Subprograms xxxv
New GML Support Function: TO_GMLGEOMETRY xxxvi
Interior Buffers xxxvi
Tablespace for Temporary Tables During Index Creation xxxvi
Separate Index Table for Nonleaf Nodes xxxvi
MDSYS No Longer Needed with Spatial Data Types xxxvi
DBA_SDO_xxx Views No Longer Provided xxxvii
SDO_MIGRATE Procedures xxxvii
Java Client Interface xxxvii
Transportable Tablespace Support xxxvii
New Schema: MDDATA xxxviii
Complex Query Examples xxxviii
Part I Conceptual and Usage Information
1 Spatial Concepts
1.1 What Is Oracle Spatial? 1-2 1.2 Object-Relational Model 1-2 1.3 Introduction to Spatial Data 1-3 1.4 Geometry Types 1-4 1.5 Data Model 1-5 1.5.1 Element 1-6 1.5.2 Geometry 1-6 1.5.3 Layer 1-6 1.5.4 Coordinate System 1-6 1.5.5 Tolerance 1-8 1.5.5.1 Tolerance in the Geometry Metadata for a Layer 1-8 1.5.5.2 Tolerance as an Input Parameter 1-10 1.6 Query Model 1-10 1.7 Indexing of Spatial Data 1-12 1.7.1 R-Tree Indexing 1-12 1.7.2 R-Tree Quality 1-14 1.8 Spatial Relationships and Filtering 1-14
Trang 51.9 Spatial Operators, Procedures, and Functions 1-181.10 Spatial Aggregate Functions 1-191.10.1 SDOAGGRTYPE Object Type 1-191.11 Spatial Java Interface 1-201.12 Geocoding 1-211.13 MDDATA Schema 1-221.14 Performance and Tuning Information 1-221.15 Spatial Release (Version) Number 1-221.16 Spatial Application Hardware Requirement Considerations 1-231.17 Spatial Error Messages 1-231.18 Spatial Examples 1-23
2 Spatial Data Types and Metadata
2.1 Simple Example: Inserting, Indexing, and Querying Spatial Data 2-12.2 SDO_GEOMETRY Object Type 2-62.2.1 SDO_GTYPE 2-72.2.2 SDO_SRID 2-82.2.3 SDO_POINT 2-92.2.4 SDO_ELEM_INFO 2-92.2.5 SDO_ORDINATES 2-132.2.6 Usage Considerations 2-142.3 Geometry Examples 2-142.3.1 Rectangle 2-142.3.2 Polygon with a Hole 2-162.3.3 Compound Line String 2-182.3.4 Compound Polygon 2-192.3.5 Point 2-212.3.6 Type 0 (Zero) Element 2-232.4 Geometry Metadata Views 2-252.4.1 TABLE_NAME 2-262.4.2 COLUMN_NAME 2-262.4.3 DIMINFO 2-272.4.4 SRID 2-282.5 Spatial Index-Related Structures 2-282.5.1 Spatial Index Views 2-28
Trang 62.5.1.1 xxx_SDO_INDEX_INFO Views 2-282.5.1.2 xxx_SDO_INDEX_METADATA Views 2-292.5.2 Spatial Index Table Definition 2-322.5.3 R-Tree Index Sequence Object 2-322.6 Unit of Measurement Support 2-32
3 Loading Spatial Data
3.1 Bulk Loading 3-13.1.1 Bulk Loading SDO_GEOMETRY Objects 3-13.1.2 Bulk Loading Point-Only Data in SDO_GEOMETRY Objects 3-33.2 Transactional Insert Operations Using SQL 3-4
4 Indexing and Querying Spatial Data
4.1 Creating a Spatial Index 4-14.1.1 Creating R-Tree Indexes 4-14.1.2 Indexing Geodetic Data 4-34.1.3 Improving Performance with Bulk Insert Operations 4-34.1.4 Constraining Data to a Geometry Type 4-44.1.5 Creating a Cross-Schema Index 4-54.1.6 Using Partitioned Spatial Indexes 4-54.1.7 Exchanging Partitions Including Indexes 4-74.1.8 Export and Import Considerations with Spatial Indexes and Data 4-84.2 Querying Spatial Data 4-94.2.1 Spatial Query 4-94.2.1.1 Primary Filter Operator 4-114.2.1.2 Primary and Secondary Filter Operator 4-124.2.1.3 Within-Distance Operator 4-144.2.1.4 Nearest Neighbor Operator 4-154.2.1.5 Spatial Functions 4-164.2.2 Spatial Join 4-164.2.3 Cross-Schema Operator Invocation 4-17
5 Geocoding Address Data
5.1 Concepts for Geocoding 5-1
Trang 75.1.1 Address Representation 5-15.1.2 Match Modes 5-35.1.3 Match Codes 5-45.1.4 Error Messages for Output Geocoded Addresses 5-55.2 Data Types for Geocoding 5-65.2.1 SDO_GEO_ADDR Type 5-65.2.2 SDO_ADDR_ARRAY Type 5-95.2.3 SDO_KEYWORDARRAY Type 5-95.3 Using the Geocoding Capabilities 5-9
6 Coordinate Systems (Spatial Reference Systems)
6.1 Terms and Concepts 6-16.1.1 Coordinate System (Spatial Reference System) 6-26.1.2 Cartesian Coordinates 6-26.1.3 Geodetic Coordinates (Geographic Coordinates) 6-26.1.4 Projected Coordinates 6-26.1.5 Local Coordinates 6-26.1.6 Geodetic Datum 6-26.1.7 Authalic Sphere 6-26.1.8 Transformation 6-36.2 Geodetic Coordinate Support 6-36.2.1 Geodesy and Two-Dimensional Geometry 6-36.2.2 Choosing a Geodetic or Projected Coordinate System 6-46.2.3 Geodetic MBRs 6-46.2.4 Other Considerations and Requirements with Geodetic Data 6-66.3 Local Coordinate Support 6-76.4 Coordinate Systems Data Structures 6-86.4.1 MDSYS.CS_SRS Table 6-86.4.1.1 Well-Known Text (WKT) 6-96.4.2 MDSYS.SDO_ANGLE_UNITS Table 6-126.4.3 MDSYS.SDO_DATUMS Table 6-126.4.4 MDSYS.SDO_ELLIPSOIDS Table 6-156.4.5 MDSYS.SDO_PROJECTIONS Table 6-166.5 Creating a User-Defined Coordinate System 6-176.6 Coordinate System Transformation Functions 6-20
Trang 86.7 Notes and Restrictions with Coordinate Systems Support 6-206.7.1 Different Coordinate Systems for Geometries with Operators and Functions 6-206.7.2 Functions Not Supported with Geodetic Data 6-216.7.3 Functions Supported by Approximations with Geodetic Data 6-216.8 Example of Coordinate System Transformation 6-21
7 Linear Referencing System
7.1 Terms and Concepts 7-27.1.1 Geometric Segments (LRS Segments) 7-27.1.2 Shape Points 7-37.1.3 Direction of a Geometric Segment 7-37.1.4 Measure (Linear Measure) 7-47.1.5 Offset 7-47.1.6 Measure Populating 7-57.1.7 Measure Range of a Geometric Segment 7-77.1.8 Projection 7-77.1.9 LRS Point 7-77.1.10 Linear Features 7-77.2 LRS Data Model 7-87.3 Indexing of LRS Data 7-97.4 3D Formats of LRS Functions 7-107.5 LRS Operations 7-117.5.1 Defining a Geometric Segment 7-117.5.2 Redefining a Geometric Segment 7-127.5.3 Clipping a Geometric Segment 7-127.5.4 Splitting a Geometric Segment 7-137.5.5 Concatenating Geometric Segments 7-137.5.6 Scaling a Geometric Segment 7-157.5.7 Offsetting a Geometric Segment 7-167.5.8 Locating a Point on a Geometric Segment 7-177.5.9 Projecting a Point onto a Geometric Segment 7-187.5.10 Converting LRS Geometries 7-197.6 Tolerance Values with LRS Functions 7-207.7 Example of LRS Functions 7-21
Trang 98 Spatial Analysis and Mining
8.1 Spatial Information and Data Mining Applications 8-18.2 Spatial Binning for Detection of Regional Patterns 8-48.3 Materializing Spatial Correlation 8-58.4 Colocation Mining 8-58.5 Spatial Clustering 8-68.6 Location Prospecting 8-6
9 Extending Spatial Indexing Capabilities
9.1 SDO_GEOMETRY Objects in User-Defined Type Definitions 9-19.2 SDO_GEOMETRY Objects in Function-Based Indexes 9-39.2.1 Example: Function with Standard Types 9-49.2.2 Example: Function with a User-Defined Object Type 9-6
Part II Reference Information
10 SQL Statements for Indexing Spatial Data
ALTER INDEX 10-2ALTER INDEX REBUILD 10-6ALTER INDEX RENAME TO 10-9CREATE INDEX 10-10DROP INDEX 10-15
GET_DIMS 11-2GET_GTYPE 11-3GET_LRS_DIM 11-4
12 Spatial Operators
SDO_ANYINTERACT 12-3SDO_CONTAINS 12-5SDO_COVEREDBY 12-7
Trang 10SDO_COVERS 12-9SDO_EQUAL 12-11SDO_FILTER 12-13SDO_INSIDE 12-17SDO_JOIN 12-19SDO_NN 12-23SDO_NN_DISTANCE 12-29SDO_ON 12-31SDO_OVERLAPBDYDISJOINT 12-33SDO_OVERLAPBDYINTERSECT 12-35SDO_OVERLAPS 12-37SDO_RELATE 12-39SDO_TOUCH 12-44SDO_WITHIN_DISTANCE 12-46
SDO_GEOM.RELATE 13-4SDO_GEOM.SDO_ARC_DENSIFY 13-8SDO_GEOM.SDO_AREA 13-11SDO_GEOM.SDO_BUFFER 13-13SDO_GEOM.SDO_CENTROID 13-17SDO_GEOM.SDO_CONVEXHULL 13-19SDO_GEOM.SDO_DIFFERENCE 13-21SDO_GEOM.SDO_DISTANCE 13-24SDO_GEOM.SDO_INTERSECTION 13-26SDO_GEOM.SDO_LENGTH 13-29SDO_GEOM.SDO_MAX_MBR_ORDINATE 13-31SDO_GEOM.SDO_MBR 13-33SDO_GEOM.SDO_MIN_MBR_ORDINATE 13-35SDO_GEOM.SDO_POINTONSURFACE 13-37SDO_GEOM.SDO_UNION 13-39
Trang 11SDO_GEOM.SDO_XOR 13-42SDO_GEOM.VALIDATE_GEOMETRY 13-45SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT 13-47SDO_GEOM.VALIDATE_LAYER 13-50SDO_GEOM.VALIDATE_LAYER_WITH_CONTEXT 13-53SDO_GEOM.WITHIN_DISTANCE 13-56
14 Spatial Aggregate Functions
SDO_AGGR_CENTROID 14-2SDO_AGGR_CONCAT_LINES 14-4SDO_AGGR_CONVEXHULL 14-6SDO_AGGR_LRS_CONCAT 14-7SDO_AGGR_MBR 14-9SDO_AGGR_UNION 14-11
15 Coordinate System Transformation Subprograms
SDO_CS.TRANSFORM 15-2SDO_CS.TRANSFORM_LAYER 15-5SDO_CS.VALIDATE_WKT 15-7SDO_CS.VIEWPORT_TRANSFORM 15-9
16 Linear Referencing Subprograms
SDO_LRS.CLIP_GEOM_SEGMENT 16-6SDO_LRS.CONCATENATE_GEOM_SEGMENTS 16-8SDO_LRS.CONNECTED_GEOM_SEGMENTS 16-11SDO_LRS.CONVERT_TO_LRS_DIM_ARRAY 16-13SDO_LRS.CONVERT_TO_LRS_GEOM 16-16SDO_LRS.CONVERT_TO_LRS_LAYER 16-19SDO_LRS.CONVERT_TO_STD_DIM_ARRAY 16-22SDO_LRS.CONVERT_TO_STD_GEOM 16-24SDO_LRS.CONVERT_TO_STD_LAYER 16-26
Trang 12SDO_LRS.DEFINE_GEOM_SEGMENT 16-28SDO_LRS.DYNAMIC_SEGMENT 16-31SDO_LRS.FIND_LRS_DIM_POS 16-33SDO_LRS.FIND_MEASURE 16-34SDO_LRS.FIND_OFFSET 16-36SDO_LRS.GEOM_SEGMENT_END_MEASURE 16-38SDO_LRS.GEOM_SEGMENT_END_PT 16-40SDO_LRS.GEOM_SEGMENT_LENGTH 16-42SDO_LRS.GEOM_SEGMENT_START_MEASURE 16-44SDO_LRS.GEOM_SEGMENT_START_PT 16-46SDO_LRS.GET_MEASURE 16-48SDO_LRS.GET_NEXT_SHAPE_PT 16-50SDO_LRS.GET_NEXT_SHAPE_PT_MEASURE 16-52SDO_LRS.GET_PREV_SHAPE_PT 16-55SDO_LRS.GET_PREV_SHAPE_PT_MEASURE 16-58SDO_LRS.IS_GEOM_SEGMENT_DEFINED 16-61SDO_LRS.IS_MEASURE_DECREASING 16-63SDO_LRS.IS_MEASURE_INCREASING 16-65SDO_LRS.IS_SHAPE_PT_MEASURE 16-67SDO_LRS.LOCATE_PT 16-69SDO_LRS.MEASURE_RANGE 16-72SDO_LRS.MEASURE_TO_PERCENTAGE 16-74SDO_LRS.OFFSET_GEOM_SEGMENT 16-76SDO_LRS.PERCENTAGE_TO_MEASURE 16-79SDO_LRS.PROJECT_PT 16-81SDO_LRS.REDEFINE_GEOM_SEGMENT 16-84SDO_LRS.RESET_MEASURE 16-87SDO_LRS.REVERSE_GEOMETRY 16-89SDO_LRS.REVERSE_MEASURE 16-91SDO_LRS.SCALE_GEOM_SEGMENT 16-93SDO_LRS.SET_PT_MEASURE 16-96
Trang 13SDO_LRS.SPLIT_GEOM_SEGMENT 16-99SDO_LRS.TRANSLATE_MEASURE 16-102SDO_LRS.VALID_GEOM_SEGMENT 16-104SDO_LRS.VALID_LRS_PT 16-106SDO_LRS.VALID_MEASURE 16-108SDO_LRS.VALIDATE_LRS_GEOMETRY 16-110
SDO_MIGRATE.TO_CURRENT 17-2
18 Spatial Tuning Subprograms
SDO_TUNE.AVERAGE_MBR 18-2SDO_TUNE.ESTIMATE_RTREE_INDEX_SIZE 18-4SDO_TUNE.EXTENT_OF 18-7SDO_TUNE.MIX_INFO 18-9SDO_TUNE.QUALITY_DEGRADATION 18-11
19 Spatial Utility Subprograms
SDO_UTIL.APPEND 19-3SDO_UTIL.CIRCLE_POLYGON 19-5SDO_UTIL.CONCAT_LINES 19-7SDO_UTIL.CONVERT_UNIT 19-9SDO_UTIL.ELLIPSE_POLYGON 19-11SDO_UTIL.EXTRACT 19-13SDO_UTIL.GETNUMELEM 19-16SDO_UTIL.GETNUMVERTICES 19-17SDO_UTIL.GETVERTICES 19-18SDO_UTIL.INITIALIZE_INDEXES_FOR_TTS 19-20SDO_UTIL.POINT_AT_BEARING 19-21SDO_UTIL.POLYGONTOLINE 19-23SDO_UTIL.PREPARE_FOR_TTS 19-25
Trang 14SDO_UTIL.REMOVE_DUPLICATE_VERTICES 19-27SDO_UTIL.REVERSE_LINESTRING 19-29SDO_UTIL.SIMPLIFY 19-31SDO_UTIL.TO_GMLGEOMETRY 19-35
20 Geocoding Subprograms
SDO_GCDR.GEOCODE 20-2SDO_GCDR.GEOCODE_ALL 20-4SDO_GCDR.GEOCODE_AS_GEOMETRY 20-6
21 Spatial Analysis and Mining Subprograms
SDO_SAM.AGGREGATES_FOR_GEOMETRY 21-3SDO_SAM.AGGREGATES_FOR_LAYER 21-5SDO_SAM.BIN_GEOMETRY 21-8SDO_SAM.BIN_LAYER 21-10SDO_SAM.COLOCATED_REFERENCE_FEATURES 21-12SDO_SAM.SIMPLIFY_GEOMETRY 21-15SDO_SAM.SIMPLIFY_LAYER 21-17SDO_SAM.SPATIAL_CLUSTERS 21-19SDO_SAM.TILED_AGGREGATES 21-21SDO_SAM.TILED_BINS 21-24
Part III Supplementary Information
A Installation, Compatibility, and Upgrade
A.1 Upgrading LRS Data A-1
B Oracle Locator
C Complex Spatial Queries: Examples
C.1 Tables Used in the Examples C-1
Trang 15C.2 SDO_WITHIN_DISTANCE Examples C-2C.3 SDO_NN Examples C-3C.4 SDO_AGGR_UNION Example C-6
Glossary
Index
Trang 16List of Examples
2–1 Simple Example: Inserting, Indexing, and Querying Spatial Data 2-32–2 SQL Statement to Insert a Rectangle 2-152–3 SQL Statement to Insert a Polygon with a Hole 2-172–4 SQL Statement to Insert a Compound Line String 2-192–5 SQL Statement to Insert a Compound Polygon 2-212–6 SQL Statement to Insert a Point-Only Geometry 2-222–7 Query for Point-Only Geometry Based on a Coordinate Value 2-232–8 SQL Statement to Insert a Geometry with a Type 0 Element 2-253–1 Control File for a Bulk Load of Cola Market Geometries 3-13–2 Control File for a Bulk Load of Polygons 3-33–3 Control File for a Bulk Load of Point-Only Data 3-43–4 Procedure to Perform a Transactional Insert Operation 3-53–5 PL/SQL Block Invoking a Procedure to Insert a Geometry 3-54–1 Primary Filter with a Temporary Query Window 4-114–2 Primary Filter with a Transient Instance of the Query Window 4-124–3 Primary Filter with a Stored Query Window 4-124–4 Secondary Filter Using a Temporary Query Window 4-134–5 Secondary Filter Using a Stored Query Window 4-135–1 Geocoding, Returning Address Object and Specific Attributes 5-86–1 Using a Geodetic MBR 6-46–2 Creating a User-Defined Projected Coordinate System 6-196–3 Creating a User-Defined Geodetic Coordinate System 6-196–4 Simplified Example of Coordinate System Transformation 6-226–5 Output of SELECT Statements in Coordinate System Transformation Example 6-257–1 Including LRS Measure Dimension in Spatial Metadata 7-87–2 Simplified Example: Highway 7-237–3 Simplified Example: Output of SELECT Statements 7-28C–1 Finding All Cities Within a Distance of a Highway C-2C–2 Finding All Highways Within a Distance of a City C-3C–3 Finding the Cities Nearest to a Highway C-4C–4 Finding the Cities Above a Specified Population Nearest to a Highway C-5C–5 Performing Aggregate Union of All Counties in Texas C-6
Trang 17List of Figures
1–1 Geometric Types 1-51–2 Query Model 1-111–3 MBR Enclosing a Geometry 1-131–4 R-Tree Hierarchical Index on MBRs 1-131–5 The Nine-Intersection Model 1-151–6 Topological Relationships 1-171–7 Distance Buffers for Points, Lines, and Polygons 1-171–8 Tolerance in an Aggregate Union Operation 1-202–1 Areas of Interest for the Simple Example 2-22–2 Rectangle 2-152–3 Polygon with a Hole 2-162–4 Compound Line String 2-182–5 Compound Polygon 2-202–6 Point-Only Geometry 2-222–7 Geometry with Type 0 (Zero) Element 2-244–1 Geometries with MBRs 4-104–2 Layer with a Query Window 4-107–1 Geometric Segment 7-37–2 Describing a Point Along a Segment with a Measure and an Offset 7-57–3 Measures, Distances, and Their Mapping Relationship 7-57–4 Measure Populating of a Geometric Segment 7-67–5 Measure Populating with Disproportional Assigned Measures 7-67–6 Linear Feature, Geometric Segments, and LRS Points 7-87–7 Creating a Geometric Segment 7-97–8 Defining a Geometric Segment 7-117–9 Redefining a Geometric Segment 7-127–10 Clipping, Splitting, and Concatenating Geometric Segments 7-137–11 Measure Assignment in Geometric Segment Operations 7-147–12 Segment Direction with Concatenation 7-157–13 Scaling a Geometric Segment 7-167–14 Offsetting a Geometric Segment 7-177–15 Locating a Point Along a Segment with a Measure and an Offset 7-177–16 Ambiguity in Location Referencing with Offsets 7-187–17 Multiple Projection Points 7-197–18 Conversion from Standard to LRS Line String 7-207–19 Segment for Clip Operation Affected by Tolerance 7-217–20 Simplified LRS Example: Highway 7-228–1 Spatial Mining and Oracle Data Mining 8-313–1 Arc Tolerance 13-913–2 SDO_GEOM.SDO_DIFFERENCE 13-22
Trang 1813–3 SDO_GEOM.SDO_INTERSECTION 13-2713–4 SDO_GEOM.SDO_UNION 13-4013–5 SDO_GEOM.SDO_XOR 13-4316–1 Translating a Geometric Segment 16-10319–1 Simplification of a Geometry 19-34
Trang 19List of Tables
2–1 Valid SDO_GTYPE Values 2-72–2 Values and Semantics in SDO_ELEM_INFO 2-122–3 Columns in the xxx_SDO_INDEX_INFO Views 2-292–4 Columns in the xxx_SDO_INDEX_METADATA Views 2-302–5 Columns in an R-Tree Spatial Index Data Table 2-322–6 Columns in the SDO_DIST_UNITS Table 2-332–7 Columns in the SDO_AREA_UNITS Table 2-345–1 Attributes for Formal Address Representation 5-15–2 Match Modes for Geocoding Operations 5-35–3 Match Codes for Geocoding Operations 5-45–4 Geocoded Address Error Message Interpretation 5-55–5 SDO_GEO_ADDR Type Attributes 5-66–1 MDSYS.CS_SRS Table 6-96–2 MDSYS.SDO_ANGLE_UNITS Table 6-126–3 MDSYS.SDO_DATUMS Table 6-136–4 MDSYS.SDO_ELLIPSOIDS Table 6-156–5 MDSYS.SDO_PROJECTIONS Table 6-167–1 Highway Features and LRS Counterparts 7-2210–1 Spatial Index Creation and Usage Statements 10-111–1 SDO_GEOMETRY Type Methods 11-112–1 Main Spatial Operators 12-112–2 Convenience Operators for SDO_RELATE Operations 12-212–3 params Keywords for the SDO_JOIN Operator 12-2112–4 Keywords for the SDO_NN Param Parameter 12-2413–1 Geometry Subprograms 13-114–1 Spatial Aggregate Functions 14-115–1 Subprograms for Coordinate System Transformation 15-115–2 Table to Hold Transformed Layer 15-616–1 Subprograms for Creating and Editing Geometric Segments 16-116–2 Subprograms for Querying and Validating Geometric Segments 16-216–3 Subprograms for Converting Geometric Segments 16-416–4 Functions to Use Instead of SCALE_GEOM_SEGMENT 16-9418–1 Tuning Subprograms 18-119–1 Spatial Utility Subprograms 19-120–1 Subprograms for Geocoding Address Data 20-121–1 Subprograms for Spatial Analysis and Mining 21-1B–1 Spatial Features Supported for Locator B-2B–2 Spatial Features Not Supported for Locator B-3B–3 Feature Availability with Standard and Enterprise Editions B-4
Trang 21Send Us Your Comments
Oracle Spatial User’s Guide and Reference, 10g Release 1 (10.1)
Part No B10826-01
Oracle Corporation welcomes your comments and suggestions on the quality and usefulness of this publication Your input is an important part of the information used for revision
■ Did you find any errors?
■ Is the information clearly presented?
■ Do you need more information? If so, where?
■ Are the examples correct? Do you need more examples?
■ What features did you like most about this manual?
If you find any errors or have any other suggestions for improvement, please indicate the title and part number of the documentation and the chapter, section, and page number (if available) You can send comments to us in the following ways:
■ Electronic mail: nedc-doc_us@oracle.com
■ FAX: 603.897.3825 Attn: Spatial Documentation
■ Postal service:
Oracle Corporation
Oracle Spatial Documentation
One Oracle Drive
Nashua, NH 03062-2804
USA
If you would like a reply, please give your name and contact information
If you have problems with the software, please contact your local Oracle Support Services
Trang 23The Oracle Spatial User’s Guide and Reference provides usage and reference
information for indexing and storing spatial data and for developing spatial
applications using Oracle Spatial and Oracle Locator
Oracle Spatial requires the Enterprise Edition of Oracle Database 10g It is a
foundation for the deployment of enterprise-wide spatial information systems, and Web-based and wireless location-based applications requiring complex spatial data management Oracle Locator is a feature of the Standard and Enterprise Editions of
Oracle Database 10g It offers a subset of Oracle Spatial capabilities (see Appendix Bfor a list of Locator features) typically required to support Internet and wireless service applications and partner-based geographic information system (GIS) solutions
The Standard and Enterprise Editions of Oracle Database 10g have the same basic
features However, several advanced features, such as extended data types, are available only with the Enterprise Edition, and some of these features are optional
For example, to use Oracle Database 10g table partitioning, you must have the
Enterprise Edition and the Partitioning Option
For information about the differences between Oracle Database 10g Standard Edition and Oracle Database 10g Enterprise Edition and the features and options that are available to you, see Oracle Database New Features.
This preface contains these topics:
Note: The relational geometry model of Oracle Spatial is no longer
supported, effective with Oracle release 9.2 Only the
object-relational model is supported
Trang 24Accessibility of Code Examples in Documentation JAWS, a Windows screen reader, may not always correctly read the code examples in this document The conventions for writing code require that closing braces should appear on an otherwise empty line; however, JAWS may not always read a line of text that consists solely of a bracket or brace
Accessibility of Links to External Web Sites in Documentation This documentation may contain links to Web sites of other companies or organizations that Oracle does not own or control Oracle neither evaluates nor makes any representations regarding the accessibility of these Web sites
Trang 25This guide has two main parts (conceptual and usage information, and reference information) and a third part with supplementary information The first part is organized for efficient learning about Oracle Spatial; it covers basic concepts and techniques first, and proceeds to more advanced material (such as coordinate systems, the linear referencing system, geocoding, and extending spatial indexing).This guide has the following elements
Part I, "Conceptual and Usage Information"
Contains chapters with conceptual and usage information
Chapter 1, "Spatial Concepts"
Explains important concepts and techniques that you need to know to use Spatial
Chapter 2, "Spatial Data Types and Metadata"
Explains the data types and metadata for Spatial It includes a complete simplified example of using Spatial, as well as several examples of spatial geometries
Chapter 3, "Loading Spatial Data"
Explains how to load spatial data
Chapter 4, "Indexing and Querying Spatial Data"
Explains how to index and query spatial data
Chapter 5, "Geocoding Address Data"
Provides conceptual and usage information about support for geocoding
Chapter 6, "Coordinate Systems (Spatial Reference Systems)"
Provides conceptual and usage information about coordinate system (spatial reference system) support
Chapter 7, "Linear Referencing System"
Provides conceptual and usage information about the Oracle Spatial linear referencing system (LRS)
Trang 26Chapter 8, "Spatial Analysis and Mining"
Provides conceptual and usage information about the Oracle Spatial analysis and mining features for data mining applications
Chapter 9, "Extending Spatial Indexing Capabilities"
Explains how to extend the capabilities of Oracle Spatial indexing
Part II, "Reference Information"
Contains chapters with reference information
Chapter 10, "SQL Statements for Indexing Spatial Data"
Provides the syntax and semantics for SQL indexing statements
Chapter 11, "SDO_GEOMETRY Object Type Methods"
Provides the syntax and semantics for methods used with the spatial object data type
Chapter 12, "Spatial Operators"
Provides the syntax and semantics for operators used with the spatial object data type
Chapter 13, "Geometry Subprograms"
Provides the syntax and semantics for the geometric functions and procedures
Chapter 14, "Spatial Aggregate Functions"
Provides the syntax and semantics for the spatial aggregate functions
Chapter 15, "Coordinate System Transformation Subprograms"
Provides the syntax and semantics for the coordinate system transformation functions and procedures
Chapter 16, "Linear Referencing Subprograms"
Provides the syntax and semantics for the functions and procedures related to the Oracle Spatial linear referencing system (LRS)
Chapter 17, "SDO_MIGRATE Procedure"
Provides the syntax and semantics for the migration procedure
Trang 27Chapter 18, "Spatial Tuning Subprograms"
Provides the syntax and semantics for the spatial tuning functions and procedures
Chapter 19, "Spatial Utility Subprograms"
Provides the syntax and semantics for the spatial utility functions and procedures
Chapter 20, "Geocoding Subprograms"
Provides the syntax and semantics for the geocoding functions and procedures
Chapter 21, "Spatial Analysis and Mining Subprograms"
Provides the syntax and semantics for the spatial analysis and mining functions and procedures
Part III, "Supplementary Information"
Contains appendixes and a glossary
Appendix A, "Installation, Compatibility, and Upgrade"
Describes installation, compatibility, and upgrade issues
Appendix B, "Oracle Locator"
Describes Oracle Locator
Appendix C, "Complex Spatial Queries: Examples"
Provides examples, with explanations, of queries that are more complex than the examples in the reference chapters
Glossary
Defines important terms
Technologies Released Separately
Technologies of interest to spatial application developers, but not officially part of Oracle Spatial, are sometimes made available through the Oracle Technology Network (OTN) To access the Spatial page on OTN, go to
http://otn.oracle.com/products/spatial/
Trang 28Related Documentation
For more information, see the following documents:
■ Oracle Spatial GeoRaster
■ Oracle Spatial Topology and Network Data Models
■ Oracle Database SQL Reference
■ Oracle Database Administrator's Guide
■ Oracle Database Application Developer's Guide - Fundamentals
■ Oracle Database Error Messages - Spatial messages are in the range of 13000 to
13499
■ Oracle Database Performance Tuning Guide
■ Oracle Database Utilities
■ Oracle Database Advanced Replication
■ Oracle Data Cartridge Developer's Guide
Oracle error message documentation is only available in HTML If you only have access to the Oracle Documentation CD, you can browse the error messages by range Once you find the specific range, use your browser's "find in page" feature to locate the specific message When connected to the Internet, you can search for a specific error message using the error message search feature of the Oracle online documentation
Printed documentation is available for sale in the Oracle Store athttp://oraclestore.oracle.com/
To download free release notes, installation documentation, white papers, or other collateral, go to the Oracle Technology Network (OTN) You must register online before using OTN; registration is free and can be done at
Trang 29Horizontal ellipsis points in statements or commands mean that
parts of the statement or command not directly related to the example have been omitted
boldface text Boldface text indicates a term defined in the text, the glossary, or in
both locations
monospace text Monospace text is used for the names of parameters, files, and
directory paths It is also used for SQL and PL/SQL code examples
italic text Italic text is used for book titles, emphasis, and some special terms
< > Angle brackets enclose user-supplied names
[ ] Brackets enclose optional clauses from which you can choose one or
none
Trang 31New and Changed Features
This section describes new and changed Oracle Spatial features for the current release
GeoRaster
GeoRaster is a feature of Oracle Spatial that lets you store, index, query, analyze, and deliver georaster data, that is, raster image data and its associated Spatial vector geometry data, plus metadata GeoRaster provides Oracle Spatial data types and an object-relational schema for storing multidimensional grid layers and digital images that can be referenced to positions on the Earth's surface or a local
coordinate system
Information about GeoRaster is in a separate manual: Oracle Spatial GeoRaster.
Topology and Network Management
The topology and network management capabilities of Oracle Spatial let you work with data about nodes, edges, and faces in a topology, and nodes and edges in a network For example, United States Census geographic data is provided in terms
of nodes, chains (line strings), and polygons (faces) You can store information about the topological elements and feature layers in Oracle Spatial tables and metadata views, and then you can perform certain Spatial operations referencing the topological elements, for example, finding which chains (such as streets) have any spatial interaction with a specific polygon entity (such as a park)
Information about topology and network management is in a separate manual:
Oracle Spatial Topology and Network Data Models.
Trang 32Spatial Analysis and Mining
You can use new spatial analysis and mining subprograms in Oracle Data Mining (ODM) applications See Chapter 8 for conceptual and usage information, and Chapter 21 for reference information about each subprogram
Geocoding
The geocoding capabilities of Oracle Spatial let you geocode unformatted addresses See Chapter 5 for conceptual and usage information, and Chapter 20 for reference information about each subprogram
Quadtree Indexing Discouraged; R-Tree Indexing Encouraged
The use of spatial quadtree indexes is discouraged You are strongly encouraged to use R-tree indexing for spatial indexes, unless you need to continue using quadtree indexes for special situations Significant performance improvements have been made to spatial R-tree indexing for this release
Almost all information about quadtree indexing has been removed from this guide
and placed in a separate guide, Oracle Spatial Quadtree Indexing, which is available
only through the Oracle Technology Network
For information about spatial indexing, see Section 1.7 and Chapter 4
New Utility Subprograms
The SDO_UTIL package contains the following new subprograms:
■ SDO_UTIL.APPEND appends one geometry to another geometry to create a new geometry
■ SDO_UTIL.CONCAT_LINES concatenates two line or multiline two-dimensional geometries to create a new geometry
■ SDO_UTIL.CONVERT_UNIT converts values from one angle, area, or distance unit of measure to another
■ SDO_UTIL.CIRCLE_POLYGON returns the polygon geometry that approximates and is covered by a specified circle
■ SDO_UTIL.ELLIPSE_POLYGON returns the polygon geometry that approximates and is covered by a specified ellipse
Trang 33■ SDO_UTIL.INITIALIZE_INDEXES_FOR_TTS initializes all spatial indexes in a tablespace that was transported to another database.
■ SDO_UTIL.POINT_AT_BEARING returns a point geometry that is at the specified distance and bearing from the start point
■ SDO_UTIL.POLYGONTOLINE converts all polygon-type elements in a geometry to line-type elements, and sets the SDO_GTYPE value accordingly
■ SDO_UTIL.PREPARE_FOR_TTS prepares a tablespace to be transported to another database, so that spatial indexes will be preserved during the transport operation
■ SDO_UTIL.REMOVE_DUPLICATE_VERTICES removes duplicate (redundant) vertices from a geometry
■ SDO_UTIL.REVERSE_LINESTRING returns a line string geometry with the vertices of the input geometry in reverse order
■ SDO_UTIL.SIMPLIFY simplifies the input geometry, based on a threshold value, using the Douglas-Peucker algorithm
■ SDO_UTIL.TO_GMLGEOMETRY converts a Spatial geometry object to a geography markup language (GML 2.0) fragment based on the geometry types defined in the Open GIS geometry.xsd schema document
See Chapter 19 for reference information about the utility subprograms
New Operators
SDO_JOIN performs a spatial join based on one or more topological relations (SDO_JOIN is technically not an operator, but a table function; however, it is presented in the chapter with Spatial operators because its usage is similar to that of the operators, and because it is not part of a package with other functions and procedures.)
The following new operators are convenient alternatives to using SDO_RELATEwith a specified mask value: SDO_ANYINTERACT, SDO_CONTAINS, SDO_COVEREDBY, SDO_COVERS, SDO_EQUAL, SDO_INSIDE, SDO_ON, SDO_OVERLAPBDYDISJOINT, SDO_OVERLAPBDYINTERSECT, SDO_OVERLAPS(OVERLAPBDYDISJOINT or OVERLAPBDYINTERSECT), and SDO_TOUCH.See Chapter 12 for reference information about these operators
Trang 34SDO_NN Operator Behavior Changes
If you do not specify the param parameter with the SDO_NN operator, the operator returns all rows in increasing distance order from geometry2
In the param parameter, you can specify sdo_batch_size=0, which causes Spatial to calculate a batch size that is suitable for the result set size; however, there are performance considerations, as explained in the Usage Notes for the SDO_NNoperator in Chapter 12 (This feature worked in the previous release, but was not documented.)
New Spatial Aggregate Function
SDO_AGGR_CONCAT_LINES returns a geometry that concatenates the specified line or multiline geometries
See Chapter 14 for reference information about spatial aggregate functions
New Coordinate Systems Function: VALIDATE_WKT
The new SDO_CS.VALIDATE_WKT function validates the well-known text (WKT) description associated with a specified SRID
See Chapter 6 for conceptual and usage information about coordinate systems, and Chapter 15 for reference information about coordinate system transformation subprograms
MBRs Supported with Geodetic Data
Minimum bounding rectangles (MBRs) can now be geodetic or non-geodetic In previous releases, MBRs needed to be non-geodetic
The following functions, which were not supported with geodetic data in the previous release, are now supported for use with geodetic data:
■ SDO_GEOM.SDO_MBR, SDO_GEOM.SDO_MIN_MBR_ORDINATE, and SDO_GEOM.SDO_MAX_MBR_ORDINATE (described in Chapter 13)
■ SDO_AGGR_MBR (described in Chapter 14)Because geodetic MBRs are easier to use than the previous technique using the SDO_CS.VIEWPORT_TRANSFORM function (described in Chapter 15), that function is deprecated, and it will not be supported in future releases of Spatial
Trang 35New and Changed LRS Subprograms
The new SDO_LRS.FIND_OFFSET function returns the signed offset (shortest distance) between a point and a geometric segment
The SDO_LRS.PROJECT_PT function includes a new optional output parameter offset, which stores the signed offset of the projected point from the geometric segment
See Chapter 16 for reference information about linear referencing system (LRS) subprograms
Tolerance with LRS Subprograms
In the current version of this guide, tolerance is shown as a required parameter for many LRS subprograms where it had previously been shown as optional Applications that used tolerance as an optional parameter in such cases will continue to work in this release; however, such usage is deprecated and will not be supported in future releases If you use an LRS subprogram format in which tolerance is shown as required, you should specify that parameter
See also Section 7.6, which contains new information about tolerance values with LRS subprograms
New Tuning Function: ESTIMATE_RTREE_INDEX_SIZE
The new SDO_TUNE.ESTIMATE_RTREE_INDEX_SIZE function, described in Chapter 18, estimates the maximum number of megabytes needed for an R-tree spatial index table
Deprecated Tuning Subprograms
The following SDO_TUNE subprograms specific to spatial quadtree indexing are deprecated:
Trang 36Information about these subprograms has been removed from this guide and placed
in a separate guide, Oracle Spatial Quadtree Indexing, which is available only through
the Oracle Technology Network
New GML Support Function: TO_GMLGEOMETRY
The new SDO_UTIL.TO_GMLGEOMETRY function, described in Chapter 19, converts a Spatial geometry object to a geography markup language (GML 2.0) fragment based on the geometry types defined in the Open GIS geometry.xsd schema document
Interior Buffers
You can create a buffer inside a polygon by specifying a negative value for the distance (dist) parameter with the SDO_GEOM.SDO_BUFFER function, which is described in Chapter 13
Tablespace for Temporary Tables During Index Creation
You can specify the tablespace for temporary tables used in to create a spatial R-tree index by using the new work_tablespace parameter in the CREATE INDEXstatement, which is described in Chapter 10
Separate Index Table for Nonleaf Nodes
You can create a separate index table (with a name in the form MDNT_ $) for nonleaf nodes of a spatial index by specifying 'sdo_non_leaf_tbl=TRUE' in the CREATE INDEX statement, which is described in Chapter 10 Specifying this parameter can help query performance with large data sets, and it can help overall performance for large databases where buffer pool resources are limited
MDSYS No Longer Needed with Spatial Data Types
Public synonyms have been created for all Spatial data types; therefore, you no longer need to specify MDSYS with the data type For example, you can declare a geometry object as type SDO_GEOMETRY instead of MDSYS.SDO_GEOMETRY.However, you still need to specify MDSYS for the Spatial index type (CREATE INDEX INDEXTYPE IS MDSYS.SPATIAL_INDEX) and for Spatial tables (such as the MDSYS.SDO_DIST_UNITS table)
Trang 37DBA_SDO_xxx Views No Longer Provided
The DBA_SDO_GEOM_METADATA, DBA_SDO_INDEX_INFO, and DBA_SDO_INDEX_METADATA views are no longer provided You can instead use the ALL_SDO_GEOM_METADATA, ALL_SDO_INDEX_INFO, and ALL_SDO_INDEX_METADATA views, respectively These views are described in Section 2.4 and Section 2.5.1
Java Client Interface
Several Java interfaces provide access to many Spatial data types and features Section 1.11 lists the interfaces, describes the sdoapi interface, and explains how to find detailed reference information in Javadoc-generated API documentation
Transportable Tablespace Support
Before Oracle Database 10g Release 1 (10.1), the Oracle transportable tablespace
feature could not be used with tablespaces that contained any spatial indexes
Effective with Oracle Database 10g Release 1 (10.1), you can transport tablespaces
that contain spatial indexes However, you must call the new SDO_
UTIL.PREPARE_FOR_TTS procedure just before you perform the export operation, and you must call it for each user that has data in the specified tablespace; and you must also call the new SDO_UTIL.INITIALIZE_INDEXES_FOR_TTS procedure just after you perform the import operation Both procedures are described in
Chapter 19
Trang 38New Schema: MDDATA
The new MDDATA schema is recommended for storing data used by geocoding and routing applications This is the default schema for Oracle software that accesses geocoding and routing data The MDDATA schema is described in Section 1.13
Complex Query Examples
A new appendix (Appendix C) provides examples, with explanations, of queries that are more complex than the examples in the reference chapters in Part II,
"Reference Information" This appendix focuses on operators that are frequently used in Spatial applications, such as SDO_WITHIN_DISTANCE and SDO_NN This appendix is based on input from Oracle personnel who provide support and training to Spatial users
Trang 39Part I
Conceptual and Usage Information
This document has three parts:
■ Part I provides conceptual and usage information about Oracle Spatial
■ Part II provides reference information about Oracle Spatial methods, operators, functions, and procedures
■ Part III provides supplementary information (appendixes and a glossary).Part I is organized for efficient learning about Oracle Spatial It covers basic
concepts and techniques first, and proceeds to more advanced material (such as coordinate systems, the linear referencing system, geocoding, and extending spatial indexing) Part I contains the following chapters:
■ Chapter 1, "Spatial Concepts"
■ Chapter 2, "Spatial Data Types and Metadata"
■ Chapter 3, "Loading Spatial Data"
■ Chapter 4, "Indexing and Querying Spatial Data"
■ Chapter 5, "Geocoding Address Data"
■ Chapter 6, "Coordinate Systems (Spatial Reference Systems)"
■ Chapter 7, "Linear Referencing System"
■ Chapter 8, "Spatial Analysis and Mining"
■ Chapter 9, "Extending Spatial Indexing Capabilities"