Home
Oracle Spatial User's Guide and Reference
Contents
1. BEGINDATA 1 200 1 122 4215 37 7862 2 200 1 122 4019 37 8052 3 200 1 122 426 37 803 1 122 4171 37 8034 1 122 416151 37 8027228 3 2 Transactional Insert Operations Using SQL Oracle Spatial uses standard Oracle tables that can be accessed or loaded with standard SQL syntax This section contains examples of transactional inserts into columns of type SDO_GEOMETRY Note that the INSERT statement in Oracle SOL has a limit of 999 arguments Therefore you cannot create a variable length array of more than 999 elements using the SDO_GEOMETRY constructor inside a transactional INSERT statement however you can insert a geometry using a host 3 4 Oracle Spatial User s Guide and Reference Transactional Insert Operations Using SQL variable and the host variable can be built using the SDO_GEOMETRY constructor with more than 999 values in the SDO_ORDINATE_ARRAY specification The host variable is an OCI PL SQL or Java program variable To perform transactional insertions of geometries you can create a procedure to insert a geometry and then invoke that procedure on each geometry to be inserted Example 3 4 creates a procedure to perform the insert operation Example 3 4 Procedure to Perform a Transactional Insert Operation CREATE OR REPLACE PROCEDURE INSERT _GEOM GEOM SDO GEOMETRY IS BEGIN INSERT INTO TEST _1 VALUES GEOM COMMIT END Using the procedure created in Example 3
2. TRUE MKT ID NAME 12 12 Oracle Spatial User s Guide and Reference SDO_FILTER SDO_FILTER Format SDO_FILTER geometry1 geometry2 Description Uses the spatial index to identify either the set of spatial objects that are likely to interact spatially with a given object such as an area of interest or pairs of spatial objects that are likely to interact spatially Objects interact spatially if they are not disjoint This operator performs only a primary filter operation The secondary filtering operation performed by the SDO_RELATE operator can be used to determine with certainty if objects interact spatially Keywords and Parameters Value Description geometry1 Specifies a geometry column in a table The column must be spatially indexed Data type is SDO_GEOMETRY geometry2 Specifies either a geometry from a table or a transient instance of a geometry Specified using a bind variable or SDO_GEOMETRY constructor Data type is SDO_GEOMETRY Returns The expression SDO_FILTER geometry1 geometry2 TRUE evaluates to TRUE for object pairs that are non disjoint and FALSE otherwise Usage Notes SDO_FILTER is the only operator that can be used with data that is indexed using more than two dimensions The operator considers all dimensions specified in the spatial index The operator must always be used in a WHERE clause and the condition that includes the operator should be an expression of the
3. The tolerance value in the SDOAGGRTYPE definition should be the same as the SDO_TOLERANCE value specified in the DIMINFO column in the xxx_SDO_ GEOM_METADATA views for the geometries unless you have a specific reason for wanting a different value For more information about tolerance see Section 1 5 5 for information about the xxx_SDO_GEOM_METADATA views see Section 2 4 The tolerance value in the SDOAGGRTYPE definition can affect the result of a spatial aggregate function Figure 1 8 shows a spatial aggregate union SDO_ AGGR_UNION operation of two geometries using two different tolerance values one smaller and one larger than the distance between the geometries Figure 1 8 Tolerance in an Aggregate Union Operation SDO_AGGR_ UNION T tolerance SDO_AGGR_ UNION geom1 geom2 me A tolerance In the first aggregate union operation in Figure 1 8 where the tolerance is less than the distance between the rectangles the result is a compound geometry consisting of two rectangles In the second aggregate union operation where the tolerance is greater than the distance between the rectangles the result is a single geometry 1 11 Spatial Java Interface This section describes the sdoapi Java client interface for general Spatial operations In addition to the sdoapi interface Spatial provides other specialized interfaces which are documented in other manuals 1 20 Oracle Spatial Users Guide and Reference Geocoding
4. In this example a The type 0 element has an SDO_ETYPE value of 0 a The nonzero element rectangle has an SDO_ETYPE value of 1003 indicating an exterior polygon ring 2 24 Oracle Spatial Users Guide and Reference Geometry Metadata Views The nonzero element has an SDO_STARTING_OFFSET value of 11 because ordinate x6 is the eleventh ordinate in the geometry The type 0 element has an SDO_INTERPRETATION value whose significance is application specific In this example the SDO_INTERPRETATION value is 57 The nonzero element has an SDO_INTERPRETATION value that is valid for the SDO_ETYPE of 1003 In this example the SDO_INTERPRETATION value is 3 indicating a rectangle defined by two points lower left and upper right Example 2 8 shows a SQL statement that inserts the geometry with a type 0 element similar to the geometry illustrated in Figure 2 7 into the database In the SDO_ ORDINATE_ARRAY structure the curve is defined by points 6 6 12 6 9 8 6 10 and 12 10 and the rectangle is defined by points 6 4 and 12 12 Example 2 8 SQL Statement to Insert a Geometry with a Type 0 Element INSERT INTO cola_markets VALUES E 13 type zero element geom SDO_GEOMETRY 2003 two dimensional polygon NULL NULL SDO ELEM INFO ARRAY 1 0 57 11 1003 3 1st is type 0 element SDO ORDINATE ARRAY 6 6 12 6 9 8 6 10 12 10 6 4 12 12 2 4 Geometry Metadata Views The geometry me
5. DATUM lt name gt lt spheroid gt lt shift x gt lt shift y gt lt shift z gt lt rot x gt lt rot y gt lt rot z gt lt scale adjust gt lt spheroid gt SPHEROID lt name gt lt semi major axis gt lt inverse flattening gt lt prime meridian gt PRIMEM lt name gt lt longitude gt lt longitude gt lt number gt lt semi major axis gt lt number gt lt inverse flattening gt lt number gt lt angular unit gt lt unit gt 6 10 Oracle Spatial User s Guide and Reference Coordinate Systems Data Structures lt linear unit gt lt unit gt lt unit gt UNIT lt name gt lt conversion factor gt lt local cs gt LOCAL CS lt name gt lt local datum gt lt linear unit gt lt axis gt lt axis gt lt local datum gt LOCAL DATUM lt name gt lt datum type gt lt shift x gt lt shift y gt lt shift z gt lt vot x gt lt rot y gt lt rot z gt lt scale adjust gt lt datum type gt lt number gt lt axis gt AXIS lt name gt NORTH SOUTH EAST WEST UP DOWN OTHER The prime meridian PRIMEM must be specified in decimal degrees of longitude An example of the WKT for a geodetic geographic coordinate system is GEOGCS Longitude Latitude Old Hawaiian DATUM Old Hawaiian SPHEROID Clarke 1866 6378206 400000 294 978698 PRIMEM
6. Related Topics SDO_LRS REVERSE_GEOMETRY in Chapter 16 19 30 Oracle Spatial User s Guide and Reference SDO_UTIL SIMPLIFY SDO_UTIL SIMPLIFY Format Description Parameters Usage Notes SDO_UTIL SIMPLIFY geometry IN SDO_GEOMETRY threshold IN NUMBER RETURN SDO_GEOMETRY Simplifies the input geometry based on a threshold value using the Douglas Peucker algorithm geometry Geometry to be simplified threshold Threshold value to be used for the geometry simplification Should be a positive number Zero causes the input geometry to be returned If the input geometry is geodetic the value is the number of meters if the input geometry is non geodetic the value is the number of units associated with the data As the threshold value is decreased the returned geometry is likely to be closer to the input geometry as the threshold value is increased fewer points are likely to be in the returned geometry See the Usage Notes for more information This function is useful when you want a geometry with less fine resolution than the original geometry For example if the display resolution cannot show the hundreds or thousands of turns in the course of a river or in a political boundary better performance might result if the geometry were simplified to show only the major turns If you use this function with geometries that have more than two dimensions only the first two dimensions are used in processin
7. If measure or point identifies the end point of the geometric segment a null value is returned An exception is raised if measure is not a valid value for geom_segment or if point is not a valid LRS point Contrast this function with SDO_LRS GET_PREV_SHAPE_PT which returns the previous shape point on a geometric segment after a specified measure value or LRS point The _3D format of this function SDO_LRS GET_NEXT_SHAPE_PT_3D is available For information about _3D formats of LRS functions see Section 7 4 The following example returns the next shape point after measure 14 on the geometric segment representing Route 1 This example uses the definitions from the example in Section 7 7 SELECT SDO_LRS GET NEXT SHAPE PT a route geometry 14 FROM lrs_ routes a WHERE a route_id 1 SDO_LRS GET NEXT SHAPE PT A ROUTE GEOMETRY 14 SDO_GTYPE SDO SRID SDO POINT X SDO GEOMETRY 3301 NULL NULL SDO ELEM INFO ARRAY 1 1 1 SDO ORDINATE ARRAY 12 10 18 Linear Referencing Subprograms 16 51 SDO_LRS GET_NEXT_SHAPE_PT_MEASURE SDO_LRS GET_NEXT_SHAPE_PT_MEASURE Format SDO_LRS GET_NEXT_SHAPE_PT_MEASURE geom_segment IN SDO_GEOMETRY measure IN NUMBER RETURN NUMBER or SDO_LRS GET_NEXT_SHAPE_PT_MEASURE geom_segment IN SDO_GEOMETRY dim_array IN SDO_DIM_ARRAY measure IN NUMBER RETURN NUMBER or SDO_LRS GET_NEXT_SHAPE_PT_MEASURE geom_segment IN SDO_GEOMETRY point IN SDO_GEOMETRY
8. RETURN NUMBER or SDO_LRS GET_NEXT_SHAPE_PT_MEASURE geom_segment IN SDO_GEOMETRY dim_array IN SDO_DIM_ARRAY point IN SDO_GEOMETRY RETURN NUMBER Description Returns the measure value of the next shape point on a geometric segment after a specified measure value or LRS point 16 52 Oracle Spatial User s Guide and Reference SDO_LRS GET_NEXT_SHAPE_PT_MEASURE Parameters Usage Notes Examples geom_segment Geometric segment measure Measure value on the geometric segment for which to return the measure value of the next shape point point Point for which to return the measure value of the next shape point If point is not on geom_segment the point on the geometric segment closest to the specified point is computed and the measure value of the next shape point after that point is returned dim_array Dimensional information array corresponding to geom_segment usually selected from one of the xxx_SDO_GEOM_METADATA views described in Section 2 4 If measure or point identifies the end point of the geometric segment a null value is returned An exception is raised if measure is not a valid value for geom_segment or if point is not a valid LRS point Contrast this function with SDO_LRS GET_PREV_SHAPE_PT_MEASURE which returns the measure value of the previous shape point on a geometric segment before a specified measure value or LRS point The _3D format of this function GSDO_LRS GET_NEXT_SHA
9. Specifying PARALLEL for creating or rebuilding an index on tables with simple geometries such as point data usually results in less performance improvement than on tables with complex geometries Other options available for regular indexes such as ASC and DESC are not applicable for spatial indexes Spatial index creation involves creating and inserting index data for each row in the underlying table column being spatially indexed into a table with a prescribed format All rows in the underlying table are processed before the insertion of index data is committed and this requires adequate rollback segment space If a tablespace name is provided in the parameters clause the user underlying table owner must have appropriate privileges for that tablespace For more information about using the layer_gtype keyword to constrain data in a layer to a geometry type see Section 4 1 4 The geodetic FALSE parameter is not recommended because much of the Oracle Spatial geodetic support will be disabled This parameter should only be used if you cannot yet reindex the data For more information about geodetic and non geodetic indexes see Section 4 1 2 Moreover if you specify geodetic FALSE ensure that the tolerance value stored in the USER_SDO_GEOM_METADATA view is what would be used for SQL Statements for Indexing Spatial Data 10 13 CREATE INDEX Examples Related Topics Cartesian data That is do not use meters for
10. 19 Spatial Utility Subprograms SDO UTILAPPEN D a Ea EE a vas tein a EEE E EEEREN ETE EEEa AETS 19 3 SDO UTIE CIRCLE POLYGON eara ind Ada E A S 19 5 SDO UTIL CONCAT FINES Ariasen iaooe res a aetra aeaaea sedaatio ini 19 7 SDO UTIL CONVERT UNIT eeel i oiire ts E T E E E 19 9 SDO UTIE ELETPSE POLYGON 2 ont A et ii 19 11 SDOUTIL EXTRA Crit a RA AEE e aE aE Saee 19 13 SDO_ UTIL GETNUMEEEM coco ccccteccseecsctsdieselsvosdestacedsoescascntes ss iban adici n 19 16 SDO UTIE GETNUMVERTICES ea e vete e e a diese Micssenascesseceaveveteivaetues 19 17 SDO UTIE GETVERTICES 0 a ood Eea aee Eeee a SE 19 18 SDO_UTIL INTTIALIZE_INDEXES_FOR_TTS oooonconcnonccnonnconcnnononnnnnnancnncnocancnnonoroninnonos 19 20 SDO UTIE POINT AT BEARIN Gomis Added 19 21 SDO UTIL POLYGONTOE N Eoee ate dia ninia dad 19 23 SDO_UTIL PREPARE POR TTS vised icra eens E ia dba 19 25 xiii SDO_UTIL REMOVE_DUPLICATE_VERTICES oconcnoninnnnninconicnnnonininnoncnncnacancnnonncnnoo 19 27 SDO_UTIL REVERSE_LINESTRING cccsscssssssseseesesssesessesesesecsesesstcnsevessesnseseeseveees 19 29 SDO UTIESIMPLTE aia A aia iaa 19 31 SDO_UTIL TO GMLGEOMETRY cooccococisercrinci condal ici 19 35 20 Geocoding Subprograms SDO GEDR GEOCODE vomita caia OE ATE T EEE AEE a iaa aaa 20 2 SDO GEDR GEOCODE AL saint detenida iniciado iia 20 4 SDO_GCDR GEOCODE_AS_GEOMETRY arrian a OAA EKE E EN REA 20 6 21 Spatial Analysis and Mining Subprograms SDO_SAM AGGREGATES_FOR_GEOM
11. CONTINUEIF NEXT 1 1 INTO TABLE COLA MARKETS FIELDS TERMINATED BY mye TRAILING NULLCOLS mkt_id INTEGER EXTERNAL name CHAR shape COLUMN OBJECT SDO_GTYPE INTEGER EXTERNAL SDO_ELEM INFO VARRAY TERMINATED BY E elements FLOAT EXTERNAL SDO_ORDINATES VARRAY TERMINATED BY MPA ordinates FLOAT EXTERNAL begindata 1 cola_a 2003 1 1003 3 1 1 5 7 2 cola_b 2003 1 1003 1 ts 1lej1JeJ6 5 7 5 1 3 cola_c 2003 1 1003 1 3 3 6 3 6 5 4 5 3 3 4 cola d 2003 1 1003 4 te 7 10 9 8e 11 Notes on Example 3 1 a The EXTERNAL keyword in the definition mkt_id INTEGER EXTERNAL means that each value to be inserted into the MKT_ID column 1 2 3 and 4 in this example is an integer in human readable form not binary format a Inthe data after begindata each MKT_ID value is preceded by one space because the CONTINUEIF NEXT 1 1 specification causes the first position of each data line to be ignored unless it is the number sign continuation character Example 3 2 assumes that a table named POLY_4PT was created as follows CREATE TABLE POLY 4PT GID VARCHAR2 32 GEOMETRY SDO GEOMETRY 3 2 Oracle Spatial User s Guide and Reference Bulk Loading Assume that the ASCII data consists of a file with delimited columns and separate rows fixed by the limits of the table with the following format geometry rows GID GEOMETRY The coordinates in the GEOM
12. Checks if an LRS segment is defined correctly geom_segment Geometric segment to be checked dim_array Dimensional information array corresponding to geom_segment usually selected from one of the xxx_SDO_GEOM_METADATA views described in Section 2 4 This function returns TRUE if geom_segment is defined correctly and FALSE if geom_segment is not defined correctly The start and end measures of geom_segment must be defined cannot be null and any measures assigned must be in an ascending or descending order along the segment direction The _3D format of this function SDO_LRS IS_GEOM_SEGMENT_DEFINED_3D is available For information about _3D formats of LRS functions see Section 7 4 See also the SDO_LRS VALID_GEOM_SEGMENT function The following example checks if the geometric segment representing Route 1 is defined This example uses the definitions from the example in Section 7 7 SELECT SDO LRS IS GEOM SEGMENT DEFINED route geometry Linear Referencing Subprograms 16 61 SDO_LRS IS_GEOM_SEGMENT_DEFINED FROM lrs_ routes WHERE route id 1 SDO_LRS IS GEOM SEGMENT DEFINED ROUTE GEOMETRY 16 62 Oracle Spatial User s Guide and Reference SDO_LRS IS_MEASURE_DECREASING SDO_LRS IS_MEASURE_DECREASING Format Description Parameters Usage Notes Examples SDO_LRS IS_MEASURE_DECREASING geom_segment IN SDO_GEOMETRY dim_array IN SDO_DIM_ARRAY RETURN VARCHAR2 Checks if the mea
13. Examples The following example finds geometries that have the OVERLAPBDYINTERSECT relationship with a query window here a rectangle with lower left upper right coordinates 4 6 8 8 The example uses the definitions and data described in Section 2 1 and illustrated in Figure 2 1 In this example cola_a cola_b and cola_d have the OVERLAPBDYINTERSECT relationship with the query window geometry SELECT c mkt_id c name FROM cola_markets c WHERE SDO_OVERLAPBDYINTERSECT c shape SDO GEOMETRY 2003 NULL NULL SDO_ ELEM INFO ARRAY 1 1003 3 SDO ORDINATE ARRAY 4 6 8 8 TRUE MKT ID NAME 2 cola_b 1 cola a 4 cola d 12 36 Oracle Spatial User s Guide and Reference SDO_OVERLAPS SDO_OVERLAPS Format Description SDO_OVERLAPS geometry1 geometry2 Checks if any geometries in a table overlap that is have the OVERLAPBDYDISJOINT or OVERLAPBDYINTERSECT topological relationship with a specified geometry Equivalent to specifying the SDO_RELATE operator with mask OVERLAPBDYDISJOINT OVERLAPBDYINTERSECT See the section on the SDO_RELATE operator in this chapter for information about the operations performed by this operator and for usage requirements Keywords and Parameters Returns Usage Notes Value Description geometry1 Specifies a geometry column in a table The column must be spatially indexed Data type is SDO_GEOMETRY geometry2 Specifies either a geometry from a table or a transie
14. Format Description Parameters Usage Notes SDO_AGGR_MBR geom SDO_GEOMETRY RETURN SDO_GEOMETRY Returns the minimum bounding rectangle MBR of the specified geometries that is a single rectangle that minimally encloses the geometries geom Geometry objects Use this function instead of the deprecated SDO_TUNE EXTENT_OF function to return the MBR of geometries The SDO_TUNE EXTENT_OF function is limited to two dimensional geometries whereas this function is not All input geometries must have 4 digit SDO_GTYPE values explained in Section 2 2 1 This function does not return an MBR geometry if a proper MBR cannot be constructed Specifically Ifthe input geometries are all null the function returns a null geometry If all data in the input geometries is on a single point the function returns the point If all data in the input geometries consists of points on a straight line the function returns a two point line Spatial Aggregate Functions 14 9 SDO_AGGR_MBR Examples The following example returns the minimum bounding rectangle of the geometry objects in the COLA_MARKETS table The example uses the definitions and data from Section 2 1 SELECT SDO_AGGR_MBR shape FROM cola_markets SDO_AGGR_MBR C SHAPE SDO_GTYPE SDO SRID SDO POINT X Y Z SDO ELEM INFO SD SDO GEOMETRY 2003 NULL NULL SDO ELEM INFO ARRAY 1 1003 3 SDO ORDINATE ARR AY 1 1 10 11 14 10 Oracle Spatial Us
15. Index 3 complex queries C 1 coordinate systems 6 21 creating indexing and querying spatial data 2 1 directory for Spatial examples 1 23 linear referencing system LRS 7 21 OCI Oracle Call Interface 1 23 PL SQL 1 24 SQL 1 24 exchanging partitions including indexes 4 7 Export utility with spatial indexes and data 4 8 EXTENT_OF function 18 7 exterior polygon rings 2 10 2 16 2 17 EXTRACT function 19 13 F features linear 7 7 FILTER SDO_FILTER operator 12 13 FILTER mask value for SDO_JOIN 12 21 FIND_LRS_DIM_POS function 16 33 FIND_MEASURE function 16 34 FIND_OFFSET function 16 36 formatted addresses 5 1 FROM_815_TO_81X procedure use TO_CURRENT instead 17 1 function based indexes privilege and session requirements 9 4 with SDO_GEOMETRY objects 9 3 functions spatial aggregate 14 1 supported by approximations with geodetic data 6 21 G GEOCODE function 20 2 GEOCODE_ALL function 20 4 GEOCODE_AS_GEOMETRY function 20 6 geocoding 1 21 concepts 5 1 data requirements 5 9 Index 4 data types for 5 6 error messages 5 5 match codes 5 4 match modes 5 3 subprogram reference information 20 1 usage information 5 1 geodetic coordinates 1 7 6 2 arcs and circles not supported 6 6 functions not supported 6 21 functions supported by approximations 6 21 support for 6 3 geodetic datum 1 7 6 2 geodetic index 4 3 geodetic MBRs 6 4 geographic coordinates See geodetic
16. Oracle Spatial User s Guide and Reference Introduction to Spatial Data The benefits provided by the object relational model include Support for many geometry types including arcs circles compound polygons compound line strings and optimized rectangles a Ease of use in creating and maintaining indexes and in performing spatial queries a Index maintenance by the Oracle database Geometries modeled in a single row and single column Optimal performance 1 3 Introduction to Spatial Data Oracle Spatial is designed to make spatial data management easier and more natural to users of location enabled applications and geographic information system GIS applications Once spatial data is stored in an Oracle database it can be easily manipulated retrieved and related to all other data stored in the database A common example of spatial data can be seen in a road map A road map is a two dimensional object that contains points lines and polygons that can represent cities roads and political boundaries such as states or provinces A road map is a visualization of geographic information The location of cities roads and political boundaries that exist on the surface of the Earth are projected onto a two dimensional display or piece of paper preserving the relative positions and relative distances of the rendered objects The data that indicates the Earth location such as longitude and latitude of these rendered obje
17. SDO GEOMETRY 2003 8199 NULL SDO ELEM INFO ARRAY 1 1003 1 SDO ORDINATE ARR AY 5 00069354 1 00274488 8 00062191 1 00274427 8 00062522 6 00315345 5 000 6986 7 00323528 5 00069354 1 00274488 SDO_ROWID Coordinate Systems Spatial Reference Systems 6 27 Example of Coordinate System Transformation AAABZZAABAAAOab6AAC SDO GEOMETRY 2003 8199 NULL SDO ELEM INFO ARRAY 1 1003 1 SDO ORDINATE ARR AY 3 00074114 3 00291482 6 00067068 3 00291287 6 0006723 5 00307625 4 0007 1961 5 00307838 3 00074114 3 00291482 AAABZZAABAAAOab6AAD SDO GEOMETRY 2003 8199 NULL SDO ELEM INFO ARRAY 1 1003 1 SDO ORDINATE ARR AY 10 0005802 9 00337775 11 0005553 9 00337621 11 0005569 10 0034478 10 00 SDO_ROWID 05819 10 0034495 10 0005802 9 00337775 SQL gt SQL gt Show metadata for the new layer transformed table SQL gt DESCRIBE cola markets cs 8199 Name Null Type SDO_ROWID ROWID GEOMETRY SDO_GEOMETRY SQL gt SQL gt Use a geodetic MBR with SDO FILTER SQL gt SELECT c name FROM cola_markets_cs c WHERE 2 SDO_ FILTER c shape 3 SDO_GEOMETRY 4 2003 5 8307 SRID for WGS 84 longitude latitude 6 NULL 7 SDO_ ELEM INFO ARRAY 1 1003 3 8 SDO_ORDINATE ARRAY 6 5 10 10 9 TRUE NAME cola c cola b cola d 6 28 Oracle Spatial Users Guide and Reference T Linear Referencing System Linear referencing is a natural and convenient means to associate attributes
18. SDO_ORDINATE ARR SDO_ORDINATE ARR SDO_ORDINATE ARR SDO_ORDINATE ARR SDO_ORDINATE ARR Spatial Analysis and Mining Subprograms 21 23 SDO_SAM TILED_BINS SDO_SAM TILED_BINS Format Description Parameters SDO_SAM TILED_BINS 1 IN NUMBER ul IN NUMBER 12 IN NUMBER u2 IN NUMBER tiling_level IN NUMBER srid IN NUMBER DEFAULT NULL RETURN SDO_REGIONSET Tiles a two dimensional space and returns geometries corresponding to those tiles 11 Lower bound of the extent in the first dimension ul Upper bound of the extent in the first dimension 12 Lower bound of the extent in the second dimension u2 Upper bound of the extent in the second dimension tiling_level Level to be used to tile the specified extent srid SRID value to be included for the coordinate system in the returned tile geometries 21 24 Oracle Spatial Users Guide and Reference SDO_SAM TILED_BINS Usage Notes Examples This function returns an object of type SDO_REGIONSET The SDO_REGIONSET object type is defined as TABLE OF SDO_REGION The SDO_REGION object type is defined as Name Null Type ID NUMBER GEOMETRY MDSYS SDO_ GEOMETRY The following example tiles the entire Earth s surface at the first tiling level using the standard longitude and latitude coordinate system SRID 8307 The resulting SDO_REGIONSET object contains four SDO_REGION objects one for each tile SELECT FROM TABLE sdo_sam tiled_bi
19. SDO_ORDINATE ARRAY 2 4 4 3 10 3 13 5 13 9 11 13 5 13 2 11 2 4 7 5 7 10 10 10 10 5 7 5 i 1 row created Extract the hole geometry second subelement SELECT SDO UTIL EXTRACT c shape 1 2 FROM cola_markets c WHERE c name polygon_with_hole SDO_UTIL EXTRACT C SHAPE 1 2 SDO_GTYPE SDO SRID SDO POINT X Y Z SDO ELEM_ SDO GEOMETRY 2003 NULL NULL SDO ELEM INFO ARRAY 1 1003 1 SDO ORDINATE ARR AY 7 5 YO 5 10 10 7 10 7 5 a SDO_UTIL GETVERTICES a SDO_GEOM VALIDATE_GEOMETRY_WITH_CONTEXT a SDO_GEOM VALIDATE_LAYER_WITH_CONTEXT Spatial Utility Subprograms 19 15 SDO_UTIL GETNUMELEM SDO_UTIL GETNUMELEM Format Description Parameters Usage Notes Examples Related Topics SDO_UTIL GETNUMELEM geometry INSDO_GEOMETRY RETURN NUMBER Returns the number of elements in the input geometry geometry Geometry for which to return the number of elements None The following example returns the number of elements for each geometry in the SHAPE column of the COLA_MARKETS table The example uses the definitions and data from Section 2 1 SELECT c name SDO UTIL GETNUMELEM c shape FROM cola_markets c NAME SDO_UTIL GETNUMELEM C SHAPE a SDO_UTIL GETNUMVERTICES 19 16 Oracle Spatial User s Guide and Reference SDO_UTIL GETNUMVERTICES SDO_UTIL GETNUMVERTICES Format SDO_UTIL GETNUMVERTICES geometry INSDO_GEOMETRY RETURN NUMBER Description
20. SDO_ORDINATES 2 4 4 3 10 3 13 5 13 9 11 13 5 13 2 11 2 4 7 5 7 10 10 10 10 5 7 5 The area SDO_GEOM SDO_AREA function of the polygon is the area of the exterior polygon minus the area of the interior polygon In this example the area is 84 99 15 The perimeter SDO_GEOM SDO_LENGTH function of the polygon is the perimeter of the exterior polygon plus the perimeter of the interior polygon In this example the perimeter is 52 9193065 36 9193065 16 Example 2 3 shows a SQL statement that inserts the geometry illustrated in Figure 2 3 into the database Example 2 3 SQL Statement to Insert a Polygon with a Hole INSERT INTO cola_markets VALUES 10 polygon with hole SDO_GEOMETRY 2003 two dimensional polygon NULL NULL SDO ELEM INFO ARRAY 1 1003 1 19 2003 1 polygon with hole SDO ORDINATE ARRAY 2 4 4 3 10 3 13 5 13 9 11 13 5 13 2 11 2 4 7 5 7 10 10 10 10 5 7 5 i An example of such a polygon with a hole might be a land mass such as a country or an island with a lake inside it Of course an actual land mass might have many such interior polygons each one would require a triplet element in SDO_ELEM_INFO plus the necessary ordinate specification Exterior and interior rings cannot be nested For example if a country has a lake and there is an island in the lake and perhaps a lake on the island a separate polygon must be defined for the island the island cann
21. geom2 Geometry object 13 26 Oracle Spatial User s Guide and Reference SDO_GEOM SDO_INTERSECTION Usage Notes Examples dim2 Dimensional information array corresponding to geom2 usually selected from one of the xxx_SDO_GEOM_METADATA views described in Section 2 4 tol Tolerance value see Section 1 5 5 In Figure 13 3 the shaded area represents the polygon returned when SDO_ INTERSECTION is used with a square geom1 and another polygon geom2 Figure 13 3 SDO_GEOM SDO_INTERSECTION eom1 g geom2 If the function format with tol is used all geometry objects must be defined using 4 digit SDO_GTYPE values explained in Section 2 2 1 An exception is raised if geom1 and geom2 are based on different coordinate systems The following example returns a geometry object that is the topological intersection AND operation of cola_aand cola_c The example uses the definitions and data from Section 2 1 Return the topological intersection of two geometries SELECT SDO GEOM SDO INTERSECTION c_a shape c_c shape 0 005 FROM cola_markets c_a cola markets c_c WHERE c_a name cola_ a AND c_c name cola_c SDO_GEOM SDO_ INTERSECTION C_A SHAPE C_C SHAPE 0 005 SDO_GTYPE SDO SRID SDO PO Geometry Subprograms 13 27 SDO_GEOM SDO_INTERSECTION SDO GEOMETRY 2003 NULL NULL SDO ELEM INFO ARRAY 1 1003 1 SDO ORDINATE ARR AY 5p 35 3 5y 3 5 5 4 05 Note that in the returned polygon the
22. geometry is a column of type SDO_GEOMETRY in a table This column must be spatially indexed aGeom is an instance of type SDO_GEOMETRY params is a quoted string of keyword value pairs that determines the behavior of the operator See the SDO_WITHIN_DISTANCE operator in Chapter 12 for a list of parameters The following example selects any objects within 1 35 distance units from the query window SELECT A Feature_ID FROM TARGET A WHERE SDO WITHIN DISTANCE A shape theWindow distance 1 35 TRUE The distance units are based on the geometry coordinate system in use The distance units are those specified in the UNIT field of the well known text WKT associated with the coordinate system in the WKTEXT column of the MDSYS CS_SRS table as explained in Section 6 4 1 1 If you are using a geodetic coordinate system the units are meters If no coordinate system is used the units are the same as for the stored data The SDO_WITHIN_DISTANCE operator is not suitable for performing spatial joins That is a query such as Find all parks that are within 10 distance units from coastlines will not be processed as an index based spatial join of the COASTLINES and PARKS tables Instead it will be processed as a nested loop query in which each COASTLINES instance is in turn a reference object that is buffered indexed and 4 14 Oracle Spatial Users Guide and Reference Querying Spatial Data evaluated against the PARKS table Th
23. Greenwich 0 000000 UNIT Decimal Degree 0 01745329251994330 The WKT definition of the coordinate system is hierarchically nested The Old Hawaiian geographic coordinate system GEOGCS is composed of a named datum DATUM a prime meridian PRIMEM and a unit definition UNIT The datum is in turn composed of a named spheroid and its parameters of semi major axis and inverse flattening An example of the WKT for a projected coordinate system a Wyoming State Plane is PROJCS Wyoming 4901 Eastern Zone 1983 meters GEOGCS GRS 80 DATUM GRS 80 SPHEROID GRS 80 6378137 000000 298 257222 PRIMEM Greenwich 0 000000 UNIT Decimal Degree 0 01745329251994330 PROJECTION Transverse Mercator PARAMETER Scale Factor 0 999938 PARAMETER Central Meridian 105 166667 PARAMETER Latitude Of Origin 40 500000 PARAMETER False Easting 200000 000000 UNIT Meter Coordinate Systems Spatial Reference Systems 6 11 Coordinate Systems Data Structures 1 000000000000 The projected coordinate system contains a nested geographic coordinate system as its basis as well as parameters that control the projection Oracle Spatial supports all common geodetic datums and map projections An example of the WKT for a local coordinate system is LOCAL CS Non Earth Meter LOCAL DATUM Local Datum 0 UNIT Meter 1 0 AXIS X EAST AXIS Y NORTH For more information abo
24. ROUTE GEOMETRY TRUE THEN DBMS _OUTPUT PUT_LINE Conversion from LRS LAYER to STD LAYER succeeded ELSE DBMS _OUTPUT PUT LINE Conversion from LRS LAYER to STD LAYER failed END IF END Conversion from LRS LAYER to STD_ LAYER succeeded PL SQL procedure successfully completed SELECT diminfo FROM user _sdo_geom metadata WHERE table name LRS ROUTES AND column name ROUTE GEOMETRY DIMINFO SDO DIMNAME SDO LB SDO UB SDO TOLERANCE SDO DIM ARRAY SDO DIM ELEMENT X 0 20 005 SDO DIM ELEMENT Y 0 20 00 5 Linear Referencing Subprograms 16 27 SDO_LRS DEFINE_GEOM_SEGMENT SDO_LRS DEFINE_GEOM_SEGMENT Format Description Parameters SDO_LRS DEFINE_GEOM_SEGMENT geom_segment IN OUT SDO_GEOMETRY start_measure IN NUMBER end_measure IN NUMBER or SDO_LRS DEFINE_GEOM_SEGMENT geom_segment IN OUT SDO_GEOMETRY dim_array IN SDO_DIM_ARRAY start_measure IN NUMBER end_measure IN NUMBER Defines a geometric segment by assigning start and end measures to a geometric segment and assigns values to any null measures geom_segment Cartographic representation of a linear feature dim_array Dimensional information array corresponding to geom_segment usually selected from one of the xxx_SDO_GEOM_METADATA views described in Section 2 4 start_measure Distance measured from the start point of a geometric segment to the start point of the linear feature The default
25. SDO ELEM INFO ARRAY 1 1003 1 one polygon exterior polygon ring SDO ORDINATE ARRAY 3 3 6 3 6 5 4 5 3 3 Insert a rectangle here square instead of a circle as in the original because arcs are not supported with geodetic coordinate systems INSERT INTO cola_markets_cs VALUES 4 cola d SDO_GEOMETRY 2003 two dimensional polygon Coordinate Systems Spatial Reference Systems 6 23 Example of Coordinate System Transformation 8307 SRID for Longitude Latitude WGS 84 coordinate system NULL SDO ELEM INFO ARRAY 1 1003 1 polygon SDO ORDINATE ARRAY 10 9 11 9 11 10 10 10 10 9 All vertices must be defined for rectangle with geodetic data Update the USER_SDO GEOM METADATA view This is required before the Spatial index can be created Do this only once for each layer table column combination here cola markets cs and shape INSERT INTO USER _SDO_GEOM METADATA VALUES cola_markets _cs shape SDO DIM ARRAY SDO DIM ELEMENT Longitude 180 180 10 10 meters tolerance SDO_DIM ELEMENT Latitude 90 90 10 10 meters tolerance 8307 SRID for Longitude Latitude WGS 84 coordinate system CREATE INDEX cola_spatial_idx_cs ON cola_markets cs shape INDEXTYPE IS MDSYS SPATIAL INDEX Return the transformation of cola_c using to_srid 8199 Longitude Latitude Arc 1950 SELECT c name SDO CS TRANSFORM c shape m dimi
26. SDO ELEM INFO ARRAY 1 1003 3 one rectangle 1003 exterior SDO ORDINATE ARRAY 1 1 5 7 only 2 points needed to define rectangle lower left and upper right Update the USER_SDO_GEOM_METADATA view using dot notation to specify the column name and spatial attribute The following example specifies MARKET SHAPE as the COLUMN_NAME explained in Section 2 4 2 in the metadata view INSERT INTO USER SDO GEOM METADATA VALUES cola_markets 2 market shape SDO_DIM_ ARRAY 20X20 grid 9 2 Oracle Spatial User s Guide and Reference SDO_GEOMETRY Objects in Function Based Indexes SDO DIM ELEMENT X 0 20 0 005 SDO DIM ELEMENT Y 0 20 0 005 NULL SRID E Create the spatial index specifying the column name and spatial attribute using dot notation For example CREATE INDEX cola_spatial_idx 2 ON cola_markets 2 market shape INDEXTYPE IS MDSYS SPATIAL INDEX Perform queries on the data using dot notation to refer to attributes of the user defined type The following simple query returns information associated with the cola market named cola_a SELECT c mkt_id c market name c market shape FROM cola_markets_2 c WHERE c market name cola a The following query returns information associated with all geometries that have any spatial interaction with a specified query window namely the rectangle with lower left coordinates 4 6 and upper right coordinates 8 8 SELECT
27. See Section 2 6 for more information about unit of measurement specification 21 6 Oracle Spatial User s Guide and Reference SDO_SAM AGGREGATES_FOR_LAYER Examples The following example computes the thematic aggregates for all geometries in a table named TEST_TAB for an area with a 3 mile radius around a specified point geometry In this case the total population of each area is computed based on the proportion of the circle s area within different counties assuming uniform distribution of population within the counties SELECT a aggregate_ value FROM TABLE sdo sam aggregates for layer GEOD COUNTIES GEOM SUM TOTPOP TEST _TAB GEOM distance 3 unit mile a Spatial Analysis and Mining Subprograms 21 7 SDO_SAM BIN_GEOMETRY SDO_SAM BIN_GEOMETRY Format SDO_SAM BIN_GEOMETRY geom IN SDO_GEOMETRY tol IN SDO_DIM_ARRAY bin_tablename IN VARCHAR2 bin_colname IN VARCHAR2 RETURN NUMBER or SDO_SAM BIN_GEOMETRY geom IN SDO_GEOMETRY dim IN SDO_DIM_ARRAY bin_tablename IN VARCHAR2 bin_colname IN VARCHAR2 RETURN NUMBER Description Computes the most intersecting tile for a geometry Parameters geom Geometry for which to compute the bin tol Tolerance value see Section 1 5 5 dim Dimensional array for the table that holds the bin geometries bin_tablename Name of the table that holds the bin geometries 21 8 Oracle Spatial User s Guide and Reference SDO_SAM BIN_GEOMET
28. Some geometry functions and the SDO_AGGR_MBR spatial aggregate function Integration with Oracle Application Server 10g Wireless Oracle Locator B 1 For information about spatial concepts the SDO_GEOMETRY object type and indexing and loading spatial data see Chapters 1 through 4 in this guide For reference and usage information about features supported by Locator see the chapter or section listed in Table B 1 Table B 1 Spatial Features Supported for Locator Spatial Feature Described in Function based spatial indexing Section 9 2 Table partitioning support for spatial indexes including Section 4 1 6 and splitting merging and exchanging partitions and their Section 4 1 7 indexes Geodetic data support Section 6 2 and Section 6 4 SQL statements for creating altering and deleting indexes Chapter 10 except deferred updates to spatial indexes as noted in Table B 2 Parallel spatial index builds PARALLEL keyword with ALTER Chapter 10 INDEX REBUILD and CREATE INDEX statements new with release 9 2 SDO_GEOMETRY object type methods Chapter 11 Spatial operators Chapter 12 Implicit coordinate system transformations for operator calls Chapter 12 where a window needs to be converted to the coordinate system of the queried layer The following SDO_GEOM package functions and procedures Chapter 13 SDO_GEOM SDO_DISTANCE SDO_GEOM VALIDATE_GEOMETRY_WITH_CONTEXT SDO_GEOM VALIDATE_LAYER_WITH_CONTEXT SDO_GEOM VALIDATE_GEOMET
29. a SDO_ELEM_INFO 1 4 2 1 2 1 3 2 2 There are three triplet elements 1 4 2 1 2 1 and 3 2 2 The first triplet indicates that this element is a compound line string made up of two subelement line strings which are described with the next two triplets The second triplet indicates that the line string is made up of straight line segments and that the ordinates for this line string start at offset 1 The end point of this line string is determined by the starting offset of the second line string 3 in this instance The third triplet indicates that the second line string is made up of circular arcs with ordinates starting at offset 3 The end point of this line string is determined by the starting offset of the next element or the current length of the SDO_ ORDINATES array if this is the last element a SDO_ORDINATES 10 10 10 14 6 10 14 10 Example 2 4 shows a SQL statement that inserts the geometry illustrated in Figure 2 4 into the database Example 2 4 SQL Statement to Insert a Compound Line String INSERT INTO cola_markets VALUES Ll compound line string SDO_GEOMETRY 2002 NULL NULL SDO_ELEM_ INFO ARRAY 1 4 2 1 2 1 3 2 2 compound line string SDO ORDINATE ARRAY 10 10 10 14 6 10 14 10 J 2 3 4 Compound Polygon Figure 2 5 illustrates an ice cream cone shaped object represented as a compound polygon made up of one straight line segment and one circular arc Five points are Spatial Data T
30. and ALL_SDO_INDEX_ METADATA views respectively These views are described in Section 2 4 and Section 2 5 1 SDO_ MIGRATE Procedures The following SDO_MIGRATE package procedures are no longer documented in Chapter 17 a SDO_MIGRATE TO_734 a SDO_MIGRATE TO_81X a SDO_MIGRATE FROM_815_TO_81X You should use the SDO_MIGRATE TO_CURRENT procedure if you need to upgrade data to the current Spatial release 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 XXXVii New Schema MDDATA The new MDDATA schema is recommended for storing data used by geocoding and routing applic
31. column_name IN VARCHAR2 dim_name IN VARCHAR2 dim_pos IN INTEGER lower_bound IN NUMBER upper_bound IN NUMBER tolerance IN NUMBER RETURN VARCHAR2 Converts all geometry objects in a column of type SDO_GEOMETRY that is converts a layer from standard line string geometries without measure information to LRS geometric segments with measure information and updates the metadata in the USER_SDO_GEOM_METADATA view Linear Referencing Subprograms 16 19 SDO_LRS CONVERT_TO_LRS_LAYER Parameters Usage Notes table_name Table containing the column with the SDO_GEOMETRY objects column_name Column in table_name containing the SDO_GEOMETRY objects dim_name Name of the measure dimension If this parameter is null Mis assumed dim_pos Position of the measure dimension within the SDO_DIM_ARRAY structure for the specified SDO_GEOMETRY column If this parameter is null the number corresponding to the last position is assumed lower_bound Lower bound SDO_LB value in the SDO_DIM_ELEMENT definition of the ordinate in the measure dimension upper_bound Upper bound SDO_UB value in the SDO_DIM_ELEMENT definition of the ordinate in the measure dimension tolerance Tolerance value see Section 1 5 5 and Section 7 6 This function returns TRUE if the conversion was successful or if the layer already contains measure information and the function returns an exception if the conversion was not successful An exception
32. dim_array Update and insert geometries into table to display later UPDATE lrs routes a SET a route geometry geom segment WHERE a route_id 1 INSERT INTO lrs_ routes VALUES Lily result_geom_1 result_geom_1 i INSERT INTO lrs_ routes VALUES 12 result_geom_2 result_geom_2 i INSERT INTO lrs_ routes VALUES 1 35 result_geom 3 result_geom_3 E END First display the data in the LRS table SELECT route_id route_name route_geometry FROM lrs_routes Are result_geom_1 and result_geom2 connected SELECT SDO LRS CONNECTED GEOM SEGMENTS a route geometry b route geometry 0 005 FROM lrs_ routes a lrs routes b WHERE a route_id 11 AND b route_id 12 Linear Referencing System 7 25 Example of LRS Functions Is the Routel segment valid SELECT SDO LRS VALID GEOM SEGMENT route geometry FROM lrs_ routes WHERE route_id 1 Is 50 a valid measure on Routel Should return FALSE highest Routel measure is 27 SELECT SDO LRS VALID MEASURE route geometry 50 FROM lrs_routes WHERE route_id 1 Is the Routel segment defined SELECT SDO LRS IS GEOM SEGMENT DEFINED route geometry FROM lrs_routes WHERE route_id 1 How long is Routel SELECT SDO LRS GEOM SEGMENT LENGTH route geometry FROM lrs_ routes WHERE route_id 1 What is the start measure of Routel SELECT SDO LRS GEOM SEGMENT START MEASURE route geometry FROM lrs_ routes WHERE
33. geodetic projected and local coordinates and coordinate system transformation see Chapter 6 1 5 5 Tolerance Tolerance is used to associate a level of precision with spatial data Tolerance reflects the distance that two points can be apart and still be considered the same for example to accommodate rounding errors The tolerance value must be a positive number greater than zero The significance of the value depends on whether or not the spatial data is associated with a geodetic coordinate system Geodetic and other types of coordinate systems are described in Section 1 5 4 a For geodetic data such as data identified by longitude and latitude coordinates the tolerance value is a number of meters For example a tolerance value of 100 indicates a tolerance of 100 meters The tolerance value for geodetic data should not be smaller than 0 001 1 millimeter and in most cases it should be larger Spatial uses 0 001 as the tolerance value for geodetic data if you specify a smaller value For non geodetic data the tolerance value is a number of the units that are associated with the coordinate system associated with the data For example if the unit of measurement is miles a tolerance value of 0 005 indicates a tolerance of 0 005 that is 1 200 mile approximately 26 feet and a tolerance value of 2 indicates a tolerance of 2 miles In both cases the smaller the tolerance value the more precision is to be associated with th
34. nearest neighbor geometries In the WHERE clause of this example a i highway refers to the HIGHWAY column of the INTERSTATES table and 1170 is a value from the HIGHWAY column a c location specifies the search column geomet ry1 the LOCATION column of the GEOD_CITIES table i geom specifies the query window geomet ry2 the spatial geometry in the GEOM column of the GEOD_INTERSTATES table in the row whose HIGHWAY column contains the value 1170 sdo_num_res 5 specifies how many nearest neighbor geometries to find unit mile specifies the unit of measurement to associate with distances returned by the SDO_NN_DISTANCE ancillary operator a l1 insdo nn distance 1 and sdo num_res 5 unit mile 1 is the number parameter value that associates the call to SDO_NN to the call to SDO_NN_DISTANCE In Example C 3 ORDER BY distance in miles orders the results from the WHERE clause by distance in miles C 4 Oracle Spatial User s Guide and Reference SDO_NN Examples The statement in Example C 3 produces the following output slightly reformatted for readability CITY DISTANCE IN MILES St Louis 5 36297295 Springfield 78 7997464 Peoria 141 478022 Evansville 158 22422 Springfield 188 508631 Example C 4 extends Example C 3 by limiting the results to cities with a 1990 population over a certain number It finds the five cities nearest to the interstate highway 1170 that have a population greater than 300 000 the 1990 p
35. or an entire layer of geometries that is all geometries in a specified column ina table To use the subprograms in this chapter you must understand the conceptual information about coordinate systems in Section 1 5 4 and Chapter 6 Table 15 1 lists the coordinate system transformation subprograms Table 15 1 Subprograms for Coordinate System Transformation Subprogram Description SDO_CS TRANSFORM Transforms a geometry representation using a coordinate system specified by SRID or name SDO_CS TRANSFORM_LAYER Transforms an entire layer of geometries that is all geometries in a specified column in a table SDO_CS VALIDATE_WKT Validates the well known text WKT description associated with a specified SRID SDO_CS VIEWPORT_TRANSFORM Transforms an optimized rectangle into a valid deprecated polygon for use with Spatial operators and functions The rest of this chapter provides reference information on the subprograms listed in alphabetical order Coordinate System Transformation Subprograms 15 1 SDO_CS TRANSFORM SDO_CS TRANSFORM Format SDO_CS TRANSFORM geom IN SDO_GEOMETRY to_srid IN NUMBER RETURN SDO_GEOMETRY or SDO_CS TRANSFORM geom IN SDO_GEOMETRY dim IN SDO_DIM_ARRAY to_srid IN NUMBER RETURN SDO_GEOMETRY or SDO_CS TRANSFORM geom IN SDO_GEOMETRY to_srname IN VARCHAR2 RETURN SDO_GEOMETRY or SDO_CS TRANSFORM geom IN SDO_GEOMETRY dim IN SDO_DIM_ARRAY to_srname IN VARCHAR
36. see Oracle Database Administrator s Guide The system parameter SORT_AREA_SIZE affects the amount of time required to create the index The SORT_AREA_ SIZE value is the maximum amount in bytes of memory to use for a sort operation The optimal value depends on the database size but a good guideline is to make it at least 1 million bytes when you create an R tree index To change the SORT_AREA_ SIZE value use the ALTER SESSION statement For example to change the value to 20 million bytes ALTER SESSION SET SORT_AREA SIZE 20000000 The tablespace specified with the tablespace keyword in the CREATE INDEX statement or the default tablespace if the tablespace keyword is not specified is used to hold both the index data table and some transient tables that are created for internal computations a The R tree index data table requires approximately 70 n bytes where n is the number of rows in the table 4 2 Oracle Spatial User s Guide and Reference Creating a Spatial Index The transient tables require up to approximately 200 n bytes where n is the number of rows in the table however this space is freed up after the R tree index is created For large tables over 1 million rows a temporary tablespace may be needed to perform internal sorting operations The recommended size for this temporary tablespace is 100 n bytes where n is the number of rows in the table 4 1 2 Indexing Geodetic Data To take full advantage of Sp
37. see Section 5 1 4 MatchCode NUMBER Match code see Section 5 1 3 MatchMode VARCHAR2 30 Match mode see Section 5 1 2 Longitude NUMBER Longitude coordinate value Latitude NUMBER Latitude coordinate value Geocoding Address Data 5 7 Data Types for Geocoding You can return the entire SDO_GEO_ADDR object or you can specify an attribute using standard dot notation Example 5 1 contains statements that geocode the address of the San Francisco City Hall the first statement returns the entire SDO_ GEO_ADDR object and the remaining statements return some specific attributes Example 5 1 Geocoding Returning Address Object and Specific Attributes SELECT SDO_GCDR GEOCODE SCOTT SDO_KEYWORDARRAY 1 Carlton B Goodlett Pl San Francisco CA 94102 US RELAX BASE NAME FROM DUAL SDO_GCDR GEOCODE CJMURRAY SDO_KEYWORDARRAY 1CARLTONBGOODLETTPL SANFRANCISCO SDO_ GEO ADDR 0 SDO KEYWORDARRAY NULL CARLTON B GOODLETT PL NULL NULL SAN FRANCISCO NULL CA US 94102 NULL 94102 NULL 1 CARLTON B GOODLETT PL F F NULL NULL L 01 23614360 nul ENUT B281CP 1 DEFAULT 122 41815 37 7784183 SELECT SDO_GCDR GEOCODE SCOTT SDO_KEYWORDARRAY 1 Carlton B Goodlett Pl San Francisco CA 94102 US RELAX BASE NAME StreetType FROM DUAL SDO_GCDR GEOCODE SCOTT SDO_KEYWORDARRAY 1CARLTONBGOODLETTPL SANFRANCISCO SELECT SDO_GCDR GEOCODE SCO
38. table name column name width height DBMS OUTPUT PUT LINE Width width DBMS_OUTPUT PUT_LINE Height height END Width 3 5 Height 4 5 SDO_AGGR_MBR spatial aggregate function Spatial Tuning Subprograms 18 3 SDO_TUNE ESTIMATE_RTREE_INDEX_SIZE SDO_TUNE ESTIMATE_RTREE_INDEX_SIZE Format Description Parameters SDO_TUNE ESTIMATE_RTREE_INDEX_SIZE schemaname IN VARCHAR2 tabname IN VARCHAR2 colname IN VARCHAR2 partname IN VARCHAR2 DEFAULT NULL RETURN NUMBER SDO_TUNE ESTIMATE_RTREE_INDEX_SIZE number_of_geoms IN INTEGER db_block_size IN INTEGER sdo_rtr_pctfree IN INTEGER DEFAULT 10 num_dimensions IN INTEGER DEFAULT 2 is_geodetic IN INTEGER DEFAULT 0 RETURN NUMBER Estimates the maximum number of megabytes needed for an R tree spatial index table schemaname Schema that owns the spatial geometry table tabname Spatial geometry table name colname Geometry column name 18 4 Oracle Spatial Users Guide and Reference SDO_TUNE ESTIMATE_RTREE_INDEX_SIZE Usage Notes partname Name of a partition containing geometries from colname If you specify this parameter the value returned by the function is the estimated size for an R tree index table on geometries in that partition If you do not specify this parameter the value is the estimated size for an R tree index table on all geometries in colname number_of_geoms Approximate number of geometries in the s
39. the end measure of geom_segment is the start measure of the returned geometric segment and all other measures are adjusted accordingly a Does not affect the direction of geom_segment Compare this function with SDO_LRS REVERSE_GEOMETRY which reverses both the direction and the measure values of a geometric segment An exception is raised if geom_segment has an invalid geometry type or dimensionality Linear Referencing Subprograms 16 91 SDO_LRS REVERSE_MEASURE Examples The _3D format of this function SDO_LRS REVERSE_MEASURE_3D is available For information about _3D formats of LRS functions see Section 7 4 Note The behavior of the SDO_LRS REVERSE_MEASURE function changed between release 8 1 7 and the current release In release 8 1 7 REVERSE_MEASURE reversed both the measures and the segment direction However if you want to have this same behavior with the current release you must use the SDO_ LRS REVERSE_GEOMETRY function The following example reverses the measure values of the geometric segment representing Route 1 but does not affect the direction This example uses the definitions from the example in Section 7 7 First display the original segment then reverse SELECT a route_geometry FROM lrs routes a WHERE a route_id 1 ROUTE GEOMETRY SDO_GTYPE SDO SRID SDO POINT X Y Z SDO ELEM INFO SDO ORDIN SDO GEOMETRY 3302 NULL NULL SDO ELEM INFO ARRAY 1 2 1 SDO ORDINATE ARRAY
40. the use of those keywords is discouraged and is not supported for new uses of the operator The following example selects the geometries that are likely to interact with a query window here a rectangle with lower left upper right coordinates 4 6 8 8 The example uses the definitions and data from Section 2 1 SELECT c mkt_id c name FROM cola_markets c WHERE SDO FILTER c shape SDO GEOMETRY 2003 NULL NULL SDO_ ELEM INFO ARRAY 1 1003 3 SDO_ORDINATE ARRAY 4 6 8 8 TRUE MKT ID NAME 2 cola b 12 14 Oracle Spatial User s Guide and Reference SDO_FILTER 1 cola a 4 cola d The following example selects the GID values from the POLYGONS table where the GEOMETRY column objects are likely to interact spatially with the GEOMETRY column object in the QUERY_POLYS table that has a GID value of 1 SELECT A gid FROM Polygons A query polys B WHERE B gid 1 AND SDO_FILTER A Geometry B Geometry TRUE The following example selects the GID values from the POLYGONS table where the GEOMETRY column object is likely to interact spatially with the geometry stored in the aGeom variable Select A Gid FROM Polygons A WHERE SDO_FILTER A Geometry aGeom TRUE The following example selects the GID values from the POLYGONS table where the GEOMETRY column object is likely to interact spatially with the specified rectangle having the lower left coordinates x1 y1 and the upper right coordinates x2 y2 Select
41. 1 SDO_LRS IS SHAPE PT MEASURE A ROUTE GEOMETRY 14 16 68 Oracle Spatial User s Guide and Reference SDO_LRS LOCATE_PT SDO_LRS LOCATE_PT Format Description Parameters SDO_LRS LOCATE_PT geom_segment IN SDO_GEOMETRY measure IN NUMBER offset IN NUMBER RETURN SDO_GEOMETRY or SDO_LRS LOCATE_PT geom_segment IN SDO_GEOMETRY dim_array IN SDO_DIM_ARRAY measure IN NUMBER offset IN NUMBER RETURN SDO_GEOMETRY Returns the point located at a specified distance from the start of a geometric segment geom_segment Geometric segment to be checked to see if it falls within the measure range of measure dim_array Dimensional information array corresponding to geom_segment usually selected from one of the xxx_SDO_GEOM_METADATA views described in Section 2 4 measure Distance to measure from the start point of geom_segment Linear Referencing Subprograms 16 69 SDO_LRS LOCATE_PT Usage Notes Examples offset Distance to measure perpendicularly from the point that is located at measure units from the start point of geom_segment The default is 0 that is the point is on geom_segment This function returns the referenced point For example on a highway the point might represent the location of an accident The unit of measurement for of f set is the same as for the coordinate system associated with geom_segment For geodetic data the default unit of measurement is meters W
42. 1 5 7 TRUE FROM cola_markets c MKT ID NAME 2 cola b Spatial Operators 12 45 SDO_WITHIN_DISTANCE SDO_WITHIN_DISTANCE Format SDO_WITHIN_DISTANCE geometry1 aGeom params Description Uses the spatial index to identify the set of spatial objects that are within some specified distance of a given object such as an area of interest or point of interest Keywords and Parameters Value Description geometryl Specifies a geometry column in a table The column has the set of geometry objects that will be operated on to determine if they are within the specified distance of the given object aGeom The column must be spatially indexed Data type is SDO_GEOMETRY aGeom Specifies the object to be checked for distance against the geometry objects in geomet ry1 Specify either a geometry from a table using a bind variable or a transient instance of a geometry using the SDO_ GEOMETRY constructor Data type is SDO_GEOMETRY params A quoted string containing one or more keywords with values that determine the behavior of the operator The remaining items distance querytype and unit are potential keywords for the params parameter Data type is VARCHAR2 distance Specifies the distance value If a coordinate system is associated with the geometry the distance unit is assumed to be the unit associated with the coordinate system This is a required keyword Data type is NUMBER querytype Set querytype
43. 1 2 the primary filter operation on a large input data set produces a smaller candidate set which contains at least the exact result set and may contain more records The secondary filter operation on the smaller candidate set produces the exact result set Spatial uses a spatial index to implement the primary filter Spatial does not require the use of both the primary and secondary filters In some cases just using the primary filter is sufficient For example a zoom feature in a mapping application queries for data that has any interaction with a rectangle representing visible boundaries The primary filter very quickly returns a superset of the query The mapping application can then apply clipping routines to display the target area The purpose of the primary filter is to quickly create a subset of the data and reduce the processing burden on the secondary filter The primary filter therefore should be as efficient that is selective yet fast as possible This is determined by the characteristics of the spatial index on the data For more information about querying spatial data see Section 4 2 Spatial Concepts 1 11 Indexing of Spatial Data 1 7 Indexing of Spatial Data The introduction of spatial indexing capabilities into the Oracle database engine is a key feature of the Spatial product A spatial index like any other index provides a mechanism to limit searches but in this case the mechanism is based on spatial crite
44. 1 23 Import utility with spatial indexes and data 4 8 index creation 4 1 cross schema 4 5 parallel execution 10 12 deferred updating 10 2 description of Spatial indexing 1 12 geodetic and non geodetic 4 3 partitioned 4 5 exchanging partitions including indexes 4 7 quadtree deprecated feature of Spatial 1 12 rebuilding 10 6 parallel execution 10 3 10 7 R tree description 1 12 requirements before creating 4 2 size R tree 18 4 synchronizing deferred updates 10 2 index organized table cannot create spatial index on 10 12 INITIALIZE_INDEXES_FOR_TTS procedure 19 20 inserting spatial data PL SQL 3 4 INSIDE SDO_INSIDE operator 12 17 topological relationship 1 16 installation A 1 INTEPRETATION SDO_INTERPRETATION value 2 11 interaction ANYINTERACT 1 16 interior of anarea 1 14 interior polygon rings 2 10 2 16 2 17 intersection 13 26 inverse flattening 6 15 IS_GEOM_SEGMENT_DEFINED function 16 61 IS_MEASURE_DECREASING function 16 63 IS_MEASURE_INCREASING function 16 65 IS_SHAPE_PT_MEASURE function 16 67 J Java client interface for Spatial sdoapi 1 20 JGeometry class Spatial Java interface 1 21 join SDO_JOIN operator 12 19 L layer 1 6 transforming 15 5 validating 13 50 validating with context 13 53 Index 5 layer_gtype constraining data toa geometry type 4 4 length SDO_LENGTH function 13 29 line converting polygon to 19 23 data 1 6 length 13 29 lin
45. 1 R Tree Indexing A spatial R tree index can index spatial data of up to four dimensions An R tree index approximates each geometry by a single rectangle that minimally encloses the geometry called the minimum bounding rectangle or MBR as shown in Figure 1 3 1 12 Oracle Spatial Users Guide and Reference Indexing of Spatial Data Figure 1 3 MBR Enclosing a Geometry MBR Geometry For a layer of geometries an R tree index consists of a hierarchical index on the MBRs of the geometries in the layer as shown in Figure 14 Figure 1 4 R Tree Hierarchical Index on MBRs R tree In Figure 1 4 1 through 9 are geometries in a layer a a b c andd are the leaf nodes of the R tree index and contain minimum bounding rectangles of geometries along with pointers to the geometries For example a contains the MBR of geometries 1 and 2 b contains the MBR of geometries 3 and 4 and so on a A contains the MBR of a and b and B contains the MBR of c and d a The root contains the MBR of A and B that is the entire area shown An R tree index is stored in the spatial index table SDO_INDEX_TABLE in the USER_SDO_INDEX_METADATA view described in Section 2 5 The R tree index also maintains a sequence object SDO_RTREE_SEQ_NAME in the USER_SDO_ INDEX_METADATA view to ensure that simultaneous updates by concurrent users can be made to the index Spatial Concepts 1 13 Spatial Relationships and Filtering 1 7 2 R Tree Qua
46. 16 56 Oracle Spatial User s Guide and Reference SDO_LRS GET_PREV_SHAPE_PT 12 12 Linear Referencing Subprograms 16 57 SDO_LRS GET_PREV_SHAPE_PT_MEASURE SDO_LRS GET_PREV_SHAPE_PT_MEASURE Format SDO_LRS GET_PREV_SHAPE_PT_MEASURE geom_segment IN SDO_GEOMETRY measure IN NUMBER RETURN NUMBER or SDO_LRS GET_PREV_SHAPE_PT_MEASURE geom_segment IN SDO_GEOMETRY dim_array IN SDO_DIM_ARRAY measure IN NUMBER RETURN NUMBER or SDO_LRS GET_PREV_SHAPE_PT_MEASURE geom_segment IN SDO_GEOMETRY point IN SDO_GEOMETRY RETURN NUMBER or SDO_LRS GET_PREV_SHAPE_PT_MEASURE geom_segment IN SDO_GEOMETRY dim_array IN SDO_DIM_ARRAY point IN SDO_GEOMETRY RETURN NUMBER Description Returns the measure value of the previous shape point on a geometric segment before a specified measure value or LRS point 16 58 Oracle Spatial Users Guide and Reference SDO_LRS GET_PREV_SHAPE_PT_MEASURE Parameters Usage Notes Examples geom_segment Geometric segment measure Measure value on the geometric segment for which to return the measure value of the previous shape point point Point for which to return the measure value of the previous shape point If point is not on geom_segment the point on the geometric segment closest to the specified point is computed and the measure value of the closest shape point before that point is returned dim_array Dimensional information arr
47. 2 2 0 2 4 2 8 4 8 12 4 12 12 10 18 8 10 22 5 14 27 SELECT SDO_LRS REVERSE MEASURE a route_geometry m diminfo FROM lrs routes a user _sdo geom metadata m WHERE m table name LRS ROUTES AND m column_name ROUTE GEOMETRY AND a route_id 1 SDO_LRS REVERSE MEASURE A ROUTE GEOMETRY M DIMINFO SDO_GTYPE SDO SRID SDO POI SDO_ GEOMETRY 3302 NULL NULL SDO ELEM INFO ARRAY 1 2 1 SDO ORDINATE ARRAY 2 2 27 2 4 25 8 4 19 12 4 15 12 10 9 8 10 5 5 14 0 Note in the returned segment that the M values measures now go in descending order from 27 to 0 but the segment start and end points have the same X and Y values as in the original segment 2 2 and 5 14 16 92 Oracle Spatial Users Guide and Reference SDO_LRS SCALE_GEOM_SEGMENT SDO_LRS SCALE_GEOM_SEGMENT Format Description Parameters SDO_LRS SCALE_GEOM_SEGMENT geom_segment IN SDO_GEOMETRY start_measure IN NUMBER end_measure IN NUMBER shift_measure IN NUMBER RETURN SDO_GEOMETRY or SDO_LRS SCALE_GEOM_SEGMENT geom_segment IN SDO_GEOMETRY dim_array IN SDO_DIM_ARRAY start_measure IN NUMBER end_measure IN NUMBER shift_measure IN NUMBER RETURN SDO_GEOMETRY Returns the geometry object resulting from the scaling of a geometric segment geom_segment Geometric segment to be scaled dim_array Dimensional information array corresponding to geom_segment usually selected from one of the xxx_SDO_GEOM_
48. 2 geom segment SDO GEOMETRY dim array SDO_DIM_ ARRAY BEGIN SELECT a route_geometry into geom segment FROM lrs_routes a WHERE a route_name Routel SELECT m diminfo into dim array from 10 user_sdo_geom metadata m 11 WHERE m table name LRS_ROUTES AND m column_name ROUTE_ GEOMETRY 12 wo wat e uo Fe WwW 13 Convert mile measures to kilometers 27 1 609 43 443 14 SDO_LRS REDEFINE GEOM SEGMENT geom_segment 15 dim_array 16 0 Zero starting measure LRS segment starts at start of route 17 43 443 End of LRS segment 27 miles 43 443 kilometers 18 19 Update and insert geometries into table to display later 20 UPDATE lrs routes a SET a route geometry geom segment 21 WHERE a route_id 1 22 23 END 24 PL SQL procedure successfully completed SQL gt Display the redefined segment with all measures converted SQL gt SELECT a route geometry FROM lrs routes a WHERE a route id 1 ROUTE GEOMETRY SDO GTYPE SDO SRID SDO POINT X Y Z SDO ELEM INFO SDO_ORDIN SDO _ GEOMETRY 3302 NULL NULL SDO ELEM INFO ARRAY 1 2 1 SDO ORDINATE ARRAY 2 2 0 2 4 3 218 8 4 12 872 12 4 19 308 12 10 28 962 8 10 35 398 5 14 43 443 Linear Referencing System 7 31 Example of LRS Functions SQL gt Clip a piece of Routel SQL gt SELECT SDO_LRS CLIP GEOM_SEGMENT route geometry 5 10 2 FROM lrs_ routes WHERE route_id 1 SDO_LRS CLIP GEOM SEGMENT R
49. 5 pct_area_change_limit The percentage of area changed to be used for each simplification iteration as explained in the Usage Notes Spatial Analysis and Mining Subprograms 21 15 SDO_SAM SIMPLIFY_GEOMETRY Usage Notes This function reduces the number of vertices in a geometry by internally applying the SDO_UTIL SIMPLIFY function documented in Chapter 19 with an appropriate threshold value Reducing the number of vertices may result in a change in the area of the geometry The pct_area_change limit parameter specifies how much area change can be tolerated while simplifying the geometry It is usually a number from 1 to 100 The default value is 2 that is the area of the geometry can either increase or decrease by at most two percent compared to the original geometry as a result of the geometry simplification Examples The following example simplifies the geometries in the GEOMETRY column of the POLY_4PT_TEMP table SELECT sdo sam simplify geometry a geometry 0 00000005 FROM poly 4pt_temp a user _sdo geom metadata b WHERE b table name POLY 4PT TEMP SDO_SAM SIMPLIFY GEOMETRY A GEOMETRY 0 00000005 ORIG AREA CUR AREA ORIG LEN SDO_SMPL GEOMETRY 28108 5905 28108 5905 758 440118 758 440118 SDO GEOMETRY 2 003 8307 NULL SDO ELEM INFO ARRAY 1 1003 1 SDO ORDINATE ARRAY 122 4215 37 7862 122 422 37 7869 122 421 37 789 122 42 37 7866 122 4215 37 78 62 SDO SMPL GEOMETRY 4105 33806 4105 33
50. 8381 75 5802 39 838417 75 594017 39 837345 75 596107 39 837044 75 639488 39 82893 75 680145 39 813839 75 71096 39 796352 75 739716 39 772881 75 760689 39 74712 75 774101 39 721699 75 788704 39 721 699 lt gml coordinates gt lt gml LinearRing gt lt gml outerBoundarylIs gt lt gml Polygon gt lt gml geometryProperty gt 19 40 Oracle Spatial User s Guide and Reference SDO_UTIL TO_GMLGEOMETRY lt State gt lt State xmlns gml http www opengis net gml gt lt Name gt Utah lt Name gt lt Population gt 1722850 lt Population gt lt gml geometryProperty gt lt gml Polygon srsName SDO xmlns gml http www opengis net gml gt lt gml outerBoundaryIs gt lt gml LinearRing gt lt gml coordinates decimal cs ts gt 114 040871 41 993805 114 038803 41 884899 114 041306 41 114 04586 40 116997 114 046295 39 906101 114 046898 39 542801 114 049026 38 67741 114 049339 38 572968 114 049095 38 14864 114 0476 37 80946 114 05098 37 746284 114 051666 37 604805 114 052025 37 10 3989 114 049797 37 000423 113 484375 37 112 898598 37 000401 112 539604 37 0 00683 112 37 000977 111 412048 37 001514 111 133018 37 00079 110 75 37 00320 1 110 5 37 004265 110 469505 36 998001 110 36 997967 109 044571 36 999088 1 09 045143 37 375 109 042824 37 484692 109 040848 37 881176 109 041405 38 1530 27 109 041107 38 1647 109 059402 38 275501 109 059296 38 5 109 058868 38 719 906 109
51. A Gid FROM Polygons A WHERE SDO FILTER A Geometry sdo geometry 2003 NULL NULL sdo_elem_info_array 1 1003 3 sdo ordinate array x1 y1 x2 y2 TRUE The following example selects the GID values from the POLYGONS table where the GEOMETRY column object is likely to interact spatially with any GEOMETRY column object in the QUERY_POLYS table In this example the ORDERED optimizer hint is used and the QUERY_POLYS geomet ry2 table is specified first in the FROM clause because multiple geometries from geomet ry2 are involved see the Usage Notes SELECT ORDERED A gid FROM query polys B polygons A WHERE SDO FILTER A Geometry B Geometry TRUE Spatial Operators 12 15 SDO_FILTER Related Topics SDO_RELATE 12 16 Oracle Spatial Users Guide and Reference SDO_INSIDE SDO_INSIDE Format SDO_INSIDE geometry1 geometry2 Description Checks if any geometries in a table have the INSIDE topological relationship with a specified geometry Equivalent to specifying the SDO_RELATE operator with mask INSIDE See the section on the SDO_RELATE operator in this chapter for information about the operations performed by this operator and for usage requirements Keywords and Parameters Value Description geometryl Specifies a geometry column in a table The column must be spatially indexed Data type is SDO_GEOMETRY geometry2 Specifies either a geometry from a table or a transient instance of a ge
52. Ambiguity arises when offsets are given and the points described by the measures fall on shape points of the geometric segment see Figure 7 16 Linear Referencing System 7 17 LRS Operations Figure 7 16 Ambiguity in Location Referencing with Offsets Segment Direction 35 10 61 257 55 10 100 my 9 20 5 30 628 m ojo P One to One Mapping 35 10 61 257 55 10 100 O Many to One Mapping Q Middle Point 7 Offset Arc As shown in Figure 7 16 an offset arc of a shape point on a geometric segment is an arc on which all points have the same minimum distance to the shape point As a result all points on the offset arc are represented by the same measure offset pair To resolve this one to many mapping problem the middle point on the offset arc is returned 7 5 9 Projecting a Point onto a Geometric Segment You can find the projection point of a point with respect to a geometric segment The point to be projected can be on or off the segment If the point is on the segment the point and its projection point are the same Projection is a reverse operation of the point locating operation shown in Figure 7 15 Similar to a point locating operation all points on the offset arc of a shape point will have the same projection point that is the shape point itself measure and offset see Figure 7 16 If there are multiple projection points for a point the first one from the start point is returne
53. B Goodlett Pl San Francisco CA 94102 US RELAX BASE NAME FROM DUAL SDO_GCDR GEOCODE SCOTT SDO_KEYWORDARRAY 1CARLTONBGOODLETTPL SANFRANCISCO SDO_ GEO ADDR 0 SDO KEYWORDARRAY NULL CARLTON B GOODLETT PL NULL NULL SAN FRANCISCO NULL CA US 94102 NULL 94102 NULL 1 CARLTON B GOODLETT PL F F NULL NULL L 01 23614360 nul ENUT B281CP 1 DEFAULT 122 41815 37 7784183 Geocoding Subprograms 20 3 SDO_GCDR GEOCODE_ALL SDO_GCDR GEOCODE_ALL Format Description Parameters Usage Notes SDO_GCDR GEOCODE_ALL gc_username IN VARCHAR2 addr_lines IN SDO_KEYWORDARRAY country IN VARCHAR2 match_mode IN VARCHAR2 RETURN SDO_ADDR_ARRAY Geocodes all addresses associated with an unformatted address and returns the result as an SDO_ADDR_ARRAY object gc_username Name of the user that owns the tables containing the geocoding data addr_lines An array of quoted strings representing the unformatted address to be geocoded The SDO_KEYWORDARRAY type is described in Section 5 2 3 country Country name or ISO country code match_mode Match mode for the geocoding operation Match modes are explained in Section 5 1 2 This function returns an object of type SDO_ADDR_ARRAY which is described in Section 5 2 2 It performs the same operation as the SDO_GCDR GEOCODE function however it can return results for multiple addresses in which case the returned SD
54. Bessel 1841 Bessel 1841 NGO 1948 Bessel 1841 Schwarzeck Clarke 1858 Clarke 1866 Clarke 1866 Michigan Clarke 1880 Clarke 1880 Arc 1950 Clarke 1880 IGN Coordinate Systems Spatial Reference Systems 6 15 Coordinate Systems Data Structures Clarke 1880 Jamaica Everest Everest Timbalai Fischer 1968 Hayford IAG 75 Krassovsky NWL 9D OSU9A Sphere 6370997m WGS 66 Walbeck Clarke 1880 Merchich Everest Kalianpur Fischer 1960 Mercury GRS 67 Helmert 1906 Indonesian MERIT 83 New International 1967 Plessis 1817 Struve 1860 WGS 72 War Office 6 4 5 MDSYS SDO_PROJECTIONS Table Clarke 1880 Palestine Everest Kertau Fischer 1960 South Asia GRS 80 Hough International 1924 NWL 10D OSU86F South American 1969 WGS 60 WGS 84 The MDSYS SDO_PROJECTIONS reference table contains one row for each valid PROJECTION specification in the well known text WKT description in the coordinate system definition The WKT is described in Section 6 4 1 1 The MDSYS SDO_PROJECTIONS table contains the column shown in Table 6 5 Table 6 5 MDSYS SDO_PROJECTIONS Table Column Name Data Type Description NAME VARCHAR2 64 Name of the map projection Specify a value from this column in the PROJECTION specification of the WKT for any user defined coordinate system Examples Geographic Lat Long Universal Transverse Mercator State Plane Coordinates Albers Conical Equal Area The fol
55. Chapter 21 Spatial Analysis and Mining Subprograms To understand the examples in the reference chapters you must understand the conceptual and data type information in Chapter 2 Spatial Data Types and Metadata especially Section 2 2 SDO_GEOMETRY Object Type 10 SQL Statements for Indexing Spatial Data This chapter describes the SQL statements used when working with the spatial object data type The statements are listed in Table 10 1 Table 10 1 Spatial Index Creation and Usage Statements Statement Description ALTER INDEX Alters specific parameters for a spatial index ALTER INDEX REBUILD Rebuilds a spatial index or a specified partition of a partitioned index ALTER INDEX RENAME Changes the name of a spatial index or a partition of a spatial TO index CREATE INDEX Creates a spatial index on a column of type SDO_GEOMETRY DROP INDEX Deletes a spatial index This chapter focuses on using these SQL statements with spatial indexes For complete reference information about any statement see Oracle Database SQL Reference Bold italic text is often used in the Keywords and Parameters sections in this chapter to identify a grouping of keywords followed by specific keywords in the group For example INDEX_PARAMS identifies the start of a group of index related keywords SQL Statements for Indexing Spatial Data 10 1 ALTER INDEX ALTER INDEX Purpose Alters specific parameters for a spatial in
56. ID ROUTE _ID SDO GEOMETRY 3301 NULL NULL SDO ELEM INFO ARRAY 1 1 1 SDO ORDINATE ARRAY 9 4 9 Linear Referencing Subprograms 16 71 SDO_LRS MEASURE_RANGE SDO_LRS MEASURE_RANGE Format Description Parameters Usage Notes Examples SDO_LRS MEASURE_RANGE geom_segment IN SDO_GEOMETRY dim_array IN SDO_DIM_ARRAY RETURN NUMBER Returns the measure range of a geometric segment that is the difference between the start measure and end measure geom_segment Cartographic representation of a linear feature dim_array Dimensional information array corresponding to geom_segment usually selected from one of the xxx_SDO_GEOM_METADATA views described in Section 2 4 This function subtracts the start measure of geom_segment from the end measure of geom_segment The _3D format of this function GDO_LRS MEASURE_RANGE_3D is available For information about _3D formats of LRS functions see Section 7 4 The following example returns the measure range of the geometric segment representing Route 1 This example uses the definitions from the example in Section 7 7 SELECT SDO_LRS MEASURE RANGE route geometry FROM lrs_ routes WHERE route id 1 SDO_LRS MEASURE RANGE ROUTE GEOMETRY 16 72 Oracle Spatial Users Guide and Reference SDO_LRS MEASURE_RANGE Linear Referencing Subprograms 16 73 SDO_LRS MEASURE_TO_PERCENTAGE SDO_LRS MEASURE_TO_PERCENTAGE Format SDO_LRS MEASURE_TO_PERCE
57. LRS Data If you have linear referencing data that is geometries with measure information in release 8 1 5 8 1 6 or 8 1 7 format you must upgrade that data to the format for Spatial releases 9 0 1 and higher as follows 1 2 Drop any spatial indexes on the table with the linear referencing data Find out which dimension of the object has the linear referencing information This could be the third or the fourth dimension depending on the dimensionality of the data For example if the data has three dimensions such as X Y and height the LRS geometry object is 4D and the LRS dimension in this case is usually 4 Make sure that the data is in the format for release 8 1 6 or higher that is it has 4 digit SDO_GTYPE values Update the LRS geometry objects by setting the LRS dimension in the SDO_ GTYPE field as in the following examples Example 1 The LRS dimension is 3 for the geometries in the GEOMETRY column of table LRS_DATA Update the SDO_GTYPE as follows UPDATE LRS DATA a SET a geometry sdo gtype a geometry sdo_gtype 300 Installation Compatibility and Upgrade A 1 Upgrading LRS Data Example 2 The LRS dimension is 4 for the geometries in the GEOMETRY column of table LRS_DATA Update the SDO_GTYPE as follows UPDATE LRS DATA a SET a geometry sdo gtype a geometry sdo_gtype 400 A 2 Oracle Spatial User s Guide and Reference Oracle Locator Oracle Locator also referred to as Locator
58. Monument Square and Concord MA 01742 Unformatted addresses are specified using the SDO_KEYWORDARRAY data type which is described in Section 5 2 3 5 2 Oracle Spatial User s Guide and Reference Concepts for Geocoding 5 1 2 Match Modes The match mode for a geocoding operation determines how closely the attributes of an input address must match the data being used for the geocoding Input addresses can include different ways of representing the same thing such as Street and the abbreviation St and they can include minor errors such as the wrong postal code even though the street address and city are correct and the street address is unique within the city You can require an exact match between the input address and the data used for geocoding or you can relax the requirements for some attributes so that geocoding can be performed despite certain discrepancies or errors in the input addresses Table 5 2 lists the match modes and their meanings Use a value from this table with the match_mode attribute of the SDO_GEO_ADDR data type described in Section 5 2 1 and for the match_mode parameter of a geocoding function or procedure Table 5 2 Match Modes for Geocoding Operations Match Mode Description EXACT All attributes of the input address must match the data used for geocoding However if the house or building number base name street name street type street prefix and street suffix do not all match the geo
59. Nahrwan Saudi Arabia Netherlands Bessel Old Hawaiian Pico de las Nieves Puerto Rico Qornoq Coordinate Systems Data Structures RT 90 Sweden Reunion Rome 1940 Santo DOS Sao Braz Sapper Hill 1943 Schwarzeck South American 1969 South Asia Southeast Base Southwest Base Timbalai 1948 Tokyo Tristan Astro 1968 Viti Levu 1916 WGS 60 WGS 66 WGS 72 WGS 84 Wake Eniwetok 1960 Yacare Zanderij 6 4 4 MDSYS SDO_ELLIPSOIDS Table The MDSYS SDO_ELLIPSOIDS reference table contains one row for each valid SPHEROID specification in the well known text WKT description in the coordinate system definition The WKT is described in Section 6 4 1 1 The MDSYS SDO_ELLIPSOIDS table contains the columns shown in Table 6 4 Table 6 4 MDSYS SDO_ELLIPSOIDS Table Column Name Data Type Description NAME VARCHAR2 64 Name of the ellipsoid spheroid Specify a value from this column in the SPHEROID specification of the WKT for any user defined coordinate system Examples Clarke 1866 WGS 72 Australian Krassovsky International 1924 SEMI_MAJOR_ NUMBER Radius in meters along the semi major axis one half AXIS of the long axis of the ellipsoid INVERSE _ NUMBER Inverse flattening of the ellipsoid That is 1 FLATTENING where f a b a and a is the semi major axis and b is the semi minor axis The following are the names in tabular format of the supported ellipsoids Airy 1930 Airy 1930 Ireland 1965 Australian
60. Nie ee Exit 3 Route 1 start 01234 66 7 8 9 10 1112 1314 15 In Figure 7 20 the highway Route 1 starts at point 2 2 and ends at point 5 14 follows the path shown and has six entrance exit points Exit 1 through Exit 6 For simplicity each unit on the graph represents one unit of measure and thus the measure from start to end is 27 the segment from Exit 5 to Exit 6 being the hypotenuse of a 3 4 5 right triangle Each row in Table 7 1 lists an actual highway related feature and the LRS feature that corresponds to it or that can be used to represent it Table 7 1 Highway Features and LRS Counterparts Highway Feature LRS Feature Named route road or street LRS segment or linear feature logical set of segments Mile or kilometer marker Measure Accident reporting and location tracking SDO_LRS LOCATE_PT function Construction zone portion of a road SDO_LRS CLIP_GEOM_SEGMENT function 7 22 Oracle Spatial Users Guide and Reference Example of LRS Functions Table 7 1 Cont Highway Features and LRS Counterparts Highway Feature LRS Feature Road extension adding at the beginning or SDO_LRS CONCATENATE_GEOM_ end or combination designating or renaming SEGMENTS function two roads that meet as one road Road reconstruction or splitting resulting in SDO_LRS SPLIT_GEOM_SEGMENT two named roads from one named road procedure Finding the closest point on the road to a point SDO_LRS PROJECT_PT functi
61. Prerequisites Value Description sdo_rtr_pctfree PHYSICAL_STORAGE_ PARAMS tablespace initial next minextents maxextents pctincrease NOPARALLEL PARALLEL integer Specifies the minimum percentage of slots in each index tree node to be left empty when the index is created Slots that are left empty can be filled later when new data is inserted into the table The value can range from 0 to 50 The default value is best for most applications however a value of 0 is recommended if no updates will be performed to the geometry column Data type is NUMBER Default 10 Determines the storage parameters used for altering the spatial index data table A spatial index data table is a standard Oracle table with a prescribed format Not all physical storage parameters that are allowed in the STORAGE clause of a CREATE TABLE statement are supported The following is a list of the supported subset Specifies the tablespace in which the index data table is created This parameter is the same as TABLESPACE in the STORAGE clause of a CREATE TABLE statement Is the same as INITIAL in the STORAGE clause of a CREATE TABLE statement Is the same as NEXT in the STORAGE clause of a CREATE TABLE statement Is the same as MINEXTENTS in the STORAGE clause of a CREATE TABLE statement Is the same as MAXEXTENTS in the STORAGE clause of a CREATE TABLE statement Is the same as PCTINCREASE in the STORAGE clause of a CRE
62. Returns the number of vertices in the input geometry Parameters geometry Geometry for which to return the number of vertices Usage Notes None Examples The following example returns the number of vertices for each geometry in the SHAPE column of the COLA_MARKETS table The example uses the definitions and data from Section 2 1 SELECT c name SDO UTIL GETNUMVERTICES c shape FROM cola_markets c NAME SDO_UTIL GETNUMVERTICES C SHAPE Related Topics a SDO_UTIL GETVERTICES a SDO_UTIL GETNUMELEM Spatial Utility Subprograms 19 17 SDO_UTIL GETVERTICES SDO_UTIL GETVERTICES Format SDO_UTIL GETVERTICES geometry IN SDO_GEOMETRY RETURN VERTEX_SET_TYPE Description Returns the coordinates of the vertices of the input geometry Parameters geometry Geometry for which to return the coordinates of the vertices Usage Notes This function returns an object of VERTEX_SET_TYPE which consists of a table of objects of VERTEX_TYPE Oracle Spatial defines the type VERTEX_SET_TYPE as CREATE TYPE vertex_set_type as TABLE OF vertex_ type Oracle Spatial defines the object type VERTEX_TYPE as CREATE TYPE vertex type AS OBJECT x NUMBER y NUMBER z NUMBER w NUMBER id NUMBER This function can be useful in finding a vertex that is causing a geometry to be invalid For example if you have identified a geometry as invalid by using the SDO_GEOM VALIDATE_GEOMETRY_WITH_CONTEXT function or the SDO_ GEOM
63. SDO POINT X Y Z SDO ELEM INFO SDO_ORDIN SDO_ GEOMETRY 3302 NULL NULL SDO ELEM INFO ARRAY 1 2 1 SDO ORDINATE ARRAY 2 2 0 2 4 2 8 4 8 12 4 12 12 10 18 8 10 22 5 14 27 Redefine geometric segment to convert miles to kilometers DECLARE geom_segment SDO GEOMETRY dim_array SDO DIM ARRAY BEGIN SELECT a route geometry into geom_segment FROM lrs routes a WHERE a route name Routel SELECT m diminfo into dim_array from user _sdo_geom metadata m WHERE m table name LRS ROUTES AND m column_name ROUTE GEOMETRY Convert mile measures to kilometers 27 1 609 43 443 SDO_LRS REDEFINE GEOM SEGMENT geom_segment Linear Referencing Subprograms 16 85 SDO_LRS REDEFINE_GEOM_SEGMENT dim_ array 0 Zero starting measure LRS segment starts at start of route 43 443 End of LRS segment 27 miles 43 443 kilometers Update and insert geometries into table to display later UPDATE lrs routes a SET a route geometry geom segment WHERE a route_id 1 END PL SQL procedure successfully completed Display the redefined segment with all measures converted SELECT a route_geometry FROM lrs routes a WHERE a route_id 1 ROUTE GEOMETRY SDO_GTYPE SDO SRID SDO POINT X Y Z SDO ELEM INFO SDO ORDIN SDO_ GEOMETRY 3302 NULL NULL SDO ELEM INFO ARRAY 1 2 1 SDO ORDINATE ARRAY 2 2 0 2 4 3 218 8 4 12 872 12 4 19 308 12 10 28 962 8 10 35 39
64. SDO_DATUMS Table Column Name Data Type Description NAME VARCHAR2 64 SHIFT_X NUMBER SHIFT_Y NUMBER SHIFT_Z NUMBER ROTATE_X NUMBER ROTATE_Y NUMBER ROTATE_Z NUMBER SCALE _ NUMBER ADJUST Name of the datum Specify a value Oracle supplied or user defined from this column in the DATUM specification of the WKT for any user defined coordinate system Examples Adindan Afgooye Ain el Abd 1970 Anna 1 Astro 1965 Arc 1950 Arc 1960 Ascension Island 1958 Number of meters to shift the ellipsoid center relative to the center of the WGS 84 ellipsoid on the x axis Number of meters to shift the ellipsoid center relative to the center of the WGS 84 ellipsoid on the y axis Number of meters to shift the ellipsoid center relative to the center of the WGS 84 ellipsoid on the z axis Number of arc seconds of rotation about the x axis Number of arc seconds of rotation about the y axis Number of arc seconds of rotation about the z axis A value to be used in adjusting the X Y and Z values after any shifting and rotation according to the formula 1 0 SCALE_ADJUST 10 The following are the names in tabular format of the supported datums Adindan Afgooye Ain el Abd 1970 Anna 1 Astro 1965 Arc 1950 Arc 1960 Ascension Island 1958 Astro B4 Sorol Atoll Astro Beacon E Astro DOS 71 4 Astronomic Station 1952 Australian Geodetic 1966 Australian Geodetic 1984 Belgium Hayford Bellevue IGN Bermud
65. SDO_GEOMETRY object The rest of this chapter provides reference information on the subprogramas listed in alphabetical order Geocoding Subprograms 20 1 SDO_GCDR GEOCODE SDO_GCDR GEOCODE Format Description Parameters Usage Notes SDO_GCDR GEOCODE username IN VARCHAR2 addr_lines IN SDO_KEYWORDARRAY country IN VARCHAR2 match_mode IN VARCHAR2 RETURN SDO_GEO_ADDR Geocodes an unformatted address and returns the result as an SDO_GEO_ADDR object username Name of the user that owns the tables containing the geocoding data addr_lines An array of quoted strings representing the unformatted address to be geocoded The SDO_KEYWORDARRAY type is described in Section 5 2 3 country Country name or ISO country code match_mode Match mode for the geocoding operation Match modes are explained in Section 5 1 2 This function returns an object of type SDO_GEOR_ADDR which is described in Section 5 2 1 It performs the same operation as the SDO_GCDR GEOCODE_AS_ GEOMETRY function however that function returns an SDO_GEOMETRY object 20 2 Oracle Spatial User s Guide and Reference SDO_GCDR GEOCODE Examples The following example geocodes the address of City Hall in San Francisco California using the RELAX_BASE NAME match mode It returns the longitude and latitude coordinates of this address as 122 41815 and 37 7784183 respectively SELECT SDO_GCDR GEOCODE SCOTT SDO KEYWORDARRAY 1 Carlton
66. SDO_SRID attribute 2 8 SDO_STARTING_OFFSET value 2 9 SDO_TOUCH operator 12 44 SDO_TUNE package AVERAGE _MBR 18 2 ESTIMATE_RTREE INDEX_SIZE 18 4 EXTENT_OF 18 7 MIX_INFO 18 9 QUALITY_DEGRADATION 18 11 SDO_UNION function 13 39 SDO_UNIT column in SDO_AREA_UNITS table 2 34 in SDO_DIST_UNITS table 2 33 SDO_UTIL package APPEND 19 3 CIRCLE_POLYGON 19 5 CONCAT_LINES 19 7 CONVERT_UNIT 19 9 ELLIPSE_POLYGON 19 11 EXTRACT 19 13 GETNUMELEM 19 16 GETNUMVERTICES 19 17 GETVERTICES 19 18 INITIALIZE_INDEXES_FOR_TTS 19 20 POINT_AT_BEARING 19 21 POLYGONTOLINE 19 23 PREPARE _FOR_TTS 19 25 REMOVE_DUPLICATE_VERTICES 19 27 REVERSE_LINESTRING 19 29 SIMPLIFY 19 31 TO_GMLGEOMETRY 19 35 SDO_VERSION function 1 22 SDO_WITHIN_DISTANCE operator 12 46 SDO_XOR function 13 42 SDOAGGRTYPE object type 1 19 sdoapi Java client interface 1 20 secondary filter 1 10 4 12 segments geometric 7 2 self crossing line strings and polygons 1 5 semi major axis 6 15 sequence object for R tree index 2 32 SET_PT_MEASURE procedure 16 96 shape point 7 3 determining if measure value is a shape point 16 67 getting measure of next 16 52 getting measure of previous 16 58 getting next 16 50 getting previous 16 55 simple element 2 10 simplification of geometries 19 31 SIMPLIFY function 19 31 SIMPLIFY_GEOMETRY function 21 15 SIMPLIFY_LAYER procedure 21 17 size requirements hardware for spatial applications 1 23
67. Spatial Users Guide and Reference SDO_GEOM SDO_BUFFER SDO_GEOM SDO_BUFFER Format SDO_GEOM SDO_BUFFER geom IN SDO_GEOMETRY dim IN SDO_DIM_ARRAY dist IN NUMBER params IN VARCHAR2 RETURN SDO_GEOMETRY or SDO_GEOM SDO_BUFFER geom IN SDO_GEOMETRY dist IN NUMBER tol IN NUMBER params IN VARCHAR2 RETURN SDO_GEOMETRY Description Generates a buffer polygon around or inside a geometry object Parameters geom Geometry object dim Dimensional information array corresponding to geom usually selected from one of the xxx_SDO_GEOM_METADATA views described in Section 2 4 dist Distance value If the value is positive the buffer is generated around the geometry if the value is negative valid only for polygons the buffer is generated inside the Geometry Subprograms 13 13 SDO_GEOM SDO_BUFFER Usage Notes geometry The absolute value of this parameter must be greater than the tolerance value as specified in the dimensional array dim parameter or in the tol parameter tol Tolerance value see Section 1 5 5 params A quoted string with one or both of the following keywords unit and anSDO_UNIT value from the MDSYS SDO_DIST_UNITS table It identifies the unit of measurement associated with the dist parameter value and also with the arc tolerance value if the arc_tolerance keyword is specified See Section 2 6 for more information about unit of measurement specification a ar
68. 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 Chapter 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 Ill 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
69. TOUCH See the section on the SDO_RELATE operator in this chapter for information about the operations performed by this operator and for usage requirements Keywords and Parameters Value Description geometryl Specifies a geometry column in a table The column must be spatially indexed Data type is SDO_GEOMETRY geometry2 Specifies either a geometry from a table or a transient instance of a geometry Specified using a bind variable or SDO_GEOMETRY constructor Data type is SDO_GEOMETRY Returns The expression SDO_TOUCH geometry1 geometry2 TRUE evaluates to TRUE for object pairs that have the TOUCH topological relationship and FALSE otherwise Usage Notes See the Usage Notes for the SDO_RELATE operator in this chapter For an explanation of the topological relationships and the nine intersection model used by Spatial see Section 1 8 12 44 Oracle Spatial User s Guide and Reference SDO_TOUCH Examples The following example finds geometries that have the TOUCH relationship with a query window here a rectangle with lower left upper right coordinates 1 1 5 7 The example uses the definitions and data described in Section 2 1 and illustrated in Figure 2 1 In this example only cola_b has the TOUCH relationship with the query window geometry SELECT c mkt_id c name FROM cola_markets c WHERE SDO_TOUCH c shape SDO GEOMETRY 2003 NULL NULL SDO_ELEM_ INFO ARRAY 1 1003 3 SDO ORDINATE ARRAY 1
70. Table containing theme information for example demographic information theme_colname Name of the column in the theme_name table that contains geometry objects aggr_type_string Any Oracle SQL aggregate function that accepts one or more numeric values and computes a numeric value such as SUM MIN MAX or AVG aggr_col_string Name of a column in the theme_name table on which to compute aggregate values An example might be a POPULATION column Spatial Analysis and Mining Subprograms 21 21 SDO_SAM TILED_AGGREGATES tiling_level Level to be used to create tiles tiling_domain Domain for the tiling level If the geometry data in the theme_name table is geodetic you must specify this parameter If the geometry data in the theme_name table is not geodetic and if you do not specify this parameter the extent associated with the theme_name table is used Usage Notes This function is similar to SDO_SAM AGGREGATES_FOR_LAYER but the results are dynamically generated using tiling information Given a theme_name table the tiling domain is determined Based on the tiling level value the necessary tiles are generated For each tile geometry thematic aggregates are computed as described in the Usage Notes for SDO_SAM AGGREGATES_FOR_LAYER This function returns an object of type SDO_REGAGGRSET The SDO_ REGAGGRSET object type is defined as TABLE OF SDO_REGAGGR The SDO_REGAGGR object type is defined as Name Null Type REGI
71. The processing includes such operations as spatial binning proximity and colocation materialization The ODM engine processes materialized data spatial and nonspatial to generate mining results Spatial Analysis and Mining 8 3 Spatial Binning for Detection of Regional Patterns The following are examples of the kinds of data mining applications that could benefit from including spatial information in their processing Business prospecting Determine if colocation of a business with another franchise such as colocation of a Pizza Hut restaurant with a Blockbuster video store might improve its sales Store prospecting Find a good store location that is within 50 miles of a major city and inside a state with no sales tax Although 50 miles is probably too far to drive to avoid a sales tax many customers may live near the edge of the 50 mile radius and thus be near the state with no sales tax Hospital prospecting Identify the best locations for opening new hospitals based on the population of patients who live in each neighborhood Spatial region based classification or personalization Determine if southeastern United States customers in a certain age or income category are more likely to prefer soft or hard rock music Automobile insurance Given a customer s home or work location determine if it is in an area with high or low rates of accident claims or auto thefts Property analysis Use colocation rules to find
72. VALIDATE_LAYER_WITH_CONTEXT procedure both of which are documented in Chapter 13 you can use the GETVERTICES function to view the vertices in tabular format 19 18 Oracle Spatial Users Guide and Reference SDO_UTIL GETVERTICES Examples The following example returns the X and Y coordinates and ID values of the vertices of the geometries in the SHAPE column of the COLA_MARKETS table The example uses the definitions and data from Section 2 1 SELECT c mkt_id c name t X t Y t id FROM cola_markets c TABLE SDO_UTIL GETVERTICES c shape t ORDER BY c mkt_id t id MKT_ID NAME X Y ID 1 cola a 1 1 1 1 cola_a 5 7 2 2 cola_b 5 1 1 2 cola_b 8 1 2 2 cola_b 8 6 3 2 cola b 5 7 4 2 cola b 5 1 5 3 cola c 3 3 1 3 cola c 6 3 2 3 cola c 6 5 3 3 cola c 4 5 4 3 cola c 3 3 5 4 cola d 8 7 ll 4 cola d 10 9 2 4 cola d 8 11 3 15 rows selected Related Topics a SDO_UTIL EXTRACT a SDO_GEOM VALIDATE_GEOMETRY_WITH_CONTEXT a SDO_GEOM VALIDATE_LAYER_WITH_CONTEXT a SDO_UTIL GETNUMVERTICES Spatial Utility Subprograms 19 19 SDO_UTIL INITIALIZE_INDEXES_FOR_TTS SDO_UTIL INITIALIZE_INDEXES_FOR_TTS Format Description Parameters Usage Notes Examples Related Topics SDO_UTIL INITIALIZE_INDEX_FOR_TTS Initializes all spatial indexes in a tablespace that was transported to another database None This procedure is part of the support for using the Oracle transportable tablespace feature with tablespaces th
73. VARCHAR2 addr_lines IN SDO_KEYWORDARRAY country IN VARCHAR2 RETURN SDO_GEOMETRY Geocodes an unformatted address and returns the result as an SDO_GEOMETRY object username Name of the user that owns the tables containing the geocoding data addr_lines An array of quoted strings representing the unformatted address to be geocoded The SDO_KEYWORDARRAY type is described in Section 5 2 3 country Country name or ISO country code This function returns an object of type SDO_GEOMETRY It performs the same operation as the SDO_GCDR GEOCODE function however that function returns an SDO_GEOR_ADDR object This function uses a match mode of DEFAULT for the geocoding operation Match modes are explained in Section 5 1 2 The following example geocodes the address of City Hall in San Francisco California using the RELAX BASE NAME match mode It returns an SDO_ 20 6 Oracle Spatial Users Guide and Reference SDO_GCDR GEOCODE_AS_GEOMETRY GEOMETRY object in which the longitude and latitude coordinates of this address are 122 41815 and 37 7784183 respectively SELECT SDO_GCDR GEOCODE AS GEOMETRY SCOTT SDO_KEYWORDARRAY 1 Carlton B Goodlett Pl San Francisco CA 94102 US RELAX BASE NAME FROM DUAL SDO_GCDR GEOCODE AS GEOMETRY SCOTT SDO KEYWORDARRAY 1CARLTONBGOODLETTPL L Geocoding Subprograms 20 7 SDO_GCDR GEOCODE_AS_GEOMETRY 20 8 Oracle Spatial Users Guide and Reference 21
74. Web site at http www oracle com accessibility Accessibility 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 Organization This 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 com
75. allows for optimized processing of point data Data type is VARCHAR2 Specifies the name of the spatial index table to be rebuilt Data type is VARCHAR2 Specifies the number of dimensions to be indexed For example a value of 2 causes the first two dimensions to be indexed Must be less than or equal to the number of actual dimensions number of SDO_DIM_ELEMENT instances in the dimensional array that describes the geometry objects in the column If the value is 3 or higher the only Spatial operator that can be used on the indexed geometries is SDO_FILTER the other operators described in Chapter 12 cannot be used Data type is NUMBER Default 2 10 6 Oracle Spatial Users Guide and Reference ALTER INDEX REBUILD Value Description sdo_rtr_pctfree PHYSICAL_STORAGE_ PARAMS tablespace initial next minextents maxextents pctincrease NOPARALLEL PARALLEL integer Specifies the minimum percentage of slots in each index tree node to be left empty when the index is created Slots that are left empty can be filled later when new data is inserted into the table The value can range from 0 to 50 Data type is NUMBER Default 10 Determines the storage parameters used for rebuilding the spatial index data table A spatial index data table is a regular Oracle table with a prescribed format Not all physical storage parameters that are allowed in the STORAGE clause of a CREATE TABLE statement are supp
76. 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 a SDO_TUNE ESTIMATE_INDEX_PERFORMANCE a SDO_TUNE ESTIMATE_TILING_LEVEL a SDO_TUNE ESTIMATE_TILING_TIME a SDO_TUNE ESTIMATE_TOTAL_NUMTILES a SDO_TUNE HISTOGRAM_ANALYSIS XXXV Information 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 geomet ry xsd schema document Interior Buffers You can create a buffer inside a polygon by specifying a negative value for th
77. and 40 10 90 40 50 is a band from the South Pole to latitude 50 between longitudes 10 and 40 Coordinate Systems Spatial Reference Systems 6 5 Geodetic Coordinate Support a 180 10 180 5 is a band that wraps the equator from 10 degrees south to 5 degrees north 180 90 180 90 is the whole Earth a 180 90 180 50 is the whole Earth below latitude 50 a 180 50 180 90 is the whole Earth above latitude 50 6 2 4 Other Considerations and Requirements with Geodetic Data The following geometries are not permitted if a geodetic coordinate system is used a Circles Circular arcs Geodetic coordinate system support is provided only for geometries that consist of points or geodesics lines on the ellipsoid If you have geometries containing circles or circular arcs in a projected coordinate system you can densify them using the SDO_GEOM SDO_ARC_DENSIFY function documented in Chapter 13 before transforming them to geodetic coordinates and then perform Spatial operations on the resulting geometries The following size limits apply with geodetic data No polygon element can have an area larger than one half the surface of the Earth a No line element can have a length longer than half the perimeter a great circle of the Earth If you need to work with larger elements first break these elements into multiple smaller elements and work with them For example you cannot create an element representing
78. and the example in Figure 7 4 Figure 7 3 Measures Distances and Their Mapping Relationship Mprev 20 Mp sis Mnext 20 Measure Popa P 50 0 Prrext 100 0 Oe Distance PorevP 50 58 PorevPnext 100 PP M prev P PP Mnext Mprev Mprev prev next Linear Referencing System 7 5 Terms and Concepts Figure 7 4 Measure Populating of a Geometric Segment 0 60 90 120 a Before Measure Populating Assigned 0 60 90 120 Measures o_o es ss so 6 6 6 6 6 15 30 45 70 80 100 110 Populated Measures After Measure Populating Measures are evenly spaced between assigned measures However the assigned measures for points of interest on a geometric segment do not need to be evenly spaced This could eliminate the problem of error accumulation and account for inaccuracy of data source Moreover the assigned measures do not even need to reflect actual distances for example they can reflect estimated driving time they can be any valid values within the measure range Figure 7 5 shows the measure population that results when assigned measure values are not proportional and reflect widely varying gaps Figure 7 5 Measure Populating with Disproportional Assigned Measures 0 88 97 100 o_o es e rn rn o_o eee eee Before Measure Populating Assigned 0 88 97 100 Measures OO es Js e OO 22 44 66 91 94 98 99 Populated Measures After Measure Populating In all cas
79. are returned by the operator See the SDO_NN operator in Chapter 12 for information about this parameter number is the same number used in the call to SDO_NN_DISTANCE Use this only if the SDO_NN_DISTANCE ancillary operator is included in the call to SDO_NN See the SDO_NN operator in Chapter 12 for information about this parameter Indexing and Querying Spatial Data 4 15 Querying Spatial Data The following example finds the two objects from the SHAPE column in the COLA_ MARKETS table that are closest to a specified point 10 7 Note the use of the optimizer hint in the SELECT statement as explained in the Usage Notes for the SDO_NN operator in Chapter 12 SELECT INDEX cola_markets cola_spatial_idx c mkt_id c name FROM cola_markets c WHERE SDO NN c shape SDO_geometry 2001 NULL SDO point type 10 7 NULL NULL NULL sdo num res 2 TRUE 4 2 1 5 Spatial Functions Spatial also supplies functions for determining relationships between geometries finding information about single geometries changing geometries and combining geometries These functions all take into account two dimensions of source data If the output value of these functions is a geometry the resulting geometry will have the same dimensionality as the input geometry but only the first two dimensions will accurately reflect the result of the operation 4 2 2 Spatial Join A spatial join is the same as a regular join except that the predicate
80. 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_RELATE with 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 xxxiii SDO_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 geomet ry2 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_NN operator 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 i
81. behavior with other Oracle indexes where the index is created in the user s default tablespace if the tablespace specified for the original index does not exist at import time For information about using the Export and Import utilities see Oracle Database Utilities 4 8 Oracle Spatial User s Guide and Reference Querying Spatial Data 4 2 Querying Spatial Data This section describes how the structures of a Spatial layer are used to resolve spatial queries and spatial joins Spatial uses a two tier query model with primary and secondary filter operations to resolve spatial queries and spatial joins as explained in Section 1 6 The term two tier indicates that two distinct operations are performed to resolve queries If both operations are performed the exact result set is returned You cannot append a database link dblink name to the name of a spatial table in a query if a spatial index is defined on that table If a spatial index is created in a database that was created using the UTF8 character set spatial queries that use the spatial index will fail if the system parameter NLS _ LENGTH_SEMANTICS is set to CHAR For spatial queries to succeed in this case the NLS_LENGTH_SEMANTICS parameter must be set to BYTE its default value 4 2 1 Spatial Query In a spatial R tree index each geometry is represented by its minimum bounding rectangle MBR as explained in Section 1 7 1 Consider the following layer containing seve
82. c mkt_id c market name c market shape FROM cola_markets 2 c WHERE SDO_RELATE c market shape SDO GEOMETRY 2003 NULL NULL SDO_ ELEM INFO ARRAY 1 1003 3 SDO ORDINATE ARRAY 4 6 8 8 mask anyinteract TRUE 9 2 SDO_GEOMETRY Objects in Function Based Indexes A function based spatial index facilitates queries that use locational information of type SDO_GEOMETRY returned by a function or expression In this case the spatial index is created based on the precomputed values returned by the function or expression If you are not already familiar with function based indexes see the following for detailed explanations of their benefits options and requirements as well as usage examples a Oracle Database Application Developer s Guide Fundamentals Extending Spatial Indexing Capabilities 9 3 SDO_GEOMETRY Objects in Function Based Indexes a Oracle Database Administrator s Guide See especially the information in those documents about requirements and restrictions related to function based indexes For example you must grant Spatial application users the QUERY REWRITE privilege and you must have the initialization parameters QUERY_REWRITE_ENABLED TRUE and QUERY_ REWRITE_INTEGRITY TRUSTED The procedure for using an SDO_GEOMETRY object in a function based index is as follows 1 Create the function that returns an SDO_GEOMETRY object The function must be declared as DETERMINISTIC 2 If the spatial data table do
83. called hierarchical or network database systems resolution The number of subdivision levels of data scale The ratio of the distance on a map photograph or image to the corresponding image on the ground all expressed in the same units secondary filter The operation that applies exact computations to geometries that result from the primary filter The secondary filter yields an accurate answer to a spatial query The secondary filter operation is computationally expensive but it is only applied to the Glossary 7 Glossary 8 primary filter results not the entire data set See also primary filter and two tier query model shape points Points that are specified when an LRS segment is constructed and that are assigned measure information sort The operation of arranging a set of items according to a key that determines the sequence and precedence of items spatial A generic term used to reference the mathematical concept of n dimensional data spatial data Data that is referenced by its location in n dimensional space The position of spatial data is described by multiple values See also hyperspatial data spatial data model A model of how objects are located on a spatial context spatial data structures A class of data structures designed to store spatial information and facilitate its manipulation spatial database A database containing information indexed by location spatial join A query in which ea
84. combined with the logical Boolean operator OR for example mask inside touch however FILTER cannot be combined with any other mask If this parameter is null or contains an empty string mask FILTER is assumed Specifies a numeric distance value that is added to the tolerance value explained in Section 1 5 5 before the relationship checks are performed For example if the tolerance is 10 meters and you specify distance 100 unit meter two objects are considered to have spatial interaction if they are within 110 meters of each other If you specify distance but not unit the unit of measurement associated with the data is assumed Specifies a unit of measurement to be associated with the distance value for example distance 100 unit meter See Section 2 6 for more information about unit of measurement specification If you specify unit you must also specify distance Data type is VARCHAR2 Default unit of measurement associated with the data For geodetic data the default is meters The following example joins the COLA_MARKETS table with itself to find for each geometry all other geometries that have any spatial interaction with it The example uses the definitions and data from Section 2 1 In this example rowid1 and rowid2 correspond to the names of the attributes in the SDO_ROWIDPAIR type definition Note that in the output cola_d the circle in Figure 2 1 interacts only with itself and not with any of
85. contain dimensional information the dim_array is returned The _3D format of this function GDO_LRS CONVERT_TO_STD_DIM_ARRAY_3D is available For information about _3D formats of LRS functions see Section 7 4 For more information about conversion functions see Section 7 5 10 16 22 Oracle Spatial User s Guide and Reference SDO_LRS CONVERT_TO_STD_DIM_ARRAY Examples The following example converts the dimensional array for the LRS_ROUTES table to standard format This example uses the definitions from the example in Section 7 7 SELECT SDO_LRS CONVERT_TO STD DIM ARRAY m diminfo FROM user_sdo_geom metadata m WHERE m table name LRS ROUTES AND m column name ROUTE_GEOMETRY SDO_LRS CONVERT TO STD DIM ARRAY M DIMINFO SDO DIMNAME SDO LB SDO UB SDO TOL SDO_DIM ARRAY SDO DIM ELEMENT X 0 20 005 SDO DIM ELEMENT Y 0 20 00 5 Linear Referencing Subprograms 16 23 SDO_LRS CONVERT_TO_STD_GEOM SDO_LRS CONVERT_TO_STD_GEOM Format Description Parameters Usage Notes Examples SDO_LRS CONVERT_TO_STD_GEOM Irs_geom INSDO_GEOMETRY dim_array IN SDO_DIM_ARRAY RETURN SDO_GEOMETRY Converts an LRS geometric segment to a standard SDO_GEOMETRY line string by removing measure information Irs_geom LRS geometry that contains measure information dim_array Dimensional information array corresponding to 1rs_geonm usually selected from one of the xxx_SDO_GEOM_METADATA views
86. coordinates geography markup language GML converting geometry to 19 35 GEOM_SEGMENT_END_MEASURE function 16 38 GEOM_SEGMENT_END_PT function 16 40 GEOM_SEGMENT_LENGTH function 16 42 GEOM_SEGMENT_START_MEASURE function 16 44 GEOM_SEGMENT_START_PT function 16 46 geometric segment clipping 7 12 concatenating 7 13 aggregate 7 15 14 7 converting overview 7 19 converting subprograms for 16 4 creating subprograms for 16 1 defining 7 11 definition of 7 2 direction 7 3 direction with concatenation 7 14 editing subprograms for 16 1 locating point on 7 17 offsetting 7 16 projecting point onto 7 18 querying subprograms for 16 2 redefining 7 12 scaling 7 15 splitting 7 13 geometry subprograms reference information 13 1 geometry types 1 4 constraining data to 4 4 GET_DIMS method 11 3 SDO_GTYPE 2 7 GET_DIMS method 11 2 GET_GTYPE method 11 3 GET_LRS_DIM method 11 4 GET_MEASURE function 16 48 GET_NEXT_SHAPE_PT function 16 50 GET_NEXT_SHAPE_PT_MEASURE function 16 52 GET_PREV_SHAPE_PT function 16 55 GET_PREV_SHAPE_PT_MEASURE function 16 58 GETNUMELEM function 19 16 GETNUMVERTICES function 19 17 GETVERTICES function 19 18 GML geography markup language converting geometry to 19 35 GTYPE SDO_GTYPE attribute 2 7 constraining data toa geometry type 4 4 GET_DIMS method 11 2 GET_GTYPE method 11 3 GET_LRS_DIM method 11 4 H hardware requirements for spatial applications
87. data This chapter contains the following major sections a Section 7 1 Terms and Concepts a Section 7 2 LRS Data Model a Section 7 3 Indexing of LRS Data Linear Referencing System 7 1 Terms and Concepts a Section 7 4 3D Formats of LRS Functions a Section 7 5 LRS Operations Section 7 6 Tolerance Values with LRS Functions a Section 7 7 Example of LRS Functions 7 1 Terms and Concepts This section explains important terms and concepts related to linear referencing support in Oracle Spatial 7 1 1 Geometric Segments LRS Segments Geometric segments are basic LRS elements in Oracle Spatial A geometric segment can be any of the following a Line string an ordered nonbranching and continuous geometry for example a simple road a Multiline string nonconnected line strings for example a highway with a gap caused by a lake or a bypass road Polygon for example a racetrack or a scenic tour route that starts and ends at the same point A geometric segment must contain at least start and end measures for its start and end points Measures of points of interest such as highway exits on the geometric segments can also be assigned These measures are either assigned by users or derived from existing geometric segments Figure 7 1 shows a geometric segment with four line segments and one arc Points on the geometric segment are represented by triplets x y m where x and y describe the locati
88. described in Section 2 4 This function returns an SDO_GEOMETRY object in which all measure information is removed The _3D format of this function SDO_LRS CONVERT_TO_STD_GEOM_3D is available For information about _3D formats of LRS functions see Section 7 4 For more information about conversion functions see Section 7 5 10 The following example converts the geometric segment representing Route 1 to standard format This example uses the definitions from the example in Section 7 7 SELECT SDO_LRS CONVERT_TO STD GEOM a route_geometry m diminfo FROM lrs routes a user_sdo_geom_metadata m 16 24 Oracle Spatial User s Guide and Reference SDO_LRS CONVERT_TO_STD_GEOM WHERE m table name LRS ROUTES AND m column_ name ROUTE GEOMETRY AND a route_id 1 SDO_LRS CONVERT TO STD GEOM A ROUTE GEOMETRY M DIMINFO SDO_GTYPE SDO_SRID SDO SDO_ GEOMETRY 2002 NULL NULL SDO ELEM INFO ARRAY 1 2 1 SDO ORDINATE ARRAY 2 2 2 4 8 4 12 4 12 10 8 10 5 14 Linear Referencing Subprograms 16 25 SDO_LRS CONVERT_TO_STD_LAYER SDO_LRS CONVERT_TO_STD_LAYER Format Description Parameters Usage Notes SDO_LRS CONVERT_TO_STD_LAYER table_name IN VARCHAR2 column_name IN VARCHAR2 RETURN VARCHAR2 Converts all geometry objects in a column of type SDO_GEOMETRY that is converts a layer from LRS geometric segments with measure information to standard line string geometries without measu
89. dimensional the coordinates for the end point of the first line string are at ordinates 5 and 6 The third triplet indicates that the second subelement line string is made up of a circular arc with ordinates starting at offset 5 The end point of this line string is determined by the starting offset of the next element or the current length of the SDO_ORDINATES array if this is the last element a SDO_ORDINATES 6 10 10 1 14 10 10 14 6 10 Example 2 5 shows a SQL statement that inserts the geometry illustrated in Figure 2 5 into the database Example 2 5 SQL Statement to Insert a Compound Polygon INSERT INTO cola_markets VALUES 12 compound polygon SDO_GEOMETRY 2003 two dimensional polygon NULL NULL SDO ELEM INFO ARRAY 1 1005 2 1 2 1 5 2 2 compound polygon SDO_ORDINATE ARRAY 6 10 10 1 14 10 10 14 6 10 2 3 5 Point Figure 2 6 illustrates a point only geometry at coordinates 12 14 Spatial Data Types and Metadata 2 21 Geometry Examples Figure 2 6 Point Only Geometry 01234 66 7 8 9 10 1112 1314 15 In the SDO_GEOMETRY definition of the geometry illustrated in Figure 2 6 a SDO_GTYPE 2001 The 2 indicates two dimensional and the 1 indicates a single point a SDO_SRID NULL a SDO_POINT SDO_POINT_TYPE 12 14 NULL The SDO_POINT attribute is defined using the SDO_POINT_TYPE object type because this is a point only geometry For more information about the SDO_P
90. example finds geometries that have the CONTAINS relationship with a query window here a rectangle with lower left upper right coordinates 2 2 4 6 The example uses the definitions and data described in Section 2 1 and illustrated in Figure 2 1 In this example only cola_a contains the query window geometry SELECT c mkt_id c name FROM cola_markets c WHERE SDO_ CONTAINS c shape SDO GEOMETRY 2003 NULL NULL SDO_ ELEM INFO ARRAY 1 1003 3 SDO ORDINATE ARRAY 2 2 4 6 TRUE MKT _ID NAME 12 6 Oracle Spatial Users Guide and Reference SDO_COVEREDBY SDO_COVEREDBY Format Description SDO_COVEREDBY geometry1 geometry2 Checks if any geometries in a table have the COVEREDBY topological relationship with a specified geometry Equivalent to specifying the SDO_RELATE operator with mask COVEREDRY See the section on the SDO_RELATE operator in this chapter for information about the operations performed by this operator and for usage requirements Keywords and Parameters Returns Usage Notes Value Description geometryl Specifies a geometry column in a table The column must be spatially indexed Data type is SDO_GEOMETRY geometry2 Specifies either a geometry from a table or a transient instance of a geometry Specified using a bind variable or SDO_GEOMETRY constructor Data type is SDO_GEOMETRY The expression SDO_COVEREDBY geometry1 geometry2 TRUE evaluates to TRUE for object
91. filled 8 10 22 Exit5 22 is measure from start 5 14 27 Ending point Exit6 27 is measure from start 6 threshold value for geometry simplification FROM DUAL SDO_UTIL SIMPLIFY SDO_GEOMETRY 3302 LINESTRING 3DIMENSIONS X Y M 3RDISLINEARR SDO GEOMETRY 3302 NULL NULL SDO ELEM INFO ARRAY 1 2 1 SDO ORDINATE ARRAY 2 2 0 12 4 12 5 14 27 Figure 19 1 shows the result of this example In Figure 19 1 the thick solid black line is the resulting geometry and the thin solid light line between the start and end points is the input geometry Spatial Utility Subprograms 19 33 SDO_UTIL SIMPLIFY Figure 19 1 Simplification of a Geometry Route 1 end Segment Npeten Routel start Related Topics None 19 34 Oracle Spatial User s Guide and Reference SDO_UTIL TO_GMLGEOMETRY SDO_UTIL TO_GMLGEOMETRY Format Description Parameters Usage Notes SDO_UTIL TO_GMLGEOMETRY thegeom IN SDO_GEOMETRY RETURN CLOB 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 thegeom Geometry for which to return the GML fragment This function does not convert circles geometries containing any circular arcs LRS geometries or geometries with an SDO_ETYPE value of 0 type 0 elements it returns an empty CLOB in these cases This function converts the inpu
92. filter checks to see if the MBRs of the candidate objects interact not whether the objects themselves interact The SDO_FILTER operator syntax is as follows SDO_ FILTER geometryl1 SDO GEOMETRY geometry2 SDO GEOMETRY In the preceding syntax geometry is a column of type SDO_GEOMETRY in a table This column must be spatially indexed geometry2 is an object of type SDO_GEOMETRY This object may or may not come from a table If it comes from a table it may or may not be spatially indexed The following examples perform a primary filter operation only with no secondary filter operation They will return all the geometries shown in Figure 4 2 that have an MBR that interacts with the query window The result of the following examples are geometries geom_1 geom_2 and geom_3 Example 4 1 performs a primary filter operation without inserting the query window into a table The window will be indexed in memory and performance will be very good Example 4 1 Primary Filter with a Temporary Query Window SELECT A Feature ID FROM TARGET A WHERE sdo filter A shape SDO geometry 2003 NULL NULL SDO elem info array 1 1003 3 SDO ordinate array x1 y1 x2 y2 TRUE In Example 4 1 x1 y1 and x2 y2 are the lower left and upper right corners of the query window Indexing and Querying Spatial Data 4 11 Querying Spatial Data In Example 4 2 a transient instance of type SDO_GEOMETRY was constructed for the query wind
93. for a query the performance will probably be better than if you specify sdo_batch_size 0 If the sdo_batch_size keyword is specified any sdo_num_res value is ignored Do not specify both keywords Specify the number parameter only if you are using the SDO_NN_DISTANCE ancillary operator in the call to SDO_NN See the information about the SDO_NN_ DISTANCE operator in this chapter Spatial Operators 12 25 SDO_NN If this operator is used with geodetic data the data must be indexed with an R tree spatial index If this operator is used with geodetic data and if the R tree spatial index is created with geodetic false specified you cannot use the unit parameter If two or more objects from geomet ry1 are an equal distance from geomet ry2 any of the objects can be returned on any call to the function For example if item_ a item_b and item_c are nearest to and equally distant from geomet ry2 and if SDO_NUM_RES 2 two of those three objects are returned but they can be any two of the three If the SDO_NN operator uses a partitioned spatial index see Section 4 1 6 the requested number of geometries is returned for each partition that contains candidate rows based on the query criteria For example if you request the 5 nearest restaurants to a point and the spatial index has 4 partitions the operator returns up to 20 5 4 geometries In this case you must use the ROWNUM pseudocolumn here WHERE ROWNUM lt 5 to return the 5 n
94. function 16 108 VALIDATE_GEOMETRY function 13 45 VALIDATE_GEOMETRY_WITH_CONTEXT function 13 47 VALIDATE_LAYER procedure 13 50 VALIDATE_LAYER_WITH_CONTEXT procedure 13 53 VALIDATE_LRS_GEOMETRY function 16 110 VALIDATE_WKT function 15 7 version number Spatial retrieving 1 22 VERTEX_SET_TYPE data type 19 18 VERTEX_TYPE object type 19 18 vertices removing duplicate 19 27 returning geometry coordinates as 19 18 VIEWPORT_TRANSFORM function 15 9 views ALL_SDO_GEOM_METADATA 2 25 ALL_SDO_INDEX_INFO 2 28 ALL_SDO_INDEX_METADATA 2 29 USER_SDO_GEOM_METADATA 2 25 USER_SDO_INDEX_INFO 2 28 USER_SDO_INDEX_METADATA 2 29 W well known text WKT 6 9 validating 15 7 WITHIN_DISTANCE function 13 56 See also SDO_WITHIN_DISTANCE operator WKT See well known text WKT WKTEXT column of MDSYS CS_SRS table 6 9 X XOR SDO_XOR function 13 42 Z Zero SRID value used with SDO_CS VIEWPORT_ TRANSFORM function 15 10 type 0 element 2 23 Index 13 Index 14
95. geometry used with an LRS function must be 3301 7 3 Indexing of LRS Data If LRS data has four dimensions three plus the M dimension and if you need to index all three non measure dimensions you must use a spatial R tree index to index the data and you must specify PARAMETERS sdo_indx_dims 3 in the CREATE INDEX statement to ensure that the first three dimensions are indexed Note however that if you specify an sdo_indx_dims value of 3 or higher the only Spatial operator that can be used on the indexed geometries is SDO_FILTER the other operators described in Chapter 12 cannot be used The default value for the sdo_indx_dims keyword is 2 which would cause only the first two dimensions to be indexed For example if the dimensions are X Y Z and M specify sdo_indx_dims 3 to index the X Y and Z dimensions but not the measure Linear Referencing System 7 9 3D Formats of LRS Functions M dimension Do not include the measure dimension in a spatial index because this causes additional processing overhead and produces no benefit Information about the CREATE INDEX statement and its parameters and keywords is in Chapter 10 7 4 3D Formats of LRS Functions Most LRS functions have formats that end in _3D for example DEFINE_GEOM_ SEGMENT_3D CLIP_GEOM_SEGMENT_3D FIND_MEASURE_3D and LOCATE_PT_3D If a function has a 3D format it is identified in the Usage Notes for the function in Chapter 16 The 3D formats are suppo
96. gt 4 6 Oracle Spatial User s Guide and Reference Creating a Spatial Index PARAMETERS lt spatial params gt lt storage params gt PARTITION lt index partition gt PARAMETERS lt spatial params gt lt storage params gt Queries can operate on partitioned tables to perform the query on only one partition For example SELECT FROM counties PARTITION p1 WHERE lt some spatial predicate gt Querying on a selected partition may speed up the query and also improve overall throughput when multiple queries operate on different partitions concurrently When queries use a partitioned spatial index the semantics meaning or behavior of spatial operators and functions is the same with partitioned and nonpartitioned indexes except in the case of SDO_NN nearest neighbor With SDO_NN the requested number of geometries is returned for each partition that is affected by the query For example if you request the 5 closest restaurants to a point and the spatial index has 4 partitions SDO_NN returns up to 20 5 4 geometries In this case you must use the ROWNUM pseudocolumn here WHERE ROWNUM lt 5 to return the 5 closest restaurants See the description of the SDO_NN operator in Chapter 12 for more information 4 1 7 Exchanging Partitions Including Indexes You can use the ALTER TABLE statement with the EXCHANGE PARTITION INCLUDING INDEXES clause to exchange a spatial table partition and its index parti
97. gt lt gml coordinates decimal cs ts 55 1 8 1 8 6 5 7 5 1 lt gml coordinates gt lt gml LinearRing gt lt gml outerBoundaryIs gt lt gml Polygon gt 19 36 Oracle Spatial User s Guide and Reference SDO_UTIL TO_GMLGEOMETRY The following example returns the GML fragment for the arc densification of the cola_d geometry in the COLA_MARKETS table The example uses the definitions and data from Section 2 1 SET LONG 40000 SELECT XMLTYPE SDO_UTIL TO GMLGEOMETRY SDO_GEOM SDO ARC DENSIFY c shape m diminfo arc_tolerance 0 05 AS GmlGeometry FROM cola markets c user sdo geom metadata m WHERE m table name COLA MARKETS AND m column_name SHAPE AND c name cola d GMLGEOMETRY lt gml Polygon srsName SDO xmlns gml http www opengis net gml gt lt gml outerBou ndaryIs gt lt gml LinearRing gt lt gml coordinates decimal cs ts 58 7 8 7653668 6473018 7 15224093497743 9 4142135623731 7 58578643762691 9 84775906502257 8 234 63313526982 10 9 9 84775906502257 9 76536686473018 9 4142135623731 10 4142135623 731 8 76536686473018 10 8477590650226 8 11 7 23463313526982 10 8477590650226 6 5 8578643762691 10 4142135623731 6 15224093497743 9 76536686473018 6 9 6 152240934 97743 8 23463313526982 6 58578643762691 7 5857864376269 7 23463313526982 7 15224 093497743 8 7 lt gml coordinates gt lt gml LinearRing gt lt gml outerBoundaryIs gt lt gml Pol ygon gt The following example converts an LRS geometry
98. interpreted as follows a SDO_STARTING_ OFFSET Indicates the offset within the SDO_ORDINATES array where the first ordinate for this element is stored Offset values start at 1 and not at 0 Thus the first ordinate for the first element will be at SDO_ GEOMETRY SDO_ORDINATES 1 If there is a second element its first ordinate will be at SDO_GEOMETRY SDO_ORDINATES n where n reflects the position within the SDO_ORDINATE_ARRAY definition for example 19 for the 19th number as in Figure 2 3 later in this chapter Spatial Data Types and Metadata 2 9 SDO_GEOMETRY Object Type a SDO_ETYPE Indicates the type of the element Valid values are shown in Table 2 2 SDO_ETYPE values 1 2 1003 and 2003 are considered simple elements They are defined by a single triplet entry in the SDO_ELEM_INFO array For SDO_ ETYPE values 1003 and 2003 the first digit indicates exterior 1 or interior 2 1003 exterior polygon ring must be specified in counterclockwise order 2003 interior polygon ring must be specified in clockwise order Note The use of 3 as an SDO_ETYPE value for polygon ring elements in a single geometry is discouraged You should specify 3 only if you do not know if the simple polygon is exterior or interior and you should then upgrade the table or layer to the current format using the SDO_MIGRATE TO_CURRENT procedure described in Chapter 17 You cannot mix 1 digit and 4 digit SDO_ETYPE values in a single ge
99. involves a spatial operator In Spatial a spatial join takes place when you compare all geometries of one layer to all geometries of another layer This is unlike a query window which compares a single geometry to all geometries of a layer Spatial joins can be used to answer questions such as Which highways cross national parks The following table structures illustrate how the join would be accomplished for this example PARKS GID VARCHAR2 32 SHAPE SDO GEOMETRY HIGHWAYS GID VARCHAR2 32 SHAPE SDO GEOMETRY To perform a spatial join use the SDO_JOIN operator which is described in Chapter 12 The following spatial join query to list the GID column values of highways and parks where a highway interacts with a park performs a primary filter operation only mask FILTER and thus it returns only approximate results SELECT a gid b gid FROM parks a highways b TABLE SDO JOIN PARKS SHAPE HIGHWAYS SHAPE mask FILTER c WHERE c rowidl a rowid AND c rowid2 b rowid 4 16 Oracle Spatial User s Guide and Reference Querying Spatial Data The following spatial join query requests the same information as in the preceding example but it performs both primary and secondary filter operations mask ANYINTERACT and thus it returns exact results SELECT a gid b gid FROM parks a highways b TABLE SDO_JOIN PARKS SHAPE HIGHWAYS SHAPE mask ANYINTERACT c WHERE c rowidl a rowid AND c ro
100. is you can concatenate all connected geometric segments in a column layer using the SDO_AGGR_LRS_CONCAT spatial aggregate function See the description and example of the SDO_AGGR_LRS_CONCAT spatial aggregate function in Chapter 14 7 5 6 Scaling a Geometric Segment You can create a new geometric segment by performing a linear scaling operation on a geometric segment Figure 7 13 shows the mapping relationship for geometric segment scaling Linear Referencing System 7 15 LRS Operations Figure 7 13 Scaling a Geometric Segment gt Mgnitt Shift Measure Segment Direction New ri Measure a ee s m New End Measure N Start PIT Y E A End Point l M o M M M Mg x Me MJ M s Mshift C am Factor Linear Mapping Relationship In general scaling a geometric segment only involves rearranging measures of the newly created geometric segment However if the scaling factor is negative the order of the shape points needs to be reversed so that measures will increase along the geometric segment s direction which is defined by the order of the shape points A scale operation can perform any combination of the following operations Translating shifting measure information For example add the same value to Ms and Me to get M s and M e a Reversing measure information Let M s Me M e Ms and Mshift 0 Performing simple scaling of measure information Let Mshift
101. is raised if the existing dimensional information for the table is invalid The measure values are assigned based on a start measure of zero and an end measure of the cartographic length If a spatial index already exists on column_name you must delete drop the index before converting the layer and create a new index after converting the layer For information about deleting and creating indexes see the DROP INDEX and CREATE INDEX statements in Chapter 10 16 20 Oracle Spatial Users Guide and Reference SDO_LRS CONVERT_TO_LRS_LAYER Examples The _3D format of this function SDO_LRS CONVERT_TO_LRS_LAYER_3D is available For information about _3D formats of LRS functions see Section 7 4 For more information about conversion functions see Section 7 5 10 The following example converts the geometric segments in the ROUTE_ GEOMETRY column of the LRS_ROUTES table to LRS format This example uses the definitions from the example in Section 7 7 The SELECT statement shows that dimensional information has been added that is SDO_DIM_ ELEMENT M NULL NULL NULL is included in the definition BEGIN IF SDO _LRS CONVERT TO LRS LAYER LRS ROUTES ROUTE GEOMETRY TRUE THEN DBMS _OUTPUT PUT_LINE Conversion from STD LAYER to LRS LAYER succeeded ELSE DBMS_OUTPUT PUT_LINE Conversion from STD LAYER to LRS LAYER failed END IF END Conversion from STD LAYER to LRS LAYER succeeded PL SQL procedure
102. lrs_routes route geometry SDO DIM ARRAY 20X20 grid SDO DIM ELEMENT X 0 20 0 005 SDO DIM ELEMENT Y 0 20 0 005 SDO DIM ELEMENT M 0 20 0 005 Measure dimension dos NULL SRID Create the spatial index CREATE INDEX lrs_routes_idx ON lrs routes route geometry INDEXTYPE IS MDSYS SPATIAL INDEX Test the LRS procedures DECLARE geom_segment SDO GEOMETRY line string SDO_GEOMETRY dim_array SDO DIM ARRAY result_geom_1 SDO GEOMETRY result_geom 2 SDO GEOMETRY result_geom 3 SDO GEOMETRY BEGIN SELECT a route geometry into geom segment FROM lrs_routes a WHERE a route_name Routel SELECT m diminfo into dim array from user_sdo_geom metadata m WHERE m table_name LRS_ROUTES AND m column_name ROUTE_GEOMETRY Define the LRS segment for Routel This will populate any null measures No need to specify start and end measures because they are already defined 7 24 Oracle Spatial Users Guide and Reference Example of LRS Functions in the geometry SDO_LRS DEFINE GEOM SEGMENT geom segment dim array SELECT a route geometry INTO line string FROM lrs routes a WHERE a route_ name Routel Split Routel into two segments SDO_LRS SPLIT_GEOM SEGMENT line string dim_array 5 result_geom_1 result_geom_2 Concatenate the segments that were just split result_geom_3 SDO_LRS CONCATENATE_GEOM SEGMENTS result_geom_1 dim _ array result_geom_2
103. m table name LRS ROUTES AND m column name ROUTE GEOMETRY Set the measure value of point 8 10 to 20 originally 22 result SDO_LRS SET PT MEASURE geom_segment SDO GEOMETRY 3301 NULL NULL SDO_ELEM_INFO ARRAY 1 1 1 SDO ORDINATE ARRAY 8 10 22 20 Display the result DBMS_OUTPUT PUT LINE Returned value result END Returned value TRUE PL SQL procedure successfully completed 16 98 Oracle Spatial User s Guide and Reference SDO_LRS SPLIT_GEOM_SEGMENT SDO_LRS SPLIT_GEOM_SEGMENT Format Description Parameters SDO_LRS SPLIT_GEOM_SEGMENT geom_segment IN SDO_GEOMETRY split_measure IN NUMBER segment_1 OUT SDO_GEOMETRY segment_2 OUT SDO_GEOMETRY SDO_LRS SPLIT_GEOM_SEGMENT geom_segment IN SDO_GEOMETRY dim_array IN SDO_DIM_ARRAY split measure IN NUMBER segment_1 OUT SDO_GEOMETRY segment_2 OUT SDO_GEOMETRY Splits a geometric segment into two geometric segments geom_segment Geometric segment to be split dim_array Dimensional information array corresponding to geom_segment usually selected from one of the xxx_SDO_GEOM_METADATA views described in Section 2 4 split_measure Distance measured from the start point of a geometric segment to the split point segment_1 First geometric segment from the start point of geom_segment to the split point Linear Referencing Subprograms 16 99 SDO_LRS SPLIT_GEOM_SEGMENT Usage Notes Examples
104. name of a spatial index or a partition of a spatial index Keywords and Parameters Prerequisites Usage Notes Examples Related Topics Value Description new_index_name Specifies the new name of the index new_partition_name Specifies the new name of the partition You must have EXECUTE privileges on the index type and its implementation type a The spatial index to be altered is not marked in progress None The following example renames OLDINDEX to NEWINDEX ALTER INDEX oldindex RENAME TO newindex a CREATE INDEX a DROP INDEX SQL Statements for Indexing Spatial Data 10 9 CREATE INDEX CREATE INDEX Syntax CREATE INDEX schema lt index_name gt ON schema lt tableName gt column INDEXTYPE IS MDSYS SPATIAL_INDEX PARAMETERS index_params physical_storage_params NOPARALLEL PARALLEL integer Purpose Creates a spatial index on a column of type SDO_GEOMETRY Keywords and Parameters Value Description INDEX_PARAMS geodetic layer_gtype sdo_indx_dims Determines the characteristics of the spatial index geodetic FALSE allows a non geodetic index to be built on geodetic data but with restrictions FALSE is the only acceptable value for this keyword See the Usage Notes for more information Data type is VARCHAR2 Checks to ensure that all geometries are of a specified geometry type The value must be from the Geometry Type column of Table 2 1 in
105. objects must be defined using 4 digit SDO_GTYPE values explained in Section 2 2 1 The following example returns the perimeters of geometry objects stored in the COLA_MARKETS table The first statement returns the perimeters of all objects the second returns just the perimeter of cola_a The example uses the definitions and data from Section 2 1 Return the perimeters of all cola markets SELECT c name SDO GEOM SDO LENGTH c shape m diminfo FROM cola_markets c user_sdo geom metadata m WHERE m table_name COLA MARKETS AND m column_name SHAPE NAME SDO_GEOM SDO_LENGTH C SHAPE M DIMINFO cola a 20 cola_b 17 1622777 cola c 9 23606798 cola d 12 5663706 Return the perimeter of just cola a SELECT c name SDO GEOM SDO LENGTH c shape m diminfo FROM cola_markets c user _sdo geom metadata m WHERE m table name COLA MARKETS AND m column_name SHAPE AND c name cola_a NAME SDO_GEOM SDO_ LENGTH C SHAPE M DIMINFO cola a 20 None 13 30 Oracle Spatial User s Guide and Reference SDO_GEOM SDO_MAX_MBR_ORDINATE SDO_GEOM SDO_MAX_MBR_ORDINATE Format Description Parameters SDO_GEOM SDO_MAX_MBR_ORDINATE geom IN SDO_GEOMETRY ordinate_pos IN NUMBER RETURN NUMBER or SDO_GEOM SDO_MAX_MBR_ORDINATE geom IN SDO_GEOMETRY dim IN SDO_DIM_ARRAY ordinate_pos IN NUMBER RETURN NUMBER Returns the maximum value for the specified ordinate dimension of the minimum bounding rectangle of a g
106. of Measurement Support 2 1 Simple Example Inserting Indexing and Querying Spatial Data This section presents a simple example of creating a spatial table inserting data creating the spatial index and performing spatial queries It refers to concepts that were explained in Chapter 1 and that will be explained in other sections of this chapter The scenario is a soft drink manufacturer that has identified geographical areas of marketing interest for several products colas The colas could be those produced Spatial Data Types and Metadata 2 1 Simple Example Inserting Indexing and Querying Spatial Data by the company or by its competitors or some combination Each area of interest could represent any user defined criterion for example an area where that cola has the majority market share or where the cola is under competitive pressure or where the cola is believed to have significant growth potential Each area could be a neighborhood in a city or a part of a state province or country Figure 2 1 shows the areas of interest for four colas Figure 2 1 Areas of Interest for the Simple Example Example 2 1 performs the following operations Creates a table COLA_MARKETS to hold the spatial data Inserts rows for four areas of interest cola_a cola_b cola_c cola_d Updates the USER_S5DO_GEOM_METADATA view to reflect the dimensional information for the areas Creates a spatial index COLA_SPATIAL_IDX Performs
107. of knowledge from a database Its techniques include discovering hidden associations between different data attributes classification of data based on some samples and clustering to identify intrinsic patterns For example ODM might enable you to discover that sales prospects with Spatial Analysis and Mining 8 1 Spatial Information and Data Mining Applications high incomes are more likely to watch a particular television program or to respond favorably to a particular advertising solicitation Effective with Oracle Database 10g spatial data can be materialized for inclusion in data mining applications For example ODM might enable you to discover that sales prospects with addresses located in specific areas neighborhoods cities or regions are more likely to watch a particular television program or to respond favorably to a particular advertising solicitation The addresses are geocoded into longitude latitude points and stored in an Oracle Spatial geometry object In many applications data at a specific location is influenced by data in the neighborhood For example the value of a house is largely determined by the value of other houses in the neighborhood This phenomenon is called spatial correlation or neighborhood influence and is discussed further in Section 8 3 The spatial analysis and mining features in Oracle Spatial let you exploit spatial correlation by using the location attributes of data items in several ways f
108. of the xxx_SDO_GEOM_METADATA views described in Section 2 4 16 36 Oracle Spatial User s Guide and Reference SDO_LRS FIND_OFFSET Usage Notes Examples point_dim_array Dimensional information array corresponding to point usually selected from one of the xxx_SDO_GEOM_METADATA views described in Section 2 4 This function calls the SDO_LRS PROJECT_PT function format that includes the offset output parameter it passes in the geometric segment and point information and it returns the SDO_LRS PROJECT_PT offset parameter value Thus to find the offset of a point from a geometric segment you can use either this function or the SDO_LRS PROJECT_PT function with the offset parameter An exception is raised if geom_segment or point has an invalid geometry type or dimensionality or if geom_segment and point are based on different coordinate systems For more information about offsets to a geometric segment see Section 7 1 5 The following example returns the offset of point 9 3 NULL from the geometric segment representing Route 1 This example uses the definitions from the example in Section 7 7 As you can see from Figure 7 20 in Section 7 7 the point at 9 3 NULL is on the right side along the segment and therefore the offset has a negative value as explained in Section 7 1 5 The point at 9 3 NULL is one distance unit away from the point at 9 4 NULL which is on the segment Find the offset of point 9 3 NULL
109. ooo ooo Spatial Operators Procedures and Functions cocecononcononononennrnnnennnracannrnarnrarnanenanararannos 1 18 Spatial Aggregate Functions ooncocncnnnnoniconanononcncncnononononononnnnnonononnona nono nnn ora no rn rn ro ora rnrnrncnioss 1 19 SDOAGGRTYPE Object Type cinco iia iia iris 1 19 Spatial Java Interface ion arta a rats 1 20 A 1 21 MDDATA Schemata a eo nee a He Se ee 1 22 Performance and Tuning Information cccccnnncnnoconanonananinananoncnoncnononcncncncononnononconarnrnnnnnn os 1 22 Spatial Release Version Number cooocionncocnnnnnconacinoninonancnnonanonoronononoro rancio ono ro ran cn nino rancnons 1 22 Spatial Application Hardware Requirement Considerations cesses 1 23 Spatial Error Messages siiis niyta snin oa a its 1 23 Spatial EXA mip lesione idas iaai nea ia aoa a a indeatinen 1 23 Spatial Data Types and Metadata 2 1 2 2 2 2 1 2 2 2 2 2 3 2 2 4 2 2 5 2 2 6 2 3 2 3 1 2 3 2 2 3 3 2 3 4 2 3 5 2 3 6 2 4 2 4 1 2 4 2 2 4 3 2 4 4 2 5 2 5 1 Simple Example Inserting Indexing and Querying Spatial Data eee 2 1 SDO_GEOMETRY Object TyPl ocococccncononiconininoninononanoncnrnnncnonanorornnono coro ronon on ono ron naciona ro ran canso 2 6 SDO 6GTYPE io citas ld a A Rhee Dtos eae 2 7 SDO SRD a a ii beatae e Ei add 2 8 SDO PO N Tintas eaidd rad baie 2 9 SDO ELEM INEO ea 2 9 SDO ORDINATES 30000 cs 2 13 Usage Considerations vrai A A E tt 2 14 Geometry Examples soc sia it A Eo E e te
110. pairs that have the COVEREDBY topological relationship and FALSE otherwise See the Usage Notes for the SDO_RELATE operator in this chapter For an explanation of the topological relationships and the nine intersection model used by Spatial see Section 1 8 Spatial Operators 12 7 SDO_COVEREDBY Examples The following example finds geometries that have the COVEREDBY relationship with a query window here a rectangle with lower left upper right coordinates 1 1 5 8 The example uses the definitions and data described in Section 2 1 and illustrated in Figure 2 1 In this example only cola_a is covered by the query window geometry SELECT c mkt_id c name FROM cola_markets c WHERE SDO_COVEREDBY c shape SDO GEOMETRY 2003 NULL NULL SDO_ ELEM INFO ARRAY 1 1003 3 SDO ORDINATE ARRAY 1 1 5 8 TRUE MKT ID NAME 12 8 Oracle Spatial Users Guide and Reference SDO_COVERS SDO_COVERS Format Description SDO_COVERS geometry1 geometry2 Checks if any geometries in a table have the COVERS topological relationship with a specified geometry Equivalent to specifying the SDO_RELATE operator with mask COVERS See the section on the SDO_RELATE operator in this chapter for information about the operations performed by this operator and for usage requirements Keywords and Parameters Returns Usage Notes Value Description geometryl Specifies a geometry column in a table The column must be
111. quoted string containing a distance value and optionally a unit value See the Usage Notes for an explanation of the format and meaning For a specific geometry this function identifies the geometries in the theme_name table finds their intersection ratio multiplies the specified aggregate using this intersection ratio and aggregates it for the geometry Specifically for all rows of the theme_name table that intersect with the specified geometry it returns the value from the following function aggr type string aggr_col string proportional area of intersection geometry theme_name theme_colname The theme_colname column must have a spatial index defined on it For best performance insert simplified geometries into this column The dst_spec parameter if specified is a quoted string that must contain the distance keyword and that may contain the unit keyword to identify the unit of measurement associated with the distance value For example distance 2 unit km If the unit keyword is specified the value must be an SDO_UNIT value from the MDSYS SDO_DIST_UNITS table for example unit KM If the unit keyword is not specified the unit of measurement associated with the geometry is used See Section 2 6 for more information about unit of measurement specification The following example computes the thematic aggregate for an area with a 3 mile radius around a specified point geometry In this case the total population of the a
112. s business partners In addition you can use geocoded data with other spatial data such as block group postal code and county code for association with demographic information Results of analyses or queries can be presented as maps in addition to tabular formats using third party software integrated with Oracle Spatial For conceptual and usage information about the geocoding capabilities of Oracle Spatial see Chapter 5 For reference information about the MDSYS SDO_GCDR PL SQL package see Chapter 20 Spatial Concepts 1 21 MDDATA Schema 1 13 MDDATA Schema Effective with Oracle Database 10g Spatial creates a user and schema named MDDATA using the following internal SQL statements CREATE USER mddata IDENTIFIED BY mddata GRANT connect resource TO mddata ALTER USER mddata ACCOUNT LOCK It is recommended that you use the MDDATA schema for storing data used by geocoding and routing applications This is the default schema for Oracle software that accesses geocoding and routing data 1 14 Performance and Tuning Information Many factors can affect the performance of Oracle Spatial applications such as the use of optimizer hints to influence the plan for query execution This guide contains some information about performance and tuning where it is relevant to a particular topic For example Section 1 7 2 discusses R tree quality and its possible effect on query performance and Section 1 9 explains why spatial operators pro
113. specification Data type is VARCHAR2 Default unit of measurement associated with the data For geodetic data the default is meters For example unit KM This operator returns the sdo_num_res number of objects from geomet ry1 that are nearest to geomet ry2 in the query In determining how near two geometry objects are the shortest possible distance between any two points on the surface of each object is used The operator is disabled if the table does not have a spatial index or if the index has been built on more than two dimensions The operator must always be used in a WHERE clause and the condition that includes the operator should be an expression of the form SDO_NN arg 1 arg2 lt some_parameter gt TRUE The operator can be used in two ways 12 24 Oracle Spatial User s Guide and Reference SDO_NN Ifall geometries in the layer are candidates use the sdo_num_res keyword to specify the number of geometries returned If any geometries in the table might be nearer than the geometries specified in the WHERE clause use the sdo_batch_size keyword and use the WHERE clause including the ROWNUM pseudocolumn to limit the number of geometries returned Specify the sdo_batch_size keyword if any geometries in the table might be nearer than the geometries specified in the WHERE clause For example assume that a RESTAURANTS table contains different types of restaurants and you want to find the two nearest Ita
114. successfully completed SQL gt SELECT diminfo FROM user_sdo_geom_ metadata WHERE table name LRS ROUTES AND column_name ROUTE_GEOMETRY DIMINFO SDO_DIMNAME SDO LB SDO UB SDO TOLERANCE SDO_ DIM ARRAY SDO DIM ELEMENT X 0 20 005 SDO DIM ELEMENT Y 0 20 00 5 SDO_DIM ELEMENT M NULL NULL NULL Linear Referencing Subprograms 16 21 SDO_LRS CONVERT_TO_STD_DIM_ARRAY SDO_LRS CONVERT_TO_STD_DIM_ARRAY Format Description Parameters Usage Notes SDO_LRS CONVERT_TO_STD_DIM_ARRAY dim_array IN SDO_DIM_ARRAY m_pos IN INTEGER RETURN SDO_DIM_ARRAY Converts an LRS dimensional array to a standard dimensional array by removing the measure dimension dim_array Dimensional information array corresponding to the layer column of geometries to be converted usually selected from one of the xxx_SDO_GEOM_METADATA views described in Section 2 4 m_pos Position of the measure dimension If specified must be 3 or 4 By default the measure dimension is the last dimension in the SDO_DIM_ARRAY This function converts an LRS dimensional array to a standard dimensional array by removing the measure dimension Specifically it removes the SDO_DIM_ ELEMENT object at the end of the current SDO_DIM_ELEMENT objects in the SDO_DIM_ARRAY for the diminfo An exception is raised if m_pos is invalid less than 3 or greater than 4 If dim_array is already a standard dimensional array that is does not
115. that are left empty can be filled later when new data is inserted into the table The value can range from 0 to 50 Data type is NUMBER Default 10 Determines the storage parameters used for creating the spatial index data table A spatial index data table is a regular Oracle table with a prescribed format Not all physical_storage_params that are allowed in the STORAGE clause of a CREATE TABLE statement are supported The following is a list of the supported subset Specifies the tablespace in which the index data table is created Same as TABLESPACE in the STORAGE clause of a CREATE TABLE statement Is the same as INITIAL in the STORAGE clause of a CREATE TABLE statement Is the same as NEXT in the STORAGE clause of a CREATE TABLE statement Is the same as MINEXTENTS in the STORAGE clause of a CREATE TABLE statement Is the same as MAXEXTENTS in the STORAGE clause of a CREATE TABLE statement Is the same as PCTINCREASE in the STORAGE clause of a CREATE TABLE statement Specifies the tablespace for temporary tables used in creating the index Applies only to creating spatial R tree indexes and not to other types of indexes SQL Statements for Indexing Spatial Data 10 11 CREATE INDEX Prerequisites Usage Notes Value Description NOPARALLEL Controls whether serial execution NOPARALLEL or parallel PARALLEL PARALLEL execution is used for the creation of the index and integer for subsequent que
116. the coordinate system Contains Oracle in the supplied table Users can specify any value in any rows that they add The well known text WKT description of the SRS as defined by the Open GIS Consortium For more information see Section 6 4 1 1 An optional SDO_GEOMETRY object that is a polygon with WGS 84 longitude and latitude vertices representing the spheroidal polygon description of the zone of validity for a projected coordinate system Must be null for a geographic or non Earth coordinate system Is null in all supplied rows 6 4 1 1 Well Known Text WKT The WKTEXT column of the MDSYS CS_SRS table contains the well known text WKT description of the SRS as defined by the Open GIS Consortium Coordinate Systems Spatial Reference Systems 6 9 Coordinate Systems Data Structures The following is the WKT EBNF syntax All user defined coordinate systems must strictly comply with this syntax lt coordinate system gt lt horz cs gt lt local cs gt lt horz cS gt lt geographic cs gt lt projected cs gt lt projected cs gt PROJCS lt name gt lt geographic cs gt lt projection gt lt parameter gt lt linear unit gt lt projection gt PROJECTION lt name gt lt parameter gt PARAMETER lt name gt lt number gt lt geographic cs gt GEOGCS lt name gt lt datum gt lt prime meridian gt lt angular unit gt lt datum gt
117. the coordinate system of geomet ry1 for the operation to be performed as described in Section 6 7 1 Unlike with the SDO_GEOM RELATE function DISJOINT and DETERMINE masks are not allowed in the relationship mask with the SDO_RELATE operator This is because SDO_RELATE uses the spatial index to find candidates that may interact and the information to satisfy DISJOINT or DETERMINE is not present in the index Although multiple masks can be combined using the logical Boolean operator OR for example mask inside coveredby better performance may result if the spatial query specifies each mask individually and uses the UNION ALL syntax to 12 40 Oracle Spatial User s Guide and Reference SDO_RELATE Examples combine the results This is due to internal optimizations that Spatial can apply under certain conditions when masks are specified singly rather than grouped within the same SDO_RELATE operator call For example consider the following query using the logical Boolean operator OR to group multiple masks SELECT a gid FROM polygons a query polys B WHERE B gid 1 AND SDO_RELATE A Geometry B Geometry mask inside coveredby TRUE The preceding query may result in better performance if it is expressed as follows using UNION ALL to combine results of multiple SDO_RELATE operator calls each with a single mask SELECT a gid FROM polygons a query polys B WHERE B gid 1 AND SDO_RELATE A Geometry B Geometry mask in
118. the examples in that section When you specify the WKTEXT column entry use valid values from several Spatial reference tables Coordinate Systems Spatial Reference Systems 6 17 Creating a User Defined Coordinate System MDSYS SDO_ANGLE_UNITS see Section 6 4 2 in a UNIT specification for angle units MDSYS SDO_DIST_UNITS see Table 2 6 in Section 2 6 ina UNIT specification for distance units MDSYS SDO_DATUMS see Section 6 4 3 in the DATUM specification or a user defined datum not in MDSYS SDO_DATUMS If you supply a user defined datum the datum name must be different from any datum name in the MDSYS SDO_DATUMS table and the WKT must specify at least the datum name and the spheroid or ellipsoid information listed in Section 6 4 1 1 If the shift rotation and scale parameters are all zero you can omit them however if any of these parameter values are nonzero you must specify them all MDSYS SDO_ELLIPSOIDS see Section 6 4 4 in the SPHEROID specification If you supply a user defined ellipsoid the ellipsoid name must be different from any ellipsoid name in the MDSYS SDO_ELLIPSOIDS table You must also specify the semi major axis and inverse flattening for a user defined ellipsoid MDSYS SDO_PROJECTIONS see Section 6 4 5 in the PROJECTION specification The name in each PARAMETER specification must be one of the following depending on the projection that you use Standard_Parallel_1 in decimal degrees
119. the other geometries SELECT a name b name FROM cola_markets a cola_markets b TABLE SDO_JOIN COLA MARKETS SHAPE COLA MARKETS SHAPE mask ANYINTERACT Cc Spatial Operators 12 21 SDO_JOIN WHERE c rowidl a rowid AND c rowid2 b rowid ORDER BY a name NAME NAME cola_a cola_a cola_a cola_b cola_a cola c cola _b cola a cola _b cola _b cola _b cola c cola _c cola a cola c cola _b cola c c la cola d cola d 10 rows selected Related Topics SDO_ RELATE 12 22 Oracle Spatial User s Guide and Reference SDO_NN SDO_NN Format SDO_NN geometry1 geometry2 param number Description Uses the spatial index to identify the nearest neighbors for a geometry Keywords and Parameters Value Description geometry1 Specifies a geometry column in a table The column must be spatially indexed Data type is SDO_GEOMETRY geometry2 Specifies either a geometry from a table or a transient instance of a geometry The nearest neighbor or neighbors to geomet ry2 will be returned from geometryl geomet ry2 is specified using a bind variable or SDO_ GEOMETRY constructor Data type is SDO_GEOMETRY param Determines the behavior of the operator The available keywords are listed in Table 12 4 If you do not specify this parameter the operator returns all rows in increasing distance order from geomet ry2 Data type is VARCHAR2 number If the SDO_NN_DISTANCE ancillary operator is
120. the procedure otherwise the procedure appends rows to the existing data in the table The result table contains one row for each invalid geometry A row is not written if a geometry is valid except as follows a If commit_interval is not specified or if the commit_interval value is greater than the number of geometries in the layer and no invalid geometries are found a single row with a RESULT value of DONE is written If commit_interval is specified and if no invalid geometries are found between an internal commit and the previous internal commit or start of validation for the first internal commit a single row with the primary key of the last geometry validated and a RESULT value of DONE is written If there have been no invalid geometries since the last internal commit operation this row replaces the previous row that had a result of DONE In each row for an invalid geometry the PKEY_COLUMN column contains the primary key value of the row containing the invalid geometry and the RESULT column contains an Oracle error message number You can then look up this error message to determine the cause of the failure Geometry Subprograms 13 51 SDO_GEOM VALIDATE_LAYER This procedure performs the following checks on each geometry in the layer geom_column All type consistency and geometry consistency checks that are performed by the SDO_GEOM VALIDATE_GEOMETRY function see the Usage Notes for that function a If4 dig
121. there is no index named COLA_NAME_IDX in the example in Section 2 1 For detailed information about using optimizer hints see Oracle Database Performance Tuning Guide The following example finds the two objects from the SHAPE column in the COLA_ MARKETS table that are nearest to a specified point 10 7 The example uses the definitions and data from Section 2 1 SELECT INDEX c cola_spatial_idx c mkt_id c name FROM cola_markets c WHERE SDO NN c shape sdo_geometry 2001 NULL sdo point type 10 7 NULL NULL NULL sdo num res 2 TRUE MKT_ID NAME 2 cola b 4 cola d The following example uses the sdo_batch_size keyword to find the two objects ROWNUM lt 2 with a NAME value less than cola_d from the SHAPE column in the COLA_MARKETS table that are nearest to a specified point 10 7 The value of 3 for sdo_batch_size represents a best guess at the number of nearest geometries that need to be evaluated before the WHERE clause condition is satisfied The example uses the definitions and data from Section 2 1 SELECT INDEX c cola_spatial_idx c mkt_id c name FROM cola_markets c WHERE SDO NN c shape sdo_geometry 2001 NULL sdo point type 10 7 NULL NULL NULL sdo batch _size 3 TRUE AND c name lt cola_d AND ROWNUM lt 2 MKT_ID NAME See also the more complex SDO_NN examples in Section C 3 Spatial Operators 12 27 SDO_NN Related Topics a SDO_NN_DISTANCE 12 28 Oracle Sp
122. three LRS points are shown on the first segment Linear Referencing System 7 7 LRS Data Model Figure 7 6 Linear Feature Geometric Segments and LRS Points Linear Feature l l l l l l 1 m1 Iy2 pl 3 ae A To o L LRS Points M3 I a l I Se A Direction rot Direction l Direction I l l a a O Geometric Segment 1 Geometric Segment 2 Geometric Segment 3 7 2 LRS Data Model The Oracle Spatial LRS data model incorporates measure information into its geometry representation at the point level The measure information is directly integrated into the Oracle Spatial model To accomplish this an additional measure dimension must be added to the Oracle Spatial metadata Oracle Spatial LRS support affects the Spatial metadata and data the geometries Example 7 1 shows how a measure dimension can be added to two dimensional geometries in the Spatial metadata The measure dimension must be the last element of the SDO_DIM_ARRAY in a spatial object definition shown in bold in Example 7 1 Example 7 1 Including LRS Measure Dimension in Spatial Metadata INSERT INTO user _sdo geom metadata VALUES LRS ROUTES GEOMETRY SDO DIM ARRAY SDO DIM ELEMENT X 0 100 0 005 SDO DIM ELEMENT Y 0 100 0 005 SDO DIM ELEMENT M 0 100 0 005 NULL After adding the new measure dimension geometries with measure information such as geometric segments and LRS points can be represented An example of cre
123. to be considered and the buffers around cola_band cola_d overlap in this case You can therefore take either of two approaches in selecting an SDO_TOLERANCE value for a layer a The value can reflect the desired level of precision in queries for distances between objects For example if two non geodetic geometries 0 8 units apart should be considered as separated specify a small SDO_TOLERANCE value such as 0 05 or smaller The value can reflect the precision of the values associated with geometries in the layer For example if all geometries in a non geodetic layer are defined using integers and if two objects 0 8 units apart should not be considered as separated an SDO_TOLERANCE value of 0 5 is appropriate To have greater precision in any query you must override the default by specifying the tolerance parameter With non geodetic data the guideline to follow for most instances of the second case precision of the values of the geometries in the layer is take the highest level of precision in the geometry definitions and use 5 at the next level as the SDO_ TOLERANCE value For example if geometries are defined using integers as in the simplified example in Section 2 1 the appropriate value is 0 5 however if geometries are defined using numbers up to four decimal positions for example 31 2587 the appropriate value is 0 00005 Spatial Concepts 1 9 Query Model Note This guideline should not be used if the ge
124. updates Deferred update status is set by specifying index_status deferred with the ALTER INDEX statement as described in Chapter 10 If the indexes are not compatible an error is raised The table data is exchanged but the indexes are not exchanged and the indexes are marked as failed To use the indexes you must rebuild them 4 1 8 Export and Import Considerations with Spatial Indexes and Data If you use the Export utility to export tables with spatial data the behavior of the operation depends on whether or not the spatial data has been spatially indexed If the spatial data has not been spatially indexed the table data is exported However you must update the USER_SDO_GEOM_METADATA view with the appropriate information on the target system a Ifthe spatial data has been spatially indexed the table data is exported the appropriate information is inserted into the USER_SDO_GEOM_METADATA view on the target system and the spatial index is built on the target system However if the insertion into the USER_SDO_GEOM_METADATA view fails for example if there is already a USER_SDO_GEOM_METADATA entry for the spatial layer the spatial index is not built If you use the Import utility to import data that has been spatially indexed if the index on the exported data was created with a TABLESPACE clause and if the specified tablespace does not exist in the database at import time the index is not built This is different from the
125. with an SDO_ETYPE value that is not 0 The nonzero element should be an approximation of the unsupported geometry and therefore it must have both a An SDO_ETYPE value associated with a geometry type supported by Spatial a AnSDO_INTERPRETATION value that is valid for the SDO_ETYPE value see Table 2 2 The SDO_INTERPRETATION value for the type 0 element can be any numeric value and applications are responsible for determining the validity and significance of the value Spatial Data Types and Metadata 2 23 Geometry Examples The nonzero element is indexed by Spatial and it will be returned by the spatial index The SDO_GTYPE value for a geometry containing a type 0 element must be set to the value for the geometry type of the nonzero element Figure 2 7 shows a geometry with two elements a curve unsupported geometry and a rectangle the nonzero element that approximates the curve The curve looks like the letter S and the rectangle is represented by the dashed line Figure 2 7 Geometry with Type 0 Zero Element x7 y7 0 In the example shown in Figure 2 7 The SDO_GTYPE value for the geometry is 2003 for a two dimensional polygon The SDO_ELEM_INFO array contains two triplets for this compound line string For example the triplets might be 1 0 57 11 1003 3 That is Ordinate Starting Offset Element Type Interpretation SDO_STARTING_OFFSET SDO_ETYPE SDO_INTERPRETATION 1 0 57 11 1003 3
126. 0 For examples of these operations see the Usage Notes and Examples for the SDO_ LRS SCALE_GEOM_SEGMENT function in Chapter 16 7 5 7 Offsetting a Geometric Segment You can create a new geometric segment by performing an offsetting operation on a geometric segment Figure 7 14 shows the mapping relationship for geometric segment offsetting 7 16 Oracle Spatial Users Guide and Reference LRS Operations Figure 7 14 Offsetting a Geometric Segment Direction of the Segments Or Resulting Segment Positive Offset for example 5 Start Measure Negative Offset End Measure for example 5 In the offsetting operation shown in Figure 7 14 the resulting geometric segment is offset by 5 units from the specified start and end measures of the original segment For more information see the Usage Notes and Examples for the SDO_ LRS OFFSET_GEOM_SEGMENT function in Chapter 16 7 5 8 Locating a Point on a Geometric Segment You can find the position of a point described by a measure and an offset on a geometric segment see Figure 7 15 Figure 7 15 Locating a Point Along a Segment with a Measure and an Offset Segment Direction Start Point 2 Point Positive Offset End Point Negative Offset Measure Pt Offset Positive if to left along segment direction lo Point to Be Located negative if to right along segment direction There is always a unique location with a specific measure on a geometric segment
127. 051765 39 109 050095 39 366699 109 050697 39 4977 109 050499 39 6605 109 050156 40 222694 109 047577 40 653641 109 0494 41 000702 109 2313 41 00 2102 109 534233 40 998184 110 40 997398 110 047768 40 997696 110 5 40 994801 111 045982 40 998013 111 045815 41 251774 111 045097 41 579899 111 045944 4 2 001633 111 506493 41 999588 112 108742 41 997677 112 16317 41 996784 112 1 72562 41 996643 112 192184 42 001244 113 41 998314 113 875 41 988091 114 040 871 41 993805 lt gml coordinates gt lt gml LinearRing gt lt gml outerBoundarylIs gt lt gml Polygon gt lt gml geometryProperty gt lt State gt Related Topics None Spatial Utility Subprograms 19 41 SDO_UTIL TO_GMLGEOMETRY 19 42 Oracle Spatial User s Guide and Reference 20 Geocoding Subprograms The MDSYS SDO_GCDR package contains subprograms for geocoding address data To use the subprograms in this chapter you must understand the conceptual and usage information about geocoding in Chapter 5 Table 20 1 lists the geocoding subprograms Table 20 1 Subprograms for Geocoding Address Data Subprogram Description SDO_GCDR GEOCODE Geocodes an unformatted address and returns an SDO_GEOR_ADDR object SDO_GCDR GEOCODE_ALL Geocodes all addresses associated with an unformatted address and returns the result as an SDO_ADDR_ ARRAY object SDO_GCDR GEOCODE_AS_ Geocodes an unformatted address and returns an GEOMETRY
128. 0897618 1 00002076 5 00904194 6 99997941 5 00784065 7 00450033 5 00454112 7 00781357 5 00002479 7 009034 999975166 7 00903403 995458814 7 00781359 992159303 7 00450036 990958058 6 99997944 991023822 1 00002 073 Geometry Subprograms 13 15 SDO_GEOM SDO_BUFFER Related Topics a SDO_GEOM SDO_UNION a SDO_GEOM SDO_INTERSECTION a SDO_GEOM SDO_XOR 13 16 Oracle Spatial User s Guide and Reference SDO_GEOM SDO_CENTROID SDO_GEOM SDO_CENTROID Format Description Parameters SDO_GEOM SDO_CENTROID geom1 IN SDO_GEOMETRY dim1 IN SDO_DIM_ARRAY RETURN SDO_GEOMETRY or SDO_GEOM SDO_CENTROID geom1 IN SDO_GEOMETRY tol IN NUMBER RETURN SDO_GEOMETRY Returns a point geometry that is the centroid of a polygon multipolygon point or point cluster The centroid is also known as the center of gravity For an input geometry consisting of multiple objects the result is weighted by the area of each polygon in the geometry objects If the geometry objects are a mixture of polygons and points the points are not used in the calculation of the centroid If the geometry objects are all points the points have equal weight geom1 Geometry object dim1 Dimensional information array corresponding to geom usually selected from one of the xxx_SDO_GEOM_METADATA views described in Section 2 4 tol Tolerance value see Section 1 5 5 Geometry Subprograms 13 17 SDO_GEOM SDO_CENTROID U
129. 1 IN SDO_GEOMETRY mask IN VARCHAR2 geom2 IN SDO_GEOMETRY tol IN NUMBER RETURN VARCHAR2 Description Examines two geometry objects to determine their spatial relationship Parameters geom1 Geometry object dim1 Dimensional information array corresponding to geom1 usually selected from one of the xxx_SDO_GEOM_METADATA views described in Section 2 4 mask Specifies a list of relationships to check See the list of keywords in the Usage Notes 13 4 Oracle Spatial Users Guide and Reference SDO_GEOM RELATE Usage Notes geom2 Geometry object dim2 Dimensional information array corresponding to geom2 usually selected from one of the xxx_SDO_GEOM_METADATA views described in Section 2 4 tol Tolerance value see Section 1 5 5 For better performance use the SDO_RELATE operator or one of its convenience operator formats all described in Chapter 12 instead of the SDO_GEOM RELATE function unless you need to use the function For example the DETERMINE mask keyword does not apply with the SDO_RELATE operator For more information about performance considerations with operators and functions see Section 1 9 The SDO_GEOM RELATE function can return the following types of answers If you pass a mask listing one or more relationships the function returns the name of the relationship if it is true for the pair of geometries If all relationships are false the procedure returns FALSE If you pass the DET
130. 13 53 WITHIN_DISTANCE 13 56 SDO_GEOMETRY object type 2 6 embedding in user defined type 9 1 9 6 in function based indexes 9 3 methods 11 1 14 1 SDO_GTYPE attribute 2 7 constraining data to a geometry type 4 4 GET_DIMS method 11 2 GET_GTYPE method 11 3 GET_LRS_DIM method 11 4 SDO_INDEX_TABLE entry in index metadata views 2 32 SDO_INDX_DIMS keyword 7 9 10 2 SDO_INSIDE operator 12 17 SDO_INTERPRETATION value 2 11 SDO_INTERSECTION function 13 26 SDO_JOIN operator 12 19 SDO_KEYWORDARRAY data type 5 9 SDO_LENGTH function 13 29 SDO_LRS package CLIP_GEOM_SEGMENT 16 6 CONCATENATE_GEOM_SEGMENTS 16 8 CONNECTED_GEOM_SEGMENTS 16 11 CONVERT_TO_LRS_DIM_ARRAY 16 13 CONVERT_TO_LRS_GEOM 16 16 CONVERT_TO_LRS_LAYER 16 19 CONVERT_TO_STD_DIM_ARRAY 16 22 CONVERT_TO_STD_GEOM 16 24 CONVERT_TO_STD_LAYER 16 26 DEFINE_GEOM_SEGMENT 16 28 DYNAMIC_SEGMENT 16 31 FIND_LRS_DIM_POS 16 33 FIND_MEASURE 16 34 FIND_OFFSET 16 36 Index 9 GEOM_SEGMENT_END_MEASURE 16 38 GEOM_SEGMENT_END_PT 16 40 GEOM_SEGMENT_LENGTH 16 42 GEOM_SEGMENT_START_MEASURE 16 44 GEOM_SEGMENT_START_PT 16 46 GET_MEASURE 16 48 GET_NEXT_SHAPE PT 16 50 GET_NEXT_SHAPE_PT_MEASURE 16 52 GET_PREV_SHAPE_PT 16 55 GET_PREV_SHAPE_PT_MEASURE 16 58 IS_GEOM_SEGMENT_DEFINED 16 61 IS_MEASURE_DECREASING 16 63 IS_MEASURE_INCREASING 16 65 IS SHAPE_PT_MEASURE 16 67 LOCATE_PT 16 69 MEASURE_RANGE 16 72 MEASURE_TO_PERCENTAGE 16 74 OFFSET_GEOM_SEGMENT 16
131. 2 RETURN SDO_GEOMETRY Description Transforms a geometry representation using a coordinate system specified by SRID or name 15 2 Oracle Spatial Users Guide and Reference SDO_CS TRANSFORM Parameters Usage Notes Examples geom Geometry whose representation is to be transformed using another coordinate system The input geometry must have a valid non null SRID that is a value in the SRID column of the MDSYS CS_SRS table described in Section 6 4 1 dim Dimensional information array corresponding to geom usually selected from one of the xxx_SDO_GEOM_METADATA views described in Section 2 4 to_srid The SRID of the coordinate system to be used for the transformation It must be a value in the SRID column of the MDSYS CS_SRS table described in Section 6 4 1 to_srname The name of the coordinate system to be used for the transformation It must be a value specified exactly in the CS_NAME column of the MDSYS CS_SRS table described in Section 6 4 1 Transformation can be done only between two different georeferenced coordinate systems or between two different local coordinate systems An exception is raised if geom to_srid orto_srname is invalid For geom to be valid for this function its definition must include an SRID value matching a value in the SRID column of the MDSYS CS_SRS table described in Section 6 4 1 The following example transforms the cola_c geometry to a representation that uses SRID va
132. 2 14 Recta ai nl aia 2 14 Polygon with a Hole siiniosuti aimara 2 16 Compound Line SN geiis eeaeee aer ar ren e a E r ES 2 18 Compound Polydor E E a a EEES 2 19 ROU D EA N EEEE OEE tt 2 21 Type D Zero Elem entices cis ceased vacate an an i e E EEEE ENE 2 23 Geometry Metadata ViewS eiretier iieiea i a EOE E A DS 2 25 TABLE NAME cennin naa n o aria t aea ea nares toe 2 26 COE UMN NAM Escondida 2 26 DIMIN FO A A deca bes 2 27 A eka ea eek a ee ete ieee ee MAR ais 2 28 Spatial Index Related Structures eeesssesseseseesesssesesesessesescsesssesesescssesseeseeeeeee 2 28 Spatial Index Views 20 ide tada dees 2 28 vi 2 5 1 1 xxx_SDO_INDEX_INFO ViewS ou eececsessesecseeeseecsecseeeesecsecaseeeaecassesessaeaees 2 28 2 5 1 2 xxx_SDO_INDEX_METADATA VieWS ccccccccsccsessecssessecsceeseseeeseeeeeeeeseeseeees 2 29 2 5 2 Spatial Index Table Definition iii id 2 32 2 5 3 R Tree Index Sequence Object aviso in 2 32 2 6 Unit of Measurement Supports nihisi aa a n Eaa 2 32 Loading Spatial Data 3 1 Blk Loading airea Tia Saa e ida 3 1 3 1 1 Bulk Loading SDO_GEOMETRY Objects ooonconiciconinocnnnonincnnoroconnonconororoncinnororiononinnos 3 1 3 1 2 Bulk Loading Point Only Data in SDO_GEOMETRY Objects ocicicinonicicinonaniononos 3 3 3 2 Transactional Insert Operations Using SOL onococincnicicininnncnnanonononanonanonononcnnananncncnconanncncnoos 3 4 Indexing and Querying Spatial Data 4 1 Creating Spatial dei Bile EE iad tore A E dd be
133. 2 4 SQL Statement to Insert a Compound Line String 0 0 ce tes ceneneneesesneteeeeenens 2 19 2 5 SQL Statement to Insert a Compound Polygon ooccocecononcncononenennrncnrencnnncnennnrnrnnnnnnnanoss 2 21 2 6 SQL Statement to Insert a Point Only Geometry emononconcnononcnnnnnennncnnnennnncnnnerararnnnnnnnnraso 2 22 2 7 Query for Point Only Geometry Based on a Coordinate Value 0 eee 2 23 2 8 SQL Statement to Insert a Geometry with a Type 0 Element cccccceeseteseeeenene 2 25 3 1 Control File for a Bulk Load of Cola Market Geometries ccc eee teense 3 1 3 2 Control File for a Bulk Load of Polygo0NS oococinnnnnnnnnnnonccnannnnconcncnanoncncncnnarornoncncnnanncncnnos 3 3 3 3 Control File for a Bulk Load of Point Only Data oicicicicinicininicannnnaninoninononanoncncncaranacncnnos 3 4 3 4 Procedure to Perform a Transactional Insert Operation ccecccccesceseeesteteseeeeteseeeeeens 3 5 3 5 PL SQL Block Invoking a Procedure to Insert a GeoMetiY oocncncnconnnonicininonaninnncnnanonncnnos 3 5 4 1 Primary Filter with a Temporary Query Wind OW cccccc cece teense teteneeeeeees 4 11 4 2 Primary Filter with a Transient Instance of the Query WindOW eme 4 12 4 3 Primary Filter with a Stored Query WindoW iocicicicnnoninnononencanononionencnnananan cn nnnnanonananonos 4 12 4 4 Secondary Filter Using a Temporary Query Window mneconenenonconcnncnncnncnnrcanncncnrarnnnos 4 13 4 5 Secondary Filter Using a Stored Query Window meccneconc
134. 20 20 50 20 10 30 30 30 30 40 10 40 10 30 50 30 20 10 10 10 20 Dr o a ci 6 by By C53 Fyn Fy By BaN AS GmlGeometry FROM DUAL GMLGEOMETRY Rectangle geodetic SELECT TO CHAR SDO_UTIL TO GMLGEOMETRY sdo geometry 2003 8307 null sdo elem_ info array 1 1003 5 sdo ordinate array 10 10 10 10 20 10 20 10 AS GmlGeometry FROM DUAL GMLGEOMETRY lt gml Box srsName SDO 8307 xmlns gml http ww opengis net gml gt lt gml coordina tes decimal cs ts gt 10 1 10 1 20 1 20 1 lt gml coordinates gt lt gml Box gt Polygon with holes SELECT TO CHAR SDO_UTIL TO GMLGEOMETRY sdo geometry 2003 262152 null sdo elem info array 1 1003 3 5 2003 1 13 2003 1 sdo ordinate array 10 10 10 20 40 50 41 10 30 30 30 30 30 30 40 10 40 10 40 10 30 30 30 30 5 5 5 6 6 6 6 5 5 5 19 38 Oracle Spatial User s Guide and Reference SDO_UTIL TO_GMLGEOMETRY AS GmlGeometry FROM DUAL GMLGEOMETRY lt gml Polygon srsName SDO 262152 xmlns gml http www opengis net gml gt lt gml ou terBoundaryls gt lt gml LinearRing gt lt gml coordinates decimal cs ts gt 10 1 10 2 40 5 10 2 40 5 41 1 10 1 41 1 10 1 10 2 lt gml coordinates gt lt gml LinearRin g gt lt gml outerBoundarylIs gt lt gml innerBoundaryIs gt lt gml LinearRing gt lt gml coordinates de cimal cs ts gt 30 3 30 3 30 3 40 1 40 1 40 1 30 3 30 3 lt gml coordinate s gt lt gm
135. 3 443 kilometers Update and insert geometries into table to display later UPDATE lrs routes a SET a route geometry geom segment WHERE a route id 1 END Display the redefined segment with all measures converted SELECT a route_geometry FROM lrs routes a WHERE a route_id 1 Clip a piece of Routel SELECT SDO _LRS CLIP_GEOM SEGMENT route geometry 5 10 FROM lrs_ routes WHERE route id 1 Point 9 3 NULL is off the road should return 9 4 9 SELECT SDO_LRS PROJECT PT route_geometry SDO GEOMETRY 3301 NULL NULL SDO ELEM INFO ARRAY 1 1 1 SDO_ORDINATE ARRAY 9 3 NULL FROM lrs_ routes WHERE route_id 1 Return the measure of the projected point SELECT SDO LRS GET MEASURE SDO_LRS PROJECT_PT a route geometry m diminfo SDO GEOMETRY 3301 NULL NULL SDO_ELEM_INFO ARRAY 1 1 1 SDO ORDINATE ARRAY 9 3 NULL m diminfo FROM lrs_ routes a user sdo geom metadata m WHERE m table name LRS ROUTES AND a route_id 1 Linear Referencing System 7 27 Example of LRS Functions Is point 9 3 NULL a valid LRS point Should return TRUE SELECT SDO LRS VALID LRS PT SDO GEOMETRY 3301 NULL NULL SDO_ELEM_INFO ARRAY 1 1 1 SDO_ORDINATE ARRAY 9 3 NULL m diminfo FROM lrs routes a user_sdo_geom_metadata m WHERE m table name LRS ROUTES AND a route_id 1 Locate the point on Routel at measure 9 offset 0 SELECT SDO_LRS LOCATE PT route ge
136. 4 you can insert data by using a PL SQL block such as the one in Example 3 5 which loads a geometry into the variable named geom and then invokes the INSERT_GEOM procedure to insert that geometry Example 3 5 PL SQL Block Invoking a Procedure to Insert a Geometry DECLARE geom SDO geometry SDO geometry 2003 null null SDO elem info array 1 1003 3 SDO ordinate array 109 37 102 40 BEGIN INSERT _GEOM geom COMMIT END For additional examples with various geometry types see the following Rectangle Example 2 2 in Section 2 3 1 a Polygon with a hole Example 2 3 in Section 2 3 2 Compound polygon Example 2 5 in Section 2 3 4 Loading Spatial Data 3 5 Transactional Insert Operations Using SQL Point Example 2 6 and Example 2 7 in Section 2 3 5 a Type 0 zero element Example 2 8 in Section 2 3 6 If a spatial index already exists on the spatial geometry table and you need to insert many rows you can improve the performance of the insert operations by deferring spatial indexing inserting the rows and synchronizing the index as explained in Section 4 1 3 3 6 Oracle Spatial User s Guide and Reference 4 Indexing and Querying Spatial Data After you have loaded spatial data discussed in Chapter 3 you should create a spatial index on it to enable efficient query performance using the data This chapter describes how to Create a spatial index see Section 4 1 Query spatial
137. 5 14 27 Linear Referencing Subprograms 16 41 SDO_LRS GEOM_SEGMENT_LENGTH SDO_LRS GEOM_SEGMENT_LENGTH Format Description Parameters Usage Notes Examples SDO_LRS GEOM_SEGMENT_LENGTH geom_segment IN SDO_GEOMETRY dim_array IN SDO_DIM_ARRAY RETURN NUMBER Returns the length of a geometric segment geom_segment Geometric segment whose length is to be calculated dim_array Dimensional information array corresponding to geom_segment usually selected from one of the xxx_SDO_GEOM_METADATA views described in Section 2 4 This function returns the length of geom_segment The length is the geometric length which is not the same as the total of the measure unit values To determine how long a segment is in terms of measure units subtract the result of an SDO_ LRS GEOM_SEGMENT_START_MEASURE operation from the result of an SDO_ LRS GEOM_SEGMENT_END_MEASURE operation An exception is raised if geom_segment has an invalid geometry type or dimensionality The _3D format of this function SDO_LRS GEOM_SEGMENT_LENGTH_3D is available For information about _3D formats of LRS functions see Section 7 4 The following example returns the length of the geometric segment representing Route 1 This example uses the definitions from the example in Section 7 7 16 42 Oracle Spatial Users Guide and Reference SDO_LRS GEOM_SEGMENT_LENGTH SELECT SDO LRS GEOM SEGMENT LENGTH route geometry FROM lrs_ routes WHER
138. 7 13 7 14 7 15 7 16 7 17 7 18 7 19 7 20 8 1 13 1 13 2 Ge metrie TY Pes ARA A A A AI 1 5 Query Mod l nyireni p ene eia Ae asera aani adria Ia o citas 1 11 MBR Enclosing Geometry ensisi aaisa 1 13 R Tree Hierarchical Index on MBRS cccccccesseesscesssesseceseceseecsaeeessceseeessecesseceseecseeeseenes 1 13 The Nine Intersection Model cccccscsssssscsscessesscessesscesesecesseeseeeseeseecsecssesaeeaseeseeeseeseesees 1 15 Topological Relationships nen inio cocida ed io dde 1 17 Distance Buffers for Points Lines and Polygons ococcoconcenoncncnnnnnnanncnrnnenncnnnnnarnrnnnnnrarass 1 17 Tolerance in an Aggregate Union Operation occocininononnnnrnnncncannnnennrorannenanananoanarnranannnnanso 1 20 Areas of Interest for the Simple Example cccccccccsesssesesseneteseecesesesesneneseseseesenesesnans 2 2 Rectan cles ci slo AE AEA AE EA sg Beaeasa RARO Dia Soe eet 2 15 Polygon with a Hole sie tonic tdi dat 2 16 Compound Line Sting cia a ye aaa 2 18 Compound Poly Giusti i castes E E A a E ET E 2 20 Point Only Geometry en niaaa raaa eth A ana ies 2 22 Geometry with Type 0 Zero Element s ssnsssssestssssssttssssettssstrsttsnteestenteestesnteestesntentes 2 24 Geometries with MBRS ccccccssscsssecsscecsscessecseeesseceececsssecsecesesesaeceseessetesseceaaeceseeesaeeeseeses 4 10 Layer witha Query WINdOoWssreseresindio niiden dnan ii R ERA a 4 10 Geometric SEMEN issie sesi ias eoria it ii ii dietai iae atts 7 3 Des
139. 76 PERCENTAGE_TO_MEASURE 16 79 PROJECT_PT 16 81 REDEFINE_GEOM_SEGMENT 16 84 RESET_MEASURE 16 87 REVERSE_GEOMETRY 16 89 REVERSE_MEASURE 16 91 SCALE_GEOM_SEGMENT 16 93 SET_PT_MEASURE 16 96 SPLIT_GEOM_SEGMENT 16 99 TRANSLATE_MEASURE 16 102 VALID_GEOM_SEGMENT 16 104 VALID_LRS_PT 16 106 VALID_MEASURE 16 108 VALIDATE_LRS_GEOMETRY 16 110 SDO_MAX_MBR_ORDINATE function 13 31 SDO_MBR function 13 33 SDO_MIGRATE package TO_CURRENT 17 2 SDO_MIN_MBR_ORDINATE function 13 35 SDO_NN operator 12 23 optimizer hints 12 26 SDO_NN_DISTANCE ancillary operator 12 29 SDO_ON operator 12 31 SDO_ORDINATE_ARRAY type 2 6 SDO_ORDINATES attribute 2 13 SDO_OVERLAPBDYDISJOINT operator 12 33 SDO_OVERLAPBDYINTERSECT operator 12 35 Index 10 SDO_OVERLAPS operator 12 37 SDO_POINT attribute 2 9 SDO_POINT_TYPE object type 2 6 SDO_POINTONSURFACE function 13 37 SDO_PROJECTIONS table 6 16 SDO_REGAGGR object type 21 6 21 22 SDO_REGAGGRSET object type 21 6 21 22 SDO_REGION object type 21 25 SDO_REGIONSET object type 21 25 SDO_RELATE operator 12 39 SDO_ROWIDPAIR object type 12 20 SDO_ROWIDSET data type 12 20 SDO_RTREE_SEQ NAME sequence object 2 32 SDO_SAM package 21 1 AGGREGATES FOR GEOMETRY 21 3 AGGREGATES _FOR_LAYER 21 5 BIN_GEOMETRY 21 8 BIN_LAYER 21 10 COLOCATED_REFERENCE_FEATURES 21 12 SIMPLIFY_GEOMETRY 21 15 SIMPLIFY_LAYER 21 17 SPATIAL_CLUSTERS 21 19 TILED_AGGREGATES 21 21 TILED_BINS 21 24
140. 8 5 14 43 443 16 86 Oracle Spatial User s Guide and Reference SDO_LRS RESET_MEASURE SDO_LRS RESET_MEASURE Format Description Parameters Usage Notes Examples SDO_LRS RESET_MEASURE geom_segment IN OUT SDO_GEOMETRY dim_array IN SDO_DIM_ARRAY Sets all measures of a geometric segment including the start and end measures to null values overriding any previously assigned measures geom_segment Cartographic representation of a linear feature dim_array Dimensional information array corresponding to geom_segment usually selected from one of the xxx_SDO_GEOM_METADATA views described in Section 2 4 An exception is raised if geom_segment has an invalid geometry type or dimensionality The following example sets all measures of a geometric segment to null values This example uses the definitions from the example in Section 7 7 First display the original segment then redefine SELECT a route_geometry FROM lrs routes a WHERE a route_id 1 ROUTE GEOMETRY SDO_GTYPE SDO SRID SDO POINT X Y Z SDO_ELEM_INFO SDO ORDIN SDO_ GEOMETRY 3302 NULL NULL SDO ELEM INFO ARRAY 1 2 1 SDO ORDINATE ARRAY 2 2 0 2 4 2 8 4 8 12 4 12 12 10 18 8 10 22 5 14 27 Reset geometric segment measures Linear Referencing Subprograms 16 87 SDO_LRS RESET_MEASURE DECLARE geom_segment SDO GEOMETRY BEGIN SELECT a route geometry into geom segment FROM lrs routes a W
141. 806 394 723053 394 723053 SDO GEOMETRY 2 003 8307 NULL SDO ELEM INFO ARRAY 1 1003 1 SDO ORDINATE ARRAY 122 4019 37 8052 122 4027 37 8055 122 4031 37 806 122 4012 37 8052 122 4019 3 7 8052 50 rows selected 21 16 Oracle Spatial User s Guide and Reference SDO_SAM SIMPLIFY_LAYER SDO_SAM SIMPLIFY_LAYER Format Description Parameters SDO_SAM SIMPLIFY_LAYER theme_tablename IN VARCHAR2 theme_colname IN VARCHAR2 smpl_geom_colname IN VARCHAR2 commit_interval IN NUMBER DEFAULT 10 pct_area_change_limit IN NUMBER DEFAULT 2 Simplifies a geometry layer theme_tablename Name of the table containing the geometry layer to be simplified theme_colname Column in theme_tablename of type SDO_GEOMETRY containing the geometries to be simplified smpl_geom_colname Column in theme_tablename of type SDO_GEOMETRY into which the simplified geometries are to be placed by this function commit_interval Number of geometries to simplify before Spatial performs an internal commit operation If commit_interval is not specified a commit is performed after every 10 simplification operations pct_area_change_limit The percentage of area changed to be used for each simplification iteration as explained in the Usage Notes for the SDO_SAM SIMPLIFY_GEOMETRY function Spatial Analysis and Mining Subprograms 21 17 SDO_SAM SIMPLIFY_LAYER Usage Notes This procedure simplifies all geometries in a l
142. 8307 and whose well known name is Longitude Latitude WGS 84 This is probably the most widely used coordinate system and it is the one used for global positioning system GPS devices The geometries are then transformed using the coordinate system whose SRID is 8199 and whose well known name is Longitude Latitude Arc 1950 Example 6 4 uses the geometries illustrated in Figure 2 1 in Section 2 1 except that cola_disa rectangle here a square instead of a circle because arcs are not supported with geodetic coordinate systems Coordinate Systems Spatial Reference Systems 6 21 Example of Coordinate System Transformation Example 6 4 does the following Creates a table COLA_MARKETS_CS to hold the spatial data Inserts rows for four areas of interest cola_a cola_b cola_c cola _d using the SDO_SRID value 8307 Updates the USER_SDO_GEOM_METADATA view to reflect the dimension of the areas using the SDO_SRID value 8307 Creates a spatial index COLA_SPATIAL_IDX_CS Performs some transformation operations single geometry and entire layer Example 6 5 includes the output of the SELECT statements in Example 6 4 Example 6 4 Simplified Example of Coordinate System Transformation Create a table for cola soft drink markets in a given geography such as city or state CREATE TABLE cola markets_cs mkt_id NUMBER PRIMARY KEY name VARCHAR2 32 shape SDO GEOMETRY Note about areas of interest cola_
143. 831547 75 23735 38 849014 75 260498 38 875 75 305908 38 914673 75 316 399 38 930309 75 317284 38 93676 75 312851 38 945576 75 312859 38 945618 75 31205 38 967804 75 31778 38 986012 75 341431 39 021233 75 369606 39 041359 7 5 389229 39 051422 75 40181 39 06702 75 401306 39 097713 75 411369 39 148029 75 407845 39 175201 75 396271 39 187778 75 39225 39 203377 75 40181 39 23104 9 75 402817 39 253189 75 409355 39 264759 75 434006 39 290424 75 439041 39 3 13065 75 453125 39 317093 75 457657 39 326653 75 469231 39 330677 75 486336 39 341743 75 494888 39 354324 75 504448 39 357346 75 51284 39 366291 75 5129 24 39 366482 75 523773 39 392052 75 538651 39 415707 75 56749 39 436436 75 5 9137 39 463696 75 592941 39 471806 75 590019 39 488026 75 587311 39 496136 7 5 5774 39 508076 75 554192 39 506947 75 528442 39 498005 75 530373 39 510303 75 527145 39 531326 75 52803 39 535168 75 53437 39 540592 75 519386 39 55528 6 75 512291 39 567505 75 515587 39 580639 75 528046 39 584 75 538269 39 5935 67 75 554016 39 601727 75 560143 39 622578 75 556602 39 6348 75 549599 39 63 7699 75 542397 39 645901 75 535507 39 647099 75 514999 39 668499 75 507523 3 9 69685 75 496597 39 701302 75 488914 39 714722 75 477997 39 714901 75 47550 2 39 733501 75 467972 39 746975 75 463707 39 761101 75 448494 39 773857 75 4 38301 39 783298 75 405701 39 796101 75 415405 39 801678 75 454102 39 820202 75 499199 39 833199 75 539703 39
144. A reference system for the unique definition for the location of a point in n dimensional space Also called a spatial reference system See also Cartesian coordinate system geodetic coordinates projected coordinates and local coordinates cover A geometric relationship in which one object encompasses another and the inner object touches the boundary of the outer object in one or more places data dictionary A repository of information about data A data dictionary stores relational information on all objects in a database datum transformation See transformation dimensional data Data that has one or more dimensional components and is described by multiple values direction The direction of an LRS geometric segment is indicated from the start point of the geometric segment to the end point Measures of points on a geometric segment always increase along the direction of the geometric segment disjoint A geometric relationship where two objects do not interact in any way Two disjoint objects do not share any element or piece of their geometry element A basic building block point line string or polygon of a geometry equal A geometric relationship in which two objects are considered to represent the same geometric figure The two objects must be composed of the same number of points however the ordering of the points defining the two objects geometries may differ clockwise or counterclockwise extent A rec
145. AL See the section on the SDO_RELATE operator in this chapter for information about the operations performed by this operator and for usage requirements Keywords and Parameters Value Description geometryl Specifies a geometry column in a table The column must be spatially indexed Data type is SDO_GEOMETRY geometry2 Specifies either a geometry from a table or a transient instance of a geometry Specified using a bind variable or SDO_GEOMETRY constructor Data type is SDO_GEOMETRY Returns The expression SDO_EQUAL geometry1 geometry2 TRUE evaluates to TRUE for object pairs that have the EQUAL topological relationship and FALSE otherwise Usage Notes See the Usage Notes for the SDO_RELATE operator in this chapter For an explanation of the topological relationships and the nine intersection model used by Spatial see Section 1 8 Spatial Operators 12 11 SDO_EQUAL Examples The following example finds geometries that have the EQUAL relationship with a query window here a rectangle with lower left upper right coordinates 1 1 5 7 The example uses the definitions and data described in Section 2 1 and illustrated in Figure 2 1 In this example cola_a and only cola_a has the same boundary and interior as the query window geometry SELECT c mkt_id c name FROM cola_markets c WHERE SDO_ EQUAL c shape SDO GEOMETRY 2003 NULL NULL SDO_ ELEM INFO ARRAY 1 1003 3 SDO_ORDINATE ARRAY 1 1 5 7
146. AT SDO_AGGR_MBR SDO_AGGR_UNION Returns a geometry object that is the centroid center of gravity of the specified geometry objects Returns a geometry that concatenates the specified line or multiline geometries Returns a geometry object that is the convex hull of the specified geometry objects Returns an LRS geometry object that concatenates specified LRS geometry objects Returns the minimum bounding rectangle of the specified geometry objects Returns a geometry object that is the topological union OR operation of the specified geometry objects See the usage information about spatial aggregate functions in Section 1 10 Most of these aggregate functions accept a parameter of type SDOAGGRTYPE which is described in Section 1 10 1 Spatial Aggregate Functions 14 1 SDO_AGGR_CENTROID SDO_AGGR_CENTROID Format Description Parameters Usage Notes SDO_AGGR_CENTROID AggregateGeometry SDOAGGRTYPE RETURN SDO_GEOMETRY Returns a geometry object that is the centroid center of gravity of the specified geometry objects AggregateGeometry An object of type SDOAGGRTYPE see Section 1 10 1 that specifies the geometry column and dimensional array The behavior of the function depends on whether the geometry objects are all polygons all points or a mixture of polygons and points a Ifthe geometry objects are all polygons the centroid of all the objects is returned Ifthe geometry ob
147. ATA views which are described in Section 2 5 1 For more information and guidelines relating to R tree quality and its possible effect on query performance see Section 1 7 2 Spatial Tuning Subprograms 18 11 SDO_TUNE QUALITY_DEGRADATION Examples The following example returns the quality degradation for the COLA_SPATIAL_ IDX index In this example the quality has not degraded at all and therefore the degradation is 1 that is the I O operations of the index portion of queries will typically take the same time using the current index as using the original or previous index SELECT SDO TUNE QUALITY DEGRADATION SCOTT COLA SPATIAL IDX FROM DUAL SDO_TUNE QUALITY DEGRADATION SCOTT COLA SPATIAL IDX 18 12 Oracle Spatial User s Guide and Reference 19 Spatial Utility Subprograms This chapter contains descriptions of the spatial utility subprograms shown in Table 19 1 Table 19 1 Spatial Utility Subprograms Subprogram Description SDO_UTIL APPEND SDO_UTIL CIRCLE_POLYGON SDO_UTIL CONCAT_LINES SDO_UTIL CONVERT_UNIT SDO_U SDO_U SDO_U SDO_U SDO_U SDO_U TIL ELLIPSE_POLYGON TIL EXTRACT TIL GETNUMELEM TIL GETNUMVERTICES TIL GETVERTICES TIL INITIALIZE _ INDEXES_FOR_TTS SDO_UTIL POINT_AT_BEARING Appends one geometry to another geometry to create a new geometry Returns the polygon geometry that approximates and is covered by a specified circle Concatenates two l
148. ATE TABLE statement Controls whether serial execution NOPARALLEL or parallel PARALLEL execution is used for subsequent queries and DML operations that use the index For parallel execution you can specify an integer value of degree of parallelism See the Usage Notes for the CREATE INDEX statement for guidelines and restrictions that apply to the use of the PARALLEL keyword Default NOPARALLEL If PARALLEL is specified without an integer value the Oracle database calculates the optimum degree of parallelism a You must have EXECUTE privileges on the index type and its implementation type SQL Statements for Indexing Spatial Data 10 3 ALTER INDEX Usage Notes Examples The spatial index to be altered is not marked in progress This statement is used to change the parameters of an existing index This is the only way you can add or build multiple indexes on the same column The index_status keyword lets you defer modifications to the spatial index when geometries are inserted updated or deleted in a spatial table Deferring the index modifications allows the geometry insert update and delete operations to be completed sooner and it can reduce concurrency issues with R tree indexes if multiple sessions are inserting rows into the spatial table While index modifications are being deferred spatial functions and procedures will work correctly with the current table data however spatial operator based queries migh
149. ATE_GEOMETRY SDO_GEOM VALIDATE_GEOMETRY Format Description Parameters SDO_GEOM VALIDATE_GEOMETRY theGeometry IN SDO_GEOMETRY theDiminfo IN SDO_DIM_ARRAY RETURN VARCHAR2 or SDO_GEOM VALIDATE_GEOMETRY theGeometry INSDO_GEOMETRY tolerance IN NUMBER RETURN VARCHAR2 Performs a consistency check for valid geometry types The function checks the representation of the geometry from the tables against the element definitions Note The VALIDATE_GEOMETRY function was deprecated in a previous release of Spatial The current Spatial release is the last supported release for this function and it will not be included in future releases of this guide You should use instead the SDO_ GEOM VALIDATE_GEOMETRY_WITH_CONTEXT function theGeometry Geometry object theDimInfo Dimensional information array corresponding to theGeomet ry usually selected from one of the xxx_SDO_GEOM_METADATA views described in Section 2 4 Geometry Subprograms 13 45 SDO_GEOM VALIDATE_GEOMETRY tolerance Tolerance value see Section 1 5 5 Usage Notes This deprecated function performs the same checks as the SDO_ GEOM VALIDATE_GEOMETRY_WITH_CONTEXT function however if the geometry is not valid it does not return information about the context If the geometry is not valid this function returns one of the following a An Oracle error message number based on the specific reason the geometry is invalid FALSE if t
150. BLE_NAME 2 4 1 TABLE_NAME The TABLE_NAME column contains the name of a feature table such as COLA _ MARKETS that has a column of type SDO_GEOMETRY The table name is stored in the spatial metadata views in all uppercase characters The table name cannot contain spaces or mixed case letters in a quoted string when inserted into the USER _SDO_GEOM_METADATA view and it cannot be in a quoted string when used in a query unless it is in all uppercase characters The spatial feature table cannot be an index organized table if you plan to create a spatial index on the spatial column 2 4 2 COLUMN_NAME The COLUMN_NAME column contains the name of the column of type SDO_ GEOMETRY For the COLA_MARKETS table this column is called SHAPE The column name is stored in the spatial metadata views in all uppercase characters 2 26 Oracle Spatial User s Guide and Reference Geometry Metadata Views The column name cannot contain spaces or mixed case letters in a quoted string when inserted into the USER_SDO_GEOM_METADATA view and it cannot be ina quoted string when used in a query unless it is in all uppercase characters 2 4 3 DIMINFO The DIMINFO column is a varying length array of an object type ordered by dimension and has one entry for each dimension The SDO_DIM_ARRAY type is defined as follows Create Type SDO DIM ARRAY as VARRAY 4 of SDO DIM ELEMENT The SDO_DIM_ELEMENT type is defined as Create Type SDO DIM ELEME
151. CAT SDO_AGGR_LRS_CONCAT Format Description Parameters Usage Notes Examples SDO_AGGR_LRS_CONCAT AggregateGeometry SDOAGGRTYPE RETURN SDO_GEOMETRY Returns an LRS geometry that concatenates specified LRS geometries AggregateGeometry An object of type SDOAGGRTYPE see Section 1 10 1 that specifies the geometry column and dimensional array This function performs an aggregate concatenation of any number of LRS geometries If you want to control the order in which the geometries are concatenated you must use a subquery with the NO_MERGE optimizer hint and the ORDER BY clause See the examples The direction of the resulting segment is the same as the direction of the first geometry in the concatenation A 3D format of this function GDO_AGGR_LRS_CONCAT_3D is available For information about 3D formats of LRS functions see Section 7 4 For information about the Spatial linear referencing system see Chapter 7 The following example adds an LRS geometry to the LRS_ROUTES table and then performs two queries that concatenate the LRS geometries in the table The first query does not control the order of concatenation and the second query controls the order of concatenation Notice the difference in direction of the two segments the segment resulting from the second query has decreasing measure values Spatial Aggregate Functions 14 7 SDO_AGGR_LRS_CONCAT because the first segment in the concatenation
152. DIM_ARRAY start_measure IN NUMBER end_measure IN NUMBER RETURN SDO_GEOMETRY or SDO_LRS CONVERT_TO_LRS_GEOM standard_geom IN SDO_GEOMETRY m_pos IN INTEGER start_measure IN NUMBER end_measure IN NUMBER RETURN SDO_GEOMETRY Description Converts a standard SDO_GEOMETRY line string to an LRS geometric segment by adding measure information 16 16 Oracle Spatial User s Guide and Reference SDO_LRS CONVERT_TO_LRS_GEOM Parameters Usage Notes Examples standard_geom Line string geometry that does not contain measure information dim_array Dimensional information array corresponding to standard_geom usually selected from one of the xxx_SDO_GEOM_METADATA views described in Section 2 4 m_pos Position of the measure dimension If specified must be 3 or 4 By default the measure dimension is the last dimension in the SDO_DIM_ARRAY start_measure Distance measured from the start point of a geometric segment to the start point of the linear feature The default is 0 end_measure Distance measured from the end point of a geometric segment to the start point of the linear feature The default is the cartographic length for example 75 if the cartographic length is 75 and the unit of measure is miles This function returns an LRS geometric segment with measure information with measure information provided for all shape points An exception is raised if standard_geom has an invalid geometry type or dime
153. Data cola_markets shape SDO_DIM_ ARRAY 20X20 grid SDO DIM ELEMENT X 0 20 0 005 SDO DIM ELEMENT Y 0 20 0 005 E NULL SRID CREATE INDEX cola_spatial_idx ON cola_markets shape INDEXTYPE IS MDSYS SPATIAL INDEX Preceding statement created an R tree index Return the topological intersection of two geometries SELECT SDO GEOM SDO INTERSECTION c_a shape c_c shape 0 005 FROM cola_markets c_a cola markets c_c WHERE c_a name cola_a AND c_c name cola_c Do two geometries have any spatial relationship SELECT SDO_GEOM RELATE c_b shape anyinteract c_d shape 0 005 FROM cola_markets c_b cola markets c_d WHERE c_b name cola_b AND c_d name cola d Return the areas of all cola markets SELECT name SDO_GEOM SDO AREA shape 0 005 FROM cola_markets Return the area of just cola_a SELECT c name SDO_GEOM SDO AREA c shape 0 005 FROM cola markets c WHERE c name cola_a Return the distance between two geometries SELECT SDO GEOM SDO DISTANCE c_b shape c_d shape 0 005 FROM cola_markets c_b cola markets c d WHERE c_b name cola b AND c_d name cola d Is a geometry valid SELECT c name SDO GEOM VALIDATE GEOMETRY WITH CONTEXT c shape 0 005 FROM cola_markets c WHERE c name cola c Spatial Data Types and Metadata 2 5 SDO_GEOMETRY Object Type Is a layer valid First create the results table CREATE TABLE val_ results s
154. E route_id 1 SDO_LRS GEOM SEGMENT LENGTH ROUTE GEOMETRY Linear Referencing Subprograms 16 43 SDO_LRS GEOM_SEGMENT_START_MEASURE SDO_LRS GEOM_SEGMENT_START_MEASURE Format Description Parameters Usage Notes Examples SDO_LRS GEOM_SEGMENT_START_MEASURE geom_segment IN SDO_GEOMETRY dim_array IN SDO_DIM_ARRAY RETURN NUMBER Returns the start measure of a geometric segment geom_segment Geometric segment whose start measure is to be returned dim_array Dimensional information array corresponding to geom_segment usually selected from one of the xxx_SDO_GEOM_METADATA views described in Section 2 4 This function returns the start measure of geom_segment An exception is raised if geom_segment has an invalid geometry type or dimensionality The _3D format of this function SDO_LRS GEOM_SEGMENT_START_MEASURE_ 3D is available For information about _3D formats of LRS functions see Section 7 4 The following example returns the start measure of the geometric segment representing Route 1 This example uses the definitions from the example in Section 7 7 SELECT SDO LRS GEOM SEGMENT START MEASURE route geometry FROM lrs_ routes WHERE route_id 1 16 44 Oracle Spatial User s Guide and Reference SDO_LRS GEOM_SEGMENT_START_MEASURE SDO_LRS GEOM SEGMENT START MEASURE ROUTE GEOMETRY Linear Referencing Subprograms 16 45 SDO_LRS GEOM_SEGMENT_START_PT SDO_LRS GEOM_SEGMENT_STAR
155. ECT from MDSYS SDO DIST UNITS SELECT from MDSYS SDO AREA UNITS 2 34 Oracle Spatial User s Guide and Reference 3 Loading Spatial Data This chapter describes how to load spatial data into a database including storing the data in a table with a column of type SDO_GEOMETRY After you have loaded spatial data you can create a spatial index for it and perform queries on it as described in Chapter 4 The process of loading data can be classified into two categories a Bulk loading of data see Section 3 1 This process is used to load large volumes of data into the database and uses the SOL Loader utility to load the data Transactional insert operations see Section 3 2 This process is used to insert relatively small amounts of data into the database using the INSERT statement in SQL 3 1 Bulk Loading Bulk loading can import large amounts of ASCII data into an Oracle database Bulk loading is accomplished with the SOL Loader utility For information about SQL Loader see Oracle Database Utilities 3 1 1 Bulk Loading SDO_GEOMETRY Objects Example 3 1 is the SQL Loader control file for loading four geometries When this control file is used with SQL Loader it loads the same cola market geometries that are inserted using SQL statements in Example 2 1 in Section 2 1 Example 3 1 Control File for a Bulk Load of Cola Market Geometries LOAD DATA Loading Spatial Data 3 1 Bulk Loading INFILE TRUNCATE
156. EOMETRY from the opposite direction because both segments to be concatenated must have the same direction Scale the measure information without performing a shift SDO_LRS REDEFINE_GEOM_ for example to change the measures from miles to SEGMENT kilometers An exception is raised if geom_segment has an invalid geometry type or dimensionality or if start measure or end_measure is out of range For more information about scaling a geometric segment see Section 7 5 6 16 94 Oracle Spatial User s Guide and Reference SDO_LRS SCALE_GEOM_SEGMENT Examples The following examples illustrate some SCALE_GEOM_ELEMENT uses These examples use the definitions from the example in Section 7 7 Shift by 5 for example 5 mile segment added before original start SELECT SDO_LRS SCALE GEOM SEGMENT a route_geometry m diminfo 0 27 5 FROM lrs_ routes a user sdo geom metadata m WHERE m table name LRS ROUTES AND m column_name ROUTE GEOMETRY AND a route_id 1 SDO_LRS SCALE GEOM SEGMENT A ROUTE GEOMETRY M DIMINFO 0 27 5 SDO_GTYPE SDO SRI SDO GEOMETRY 3002 NULL NULL SDO ELEM INFO ARRAY 1 2 1 SDO ORDINATE ARRAY 2 2 5 2 4 7 8 4 13 12 4 17 12 10 23 8 10 27 5 14 32 Convert mile measures to kilometers 27 1 609 43 443 SELECT SDO_LRS SCALE GEOM SEGMENT route geometry 0 43 443 0 FROM lrs_ routes WHERE route_id 1 SDO_LRS SCALE GEOM SEGMENT ROUTE GEOMETRY 0 43 443 0 SDO_G
157. EOMETRY 2003 NULL NULL SDO ELEM INFO ARRAY 1 1003 3 SDO ORDINATE_ ARRAY 1 1 10 11 Related Topics SDO_AGGR_MBR aggregate function in Chapter 14 SDO_TUNE AVERAGE_MBR procedure 18 8 Oracle Spatial Users Guide and Reference SDO_TUNE MIX_INFO SDO_TUNE MIX_INFO Format Description Parameters SDO_TUNE MIX_INFO table_name IN VARCHAR2 column_name IN VARCHAR2 total_geom OUT INTEGER point_geom OUT INTEGER curve_geom OUT INTEGER poly_geom OUT INTEGER complex_geom OUT INTEGER Provides information about each geometry type stored in a column of type SDO_ GEOMETRY table_name Spatial geometry table column_name Geometry object column for which the geometry type information is to be calculated total_geom Total number of geometry objects point_geom Number of point geometry objects curve_geom Number of curve string geometry objects Spatial Tuning Subprograms 18 9 SDO_TUNE MIX_INFO poly_geom Number of polygon geometry objects complex_geom Number of complex geometry objects Usage Notes This procedure calculates geometry type information for the table It calculates the total number of geometries as well as the number of point curve string polygon and complex geometries Examples The following example displays information about the mix of geometry objects in the SHAPE column of the COLA_MARKETS table CALL SDO_TUNE MIX_INFO COLA MARKETS SHAPE Total
158. ERMINE keyword in mask the function returns the one relationship keyword that best matches the geometries Ifyou pass the ANYINTERACT keyword in mask the function returns TRUE if the two geometries are not disjoint The following mask relationships can be tested a ANYINTERACT Returns TRUE if the objects are not disjoint CONTAINS Returns CONTAINS if the second object is entirely within the first object and the object boundaries do not touch otherwise returns FALSE a COVEREDBY Returns COVEREDBY if the first object is entirely within the second object and the object boundaries touch at one or more points otherwise returns FALSE COVERS Returns COVERS if the second object is entirely within the first object and the boundaries touch in one or more places otherwise returns FALSE a DISJOINT Returns DISJOINT if the objects have no common boundary or interior points otherwise returns FALSE Geometry Subprograms 13 5 SDO_GEOM RELATE EQUAL Returns EQUAL if the objects share every point of their boundaries and interior including any holes in the objects otherwise returns FALSE a INSIDE Returns INSIDE if the first object is entirely within the second object and the object boundaries do not touch otherwise returns FALSE a ON Returns ON if the boundary and interior of a line the first object is completely on the boundary of a polygon the second object otherwise returns FALSE a OVERLAPBDYDISJOINT
159. ERSE_GEOMETRY a route_geometry m diminfo FROM lrs_ routes a user sdo geom metadata m WHERE m table name LRS ROUTES AND m column_name ROUTE GEOMETRY AND a route_ id 1 SDO_LRS REVERSE GEOMETRY A ROUTE GEOMETRY M DIMINFO SDO_GTYPE SDO SRID SDO PO SDO GEOMETRY 3302 NULL NULL SDO ELEM INFO ARRAY 1 2 1 SDO ORDINATE ARRAY 5 14 27 8 10 22 12 10 18 12 4 12 8 4 8 2 4 2 2 2 0 Note in the returned segment that the M values measures now go in descending order from 27 to 0 and the segment start and end points have the opposite X and Y values as in the original segment 5 14 and 2 2 here as opposed to 2 2 and 5 14 in the original 16 90 Oracle Spatial Users Guide and Reference SDO_LRS REVERSE_MEASURE SDO_LRS REVERSE_MEASURE Format Description Parameters Usage Notes SDO_LRS REVERSE_MEASURE geom_segment IN SDO_GEOMETRY dim_array IN SDO_DIM_ARRAY RETURN SDO_GEOMETRY Returns a new geometric segment by reversing the measure values but not the direction of the original geometric segment geom_segment Cartographic representation of a linear feature dim_array Dimensional information array corresponding to geom_segment usually selected from one of the xxx_SDO_GEOM_METADATA views described in Section 2 4 This function a Reverses the measure values of geom_segment That is the start measure of geom_segment is the end measure of the returned geometric segment
160. ETRY column represent polygons Example 3 2 shows the control file for loading the data Example 3 2 Control File for a Bulk Load of Polygons LOAD DATA INFILE TRUNCATE CONTINUEIF NEXT 1 1 INTO TABLE POLY 4PT FIELDS TERMINATED BY TRAILING NULLCOLS GEOM COLUMN OBJECT SDO_GTYPE SDO_ELEM_ INFO elements SDO_ORDINATES ordinates begindata 1 2003 1 1003 1 122 4215 37 7862 122 4215 37 7862 2 2003 1 1003 1 122 4019 37 8052 122 4019 37 8052 3 2003 1 1003 1 122 426 37 803 122 426 37 803 GID INTEGER EXTERNAL INTEGER EXTERNAL VARRAY TERMINATED BY JA FLOAT EXTERNAL VARRAY TERMINATED BY FLOAT EXTERNAL 122 422 37 7869 122 421 37 789 122 42 37 7866 122 4027 37 8055 122 4031 37 806 122 4012 37 8052 122 4242 37 8053 122 42355 37 8044 122 4235 37 8025 3 1 2 Bulk Loading Point Only Data in SDO_GEOMETRY Objects Example 3 3 shows a control file for loading a table with point data Loading Spatial Data 3 3 Transactional Insert Operations Using SQL Example 3 3 Control File for a Bulk Load of Point Only Data LOAD DATA INFILE TRUNCATE CONTINUEIF NEXT 1 1 INTO TABLE POINT FIELDS TERMINATED BY TRAILING NULLCOLS GID INTEGER EXTERNAL GEOMETRY COLUMN OBJECT SDO_GTYPE INTEGER EXTERNAL SDO POINT COLUMN OBJECT X FLOAT EXTERNAL Y FLOAT EXTERNAL
161. ETRY nrerin e eea EKA eaka AS AT aA 21 3 SDO_SAM AGGREGATES_FOR_LAYER 1 cece riii E NEEE EEEE 21 5 SDOLSAM BIN GEOMETRY repe a peines eea ea eieae E NEEE AEE e 21 8 SDO SAM BIN LAYER sidsssececsesesccstesdessisecsossneciute sbsad spose osan E ARo rran suanseyetdss sDeavedbasabevaseied 21 10 SDO_SAM COLOCATED_REFERENCE_ FEATURES c ccc cece cece erences 21 12 SDO_SAM SIMPLIFY_GEOMETRY cccssssssessssssesevsesssesessesssesensesesseceseneesevssessesenenes 21 15 SDO SAM SIMPLIFY LAYER ocios 21 17 SDO SAM SPATIAL CLUSTERS ocios e E E E E a a ein 21 19 SDO_SAM TILED_AGGREGATES mista nea ei aT naci n 21 21 SDO SAM TILED BINS cimil allioli elitista ida 21 24 Part Ill Supplementary Information A Installation Compatibility and Upgrade A 1 Upgrading URS Data sie onient sect nan ta eth Sed Stes A vec cea eset A 1 B Oracle Locator C Complex Spatial Queries Examples C 1 AICA SA AAA oe AE E E NETE C 1 xiv C 2 C 3 C 4 Glossary Index SDO_WITHIN_DISTANCE Examples oococicicnnoninnonncnnnnncncoronnnnininnoranconiononancn no nnnnonanan oneroso SDO_NN Examples SDO_AGGR_UNION Example XV List of Examples 2 1 Simple Example Inserting Indexing and Querying Spatial Data onicinininininmm 2 3 2 2 SQL Statement to Insert a Rectangle cesses ssestensesescecesssesneneeseseeeeesseeenans 2 15 2 3 SQL Statement to Insert a Polygon with a Holle cccccceseseseeteeeeeeesesneneneseseseeeesesnans 2 17
162. FILTER to perform only a primary filter operation If querytype is not specified both primary and secondary filter operations are performed default Data type is VARCHAR2 12 46 Oracle Spatial User s Guide and Reference SDO_WITHIN_DISTANCE Returns Usage Notes Examples Value Description unit Specifies the unit of measurement a quoted string with unit and an SDO_UNIT value from the MDSYS SDO_DIST_UNITS table for example unit KM See Section 2 6 for more information about unit of measurement specification Data type is NUMBER Default unit of measurement associated with the data For geodetic data the default is meters The expression SDO_WITHIN_DISTANCE argl arg2 arg3 TRUE evaluates to TRUE for object pairs that are within the specified distance and FALSE otherwise Distance between two extended objects nonpoint objects such as lines and polygons is defined as the minimum distance between these two objects The distance between two adjacent polygons is zero If this operator is used with geodetic data the data must be indexed with an R tree spatial index If this operator is used with geodetic data and if the R tree spatial index is created with geodetic false specified you cannot use the unit parameter The operator is disabled if the table does not have a spatial index or if the index has been built on more than two dimensions The operator must always be used ina WHERE clause and the co
163. Figure 13 5 SDO_GEOM SDO_XOR eom1 g geom2 If the function format with tol is used all geometry objects must be defined using 4 digit SDO_GTYPE values explained in Section 2 2 1 An exception is raised if geom1 and geom2 are based on different coordinate systems The following example returns a geometry object that is the topological symmetric difference XOR operation of cola_a and cola_c The example uses the definitions and data from Section 2 1 Return the topological symmetric difference of two geometries SELECT SDO_GEOM SDO_XOR c_a shape m diminfo c_c shape m diminfo FROM cola_markets c_a cola markets c_c user sdo geom metadata m WHERE m table name COLA MARKETS AND m column_name SHAPE AND c_a name cola_a AND c_c name cola_c SDO_GEOM SDO_XOR C_A SHAPE M DIMINFO C_C SHAPE M DIMINFO SDO_GTYPE SDO SRID S Geometry Subprograms 13 43 SDO_GEOM SDO_XOR Related Topics SDO GEOMETRY 2007 NULL NULL SDO ELEM INFO ARRAY 1 1003 1 19 1003 1 SDO _ORDINATE ARRAY 1 7 1 1 5 1 5 3 3 3 4 5 5 5 5 7 1 7 5 5 5 3 6 3 6 5 5 5 Note that the returned polygon is a multipolygon SDO_GTYPE 2007 and the SDO_ORDINATE_ARRAY describes two polygons one starting and ending at 1 7 and the other starting and ending at 5 5 a SDO_GEOM SDO_DIFFERENCE a SDO_GEOM SDO_INTERSECTION a SDO_GEOM SDO_UNION 13 44 Oracle Spatial User s Guide and Reference SDO_GEOM VALID
164. For each tile computes the intersecting geometries from the theme table the values in the aggr_col_string column are weighted proportionally to the area of the intersection and aggregated according to aggr_ col string SDO_SAM TILED_BINS Tiles a two dimensional space and returns geometries corresponding to those tiles The rest of this chapter provides reference information on the spatial analysis and mining subprograms listed in alphabetical order 21 2 Oracle Spatial User s Guide and Reference SDO_SAM AGGREGATES_FOR_GEOMETRY SDO_SAM AGGREGATES_FOR_GEOMETRY Format Description Parameters SDO_SAM AGGREGATES_FOR_GEOMETRY theme_name IN VARCHAR2 theme_colname IN VARCHAR2 aggr_type_string IN VARCHAR2 aggr_col_string IN VARCHAR2 geom IN SDO_GEOMETRY dst_spec IN VARCHAR2 DEFAULT NULL RETURN NUMBER Computes the thematic aggregate for a geometry theme_name Name of the theme table theme_colname Name of the geometry column in theme_name aggr_type_string Any Oracle SQL aggregate function that accepts one or more numeric values and computes a numeric value such as SUM MIN MAX or AVG aggr_col_string Name of a column in theme_name on which to compute aggregate values as explained in the Usage Notes An example might be a POPULATION column geom Geometry object Spatial Analysis and Mining Subprograms 21 3 SDO_SAM AGGREGATES_FOR_GEOMETRY Usage Notes Examples dst_spec A
165. GEOM VALIDATE_LAYER_WITH_CONTEXT sssesssssseessesssessessseesseessessseeses 13 53 SDO GEOM WITHIN DISTANCE aiii 13 56 14 Spatial Aggregate Functions SHO AGGR CEN TR OMG icin Or ie A SE 14 2 SDOLAGGR IC ONCAT TINE SAA Salen Gece a ad 14 4 SDO AGGR CONV EX AU Lor A saute 14 6 SIO AGGR ARS CON GAN ssi ed scsca aati cies lod 14 7 SDO ACGRE MBR Oe a ENN TCIM tore NE Ta NORD RM AO 14 9 SDOSAGG IR CUINION nied oa stn o Oi 14 11 15 Coordinate System Transformation Subprograms SIO CSTR A INS OR gare sha Be te id A cal Nan 15 2 SHO ESTRANSEORMELAVER 0 tb 15 5 SI CSVALIDA TE WR Treni E E 15 7 SDO_CS VIEWPORT_TRANSFORM ssessesssesssesssssseessesssesssessessessesssssssesssessesssecseesssees 15 9 16 Linear Referencing Subprograms SDO LRS CLIP GEOM SEGMENT set ii a is 16 6 SDO_LRS CONCATENATE_GEOM_SEGMENTS ccsscsssesssesssessesssesseessesseesseeseesseees 16 8 SDO_LRS CONNECTED_GEOM_SEGMENTS csssesssessssssesssssssesssesseessecsesssecssessseeaee 16 11 SDO_LRS CONVERT_TO_LRS_DIM_ARRAY o eeescssscsssessessssessesssesssesssessesssecsessssesseesse 16 13 SDO_LRS CONVERT_TO_LRS_GEOM ic sSisinctincecessecdlaateocioa cor oesbionaactetioctsertetes eaatass 16 16 SDOLLRS CONVERT TO LRS LA VER ina dia 16 19 SDO_LRS CONVERT_TO_STD_DIM_ARRAY ecescssscsssesssssssessesssesssesssesseessecssessseeseease 16 22 SDO TLRS CON VERT TO STD AGEOM cui 16 24 SHO RS CONVERT TO STD VA VERA aa 16 26 xi xii SDO_LRS DEFINE_GEOM_SEGMENT cooooccc
166. GEOMETRY result_geom 3 SDO GEOMETRY BEGIN SELECT a route_geometry into geom segment FROM lrs_routes a WHERE a route_name Routel SELECT m diminfo into dim array from user_sdo_geom metadata m WHERE m table name LRS_ROUTES AND m column name ROUTE GEOMETRY Define the LRS segment for Routel This will populate any null measures SDO_LRS DEFINE GEOM SEGMENT geom segment Linear Referencing Subprograms 16 29 SDO_LRS DEFINE_GEOM_SEGMENT dim_ array 0 Zero starting measure LRS segment starts at start of route 27 End of LRS segment is at measure 27 SELECT a route_geometry INTO line string FROM lrs_ routes a WHERE a route name Routel Split Routel into two segments SDO_LRS SPLIT_GEOM SEGMENT line string dim_array 5 result_geom_1 result_geom_ 2 Concatenate the segments that were just split result_geom_3 SDO_LRS CONCATENATE_GEOM SEGMENTS result_geom_1 dim _ array result_geom_2 dim_array Update and insert geometries into table to display later UPDATE lrs routes a SET a route geometry geom segment WHERE a route_id 1 INSERT INTO lrs_ routes VALUES dt result_geom_1 result_geom_1 i INSERT INTO lrs_ routes VALUES 12 result_geom_2 result_geom_2 i INSERT INTO lrs_ routes VALUES 13 result_geom_3 result_geom_ 3 a END 16 30 Oracle Spatial User s Guide and Reference SDO_LRS DYNAMIC_SEGMENT SDO_LRS DYNAMIC_SEGMENT Fo
167. GON returns the polygon geometry that approximates and is covered by a specified ellipse a SDO_UTIL INITIALIZE_INDEXES_FOR_TTS initializes all spatial indexes in a tablespace that was transported to another database a SDO_UTIL POINT_AT_BEARING returns a point geometry that is at the specified distance and bearing from the start point a SDO_UTIL POLYGONTOLINE converts all polygon type elements in a geometry to line type elements and sets the SDO_GTYPE value accordingly a 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 a SDO_UTIL REMOVE_DUPLICATE_VERTICES removes duplicate redundant vertices from a geometry a SDO_UTIL REVERSE_LINESTRING returns a line string geometry with the vertices of the input geometry in reverse order a SDO_UTIL SIMPLIPFY simplifies the input geometry based on a threshold value using the Douglas Peucker algorithm a 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 geomet ry 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
168. HERE a route name Routel SDO_LRS RESET MEASURE geom_segment Update and insert geometries into table to display later UPDATE lrs routes a SET a route geometry geom segment WHERE a route_id 1 END PL SQL procedure successfully completed Display the segment with all measures set to null SELECT a route_geometry FROM lrs_routes a WHERE a route_id 1 ROUTE GEOMETRY SDO_GTYPE SDO SRID SDO POINT X Y Z SDO ELEM INFO SDO ORDIN SDO GEOMETRY 3302 NULL NULL SDO ELEM INFO ARRAY 1 2 1 SDO ORDINATE ARRAY 2 2 NULL 2 4 NULL 8 4 NULL 12 4 NULL 12 10 NULL 8 10 NULL 5 1 4 NULL 16 88 Oracle Spatial User s Guide and Reference SDO_LRS REVERSE_GEOMETRY SDO_LRS REVERSE_GEOMETRY Format Description Parameters Usage Notes SDO_LRS REVERSE_GEOMETRY geom IN SDO_GEOMETRY dim_array IN SDO_DIM_ARRAY RETURN SDO_GEOMETRY Returns a new geometric segment by reversing the measure values and the direction of the original geometric segment geom Cartographic representation of a linear feature dim_array Dimensional information array corresponding to geom_segment usually selected from one of the xxx_SDO_GEOM_METADATA views described in Section 2 4 This function a Reverses the measure values of geom That is the start measure of geom is the end measure of the returned geometric segment the end measure of geom is the start measure of the returned geometri
169. IFY Format SDO_GEOM SDO_ARC_DENSIFY geom IN SDO_GEOMETRY dim INSDO_DIM_ARRAY params IN VARCHAR2 RETURN SDO_GEOMETRY or SDO_GEOM SDO_ARC_DENSIFY geom IN SDO_GEOMETRY tol IN NUMBER params IN VARCHAR2 RETURN SDO_GEOMETRY Description Returns a geometry in which each circular arc in the input geometry is changed into an approximation of the circular arc consisting of straight lines and each circle is changed into a polygon consisting of a series of straight lines that approximate the circle Parameters geom Geometry object dim Dimensional information array corresponding to geom usually selected from one of the xxx_SDO_GEOM_METADATA views described in Section 2 4 tol Tolerance value see Section 1 5 5 13 8 Oracle Spatial Users Guide and Reference SDO_GEOM SDO_ARC_DENSIFY Usage Notes params A quoted string containing an arc tolerance value and optionally a unit value See the Usage Notes for an explanation of the format and meaning If you have geometries in a projected coordinate system that contain circles or circular arcs you can use this function to densify them into regular polygons You can then use the resulting straight line polygon geometries for any Spatial operations or you can transform them to any projected or geodetic coordinate system The params parameter is a quoted string that must contain the arc_tolerance keyword and that may contain the unit keyword to identify the u
170. IMINFO column value from the USER_SDO_GEOM_METADATA view The geometry s SRID value coordinate system is the same as the one specified in the applicable DIMINFO column value from the USER_SDO_GEOM_ METADATA view 13 54 Oracle Spatial Users Guide and Reference SDO_GEOM VALIDATE_LAYER_WITH_CONTEXT Examples Related Topics The following example validates the geometry objects stored in the SHAPE column of the COLA_MARKETS table The example includes the creation of the result table For this example a deliberately invalid geometry was inserted into the table before the validation was performed Isa layer valid First create the result table CREATE TABLE val_results sdo_rowid ROWID result varchar2 1000 Next statement must be on one command line CALL SDO GEOM VALIDATE LAYER WITH CONTEXT COLA MARKETS SHAPE VAL RESULTS Call completed SQL gt SELECT from val_results SDO_ROWID Rows Processed lt 12 gt AAABXNAABAAAK YAAC 13349 Element lt 1 gt Ring lt 1 gt Edge lt 1 gt Edge lt 3 gt a SDO_GEOM VALIDATE_GEOMETRY_WITH_CONTEXT Geometry Subprograms 13 55 SDO_GEOM WITHIN_DISTANCE SDO_GEOM WITHIN_DISTANCE Format SDO_GEOM WITHIN_DISTANCE geom1 IN SDO_GEOMETRY dim1 IN SDO_DIM_ARRAY dist IN NUMBER geom2 IN SDO_GEOMETRY dim2 IN SDO_DIM_ARRAY units IN VARCHAR2 RETURN VARCHAR2 or SDO_GEOM WITHIN_DISTANCE geom1 IN SDO_GEOMETRY dist IN NUMBER geo
171. IN_MBR_ORDINATE 13 34 Oracle Spatial User s Guide and Reference SDO_GEOM SDO_MIN_MBR_ORDINATE SDO_GEOM SDO_MIN_MBR_ORDINATE Format Description Parameters SDO_GEOM SDO_MIN_MBR_ORDINATE geom IN SDO_GEOMETRY ordinate_pos IN NUMBER RETURN NUMBER or SDO_GEOM SDO_MIN_MBR_ORDINATE geom IN SDO_GEOMETRY dim IN SDO_DIM_ARRAY ordinate_pos IN NUMBER RETURN NUMBER Returns the minimum value for the specified ordinate dimension of the minimum bounding rectangle of a geometry object geom Geometry object dim Dimensional information array corresponding to geom usually selected from one of the xxx SDO_GEOM_METADATA views described in Section 2 4 ordinate_pos Position of the ordinate dimension in the definition of the geometry object 1 for the first ordinate 2 for the second ordinate and so on For example if geom has X Y ordinates 1 identifies the X ordinate and 2 identifies the Y ordinate Geometry Subprograms 13 35 SDO_GEOM SDO_MIN_MBR_ORDINATE Usage Notes Examples Related Topics This function is not supported with geodetic data The following example returns the minimum X first ordinate value of the minimum bounding rectangle of the cola_d geometry in the COLA_MARKETS table The example uses the definitions and data from Section 2 1 The minimum bounding rectangle of cola_d is returned in the example for the SDO_ GEOM SDO_MBR function SELECT SDO _GEOM SDO MIN MBR ORDINATE
172. LEMENT to M unless another dim_name is specified It sets the other values in the added SDO_DIM_ ELEMENT according to the values of the upper_bound lower_bound and tolerance parameter values If dim_array already contains dimensional information the dim_array is returned 16 14 Oracle Spatial Users Guide and Reference SDO_LRS CONVERT_TO_LRS_DIM_ARRAY Examples The _3D format of this function SDO_LRS CONVERT_TO_LRS_DIM_ARRAY_3D is available For information about _3D formats of LRS functions see Section 7 4 For more information about conversion functions see Section 7 5 10 The following example converts the dimensional array for the LRS_ROUTES table to LRS format This example uses the definitions from the example in Section 7 7 SELECT SDO_LRS CONVERT_TO_LRS DIM ARRAY m diminfo FROM user_sdo_geom metadata m WHERE m table name LRS ROUTES AND m column name ROUTE _GEOMETRY SDO_LRS CONVERT TO LRS DIM ARRAY M DIMINFO SDO DIMNAME SDO LB SDO UB SDO TOL SDO_ DIM ARRAY SDO DIM ELEMENT X 0 20 005 SDO DIM ELEMENT Y 0 20 00 5 SDO DIM ELEMENT M 0 20 005 Linear Referencing Subprograms 16 15 SDO_LRS CONVERT_TO_LRS_GEOM SDO_LRS CONVERT_TO_LRS_GEOM Format SDO_LRS CONVERT_TO_LRS_GEOM standard_geom IN SDO_GEOMETRY start_measure IN NUMBER end_measure IN NUMBER RETURN SDO_GEOMETRY or SDO_LRS CONVERT_TO_LRS_GEOM standard_geom IN SDO_GEOMETRY dim_array IN SDO_
173. LL NULL SDO ELEM INFO ARRAY 1 1 1 SDO ORDINATE ARRAY 2 2 0 SQL gt What is the end point of Routel SQL gt SELECT SDO_LRS GEOM SEGMENT END PT route_geometry 2 FROM lrs_ routes WHERE route_id 1 SDO_LRS GEOM SEGMENT END PT ROUTE GEOMETRY SDO_GTYPE SDO SRID SDO POINT X Y SDO_ GEOMETRY 3301 NULL NULL SDO ELEM INFO ARRAY 1 1 1 SDO ORDINATE ARRAY 5 14 27 SQL gt Translate shift measure values 10 SQL gt First display the original segment then translate SQL gt SELECT a route_geometry FROM lrs_routes a WHERE a route id 1 ROUTE GEOMETRY SDO_GTYPE SDO SRID SDO POINT X Y Z SDO ELEM INFO SDO_ORDIN SDO_ GEOMETRY 3302 NULL NULL SDO ELEM INFO ARRAY 1 2 1 SDO ORDINATE ARRAY Zi Dig Oi 25 Aye Dye BR By Oy 125 Ap P25 12 105 187 28 Ly 22 Sy LAR 27 SQL gt SELECT SDO_LRS TRANSLATE MEASURE a route_geometry m diminfo 10 2 FROM lrs_ routes a user sdo geom metadata m 3 WHERE m table name LRS ROUTES AND m column_name ROUTE_GEOMETRY 7 30 Oracle Spatial Users Guide and Reference Example of LRS Functions 4 AN a route id 1 SDO_LRS TRANSLATE MEASURE A ROUTE GEOMETRY M DIMINFO 10 SDO_GTYPE SDO SRID SD SDO_ GEOMETRY 3302 NULL NULL SDO ELEM INFO ARRAY 1 2 1 SDO ORDINATE ARRAY 24 2 510 2 Ay 12 8 4 18 12 4 22 12 10 28 8 10 32 5 14 37 SQL gt Redefine geometric segment to convert miles to kilometers SQL gt DECLARE
174. LRS REDEFINE_GEOM_SEGMENT cncoccciccnncncnnoninnaninnncnnnnnnnn non ER E 16 84 SDO ERS RESET_MEASURE siiscccccseeseseteeseseascssisteledesietecosnded sents hessghaccboasbebsbeetosestiaenaded 16 87 SDO_LRS REVERSE_GEOME TRY amiee ioiei i orire E T E 16 89 SDO_LRS REVERSE_MEASURE ennenen E ea ea E E EE EAE NS 16 91 SDO_LRS SCALE_GEOM_SEGMENT Dreesen irei arar a Er E TEA S ATE 16 93 SDO ERS SET PTZMEASURE nore terdiri i ee AA OE dd 16 96 SDO_LRS SPLIT_GEOM_SEGMENT rrara irr a E EE 16 99 SDO_LRS TRANSLATE_MEASURE cccssssssssssssesesssesscsessssssesesesensesesessessseneesesenes 16 102 SDO_LRS VALID_GEOM_SEGMENT occ cee cece cree EE EEA 16 104 SDO ERS VALID URS PP Tui A A A A aa t 16 106 SDO ERS VALID MEASURE ma dad ia uate 16 108 SDO_LRS VALIDATE_LRS_GEOMETRY 0 0 cece cecesecsseceeeeeeeeseceeeesesecaeseseeesaesaesees 16 110 17 SDO MIGRATE Procedure SDO_MIGRATE TO_CURRENT ssssesssssscsssessesesesececsesescecscscecsusscatsuscecerarsusucacsesnseecscees 17 2 18 Spatial Tuning Subprograms SDO TUNE AVERAGE MBR tekenen ie reira esten tenths Sgssueaccbbecucauthbescspescgbecdsouss 18 2 SDO_TUNE ESTIMATE_RTREE_INDEX_SIZE wo cee cseeeeeseceeeeeneeeeseeeeeneens 18 4 SPO TUNE EXTENT OP io ii drid eine tease did dida E 18 7 SDO TUNE MIX INFO estii ised Sessasesssvenisutin orean aas Ea Nap ORAA SaDa EEEa dss EAE ENAN EAEE bdessdte 18 9 SDO_TUNE QUALITY_DEGRADATION sssessesssrsesresesressrreerresereserrneereserreesresereeerreee 18 11
175. METADATA views described in Section 2 4 start_measure Start measure of the scaled geometric segment Linear Referencing Subprograms 16 93 SDO_LRS SCALE_GEOM_SEGMENT Usage Notes end_measure End measure of the scaled geometric segment shift_measure Shift measure of the scaled geometric segment This function performs a general scaling operation to the geometric segment The new start and end measures are assigned and all measures are populated by a linear mapping between old and new start and end measures The shift measure is applied to the segment after scaling Note This general purpose function was deprecated in a previous release of Spatial The current Spatial release is the last supported release for this function and it will not be included in future releases of this guide You should instead use other functions for specific purposes as described in Table 16 4 Table 164 lists some common tasks and the suggested functions to use instead of SCALE_GEOM_SEGMENT Table 16 4 Functions to Use Instead of SCALE_GEOM_SEGMENT Task Suggested Function Shift all measures by a specified amount for example to SDO_LRS TRANSLATE_ accommodate new construction at the start of a road that MEASURE causes the original start point to be n measure units beyond the new start point Reverse the direction of a segment for example to allow SDO_LRS REVERSE_ one road segment to be concatenated with another coming G
176. N VARCHAR2 table_out IN VARCHAR2 to_srid IN NUMBER Transforms an entire layer of geometries that is all geometries in a specified column in a table table_in Table containing the layer column_in whose geometries are to be transformed column_in Column in table_in that contains the geometries to be transformed table_out Table that will be created and that will contain the results of the transformation See the Usage Notes for information about the format of this table to_srid The SRID of the coordinate system to be used for the transformation to_srid must be a value in the SRID column of the MDSYS CS_SRS table described in Section 6 4 1 Transformation can be done only between two different georeferenced coordinate systems or between two different local coordinate systems An exception is raised if any of the following occurs a table _indoes not exist or column_in does not exist in the table Coordinate System Transformation Subprograms 15 5 SDO_CS TRANSFORM_LAYER Examples The geometries in column_in have a null or invalid SDO_SRID value table out already exists a to _sridisinvalid The table_out table is created by the procedure and is filled with one row for each transformed geometry This table has the columns shown in Table 15 2 Table 15 2 Table to Hold Transformed Layer Column Name Data Type Description SDO_ROWID ROWID Oracle ROWID row address identifier For more informatio
177. NFO C_C SHAPE M DIMINFO SDO_GTYPE SDO SRID SDO GEOMETRY 2003 NULL NULL SDO ELEM INFO ARRAY 1 1003 1 SDO ORDINATE ARR AY 5 5 5 7 1 7 1 1 5 1 5 3 6 3 6 5 5 5 Note that in the returned polygon the SDO_ORDINATE_ARRAY starts and ends at the same point 5 5 a SDO_GEOM SDO_DIFFERENCE a SDO_GEOM SDO_INTERSECTION a SDO_GEOM SDO_XOR Geometry Subprograms 13 41 SDO_GEOM SDO_XOR SDO_GEOM SDO_XOR Format SDO_GEOM SDO_XOR geom1 IN SDO_XOR dimi IN SDO_DIM_ARRAY geom2 IN SDO_GEOMETRY dim2 IN SDO_DIM_ARRAY RETURN SDO_GEOMETRY or SDO_GEOM SDO_XOR geom1 IN SDO_GEOMETRY geom2 IN SDO_GEOMETRY tol IN NUMBER RETURN SDO_GEOMETRY Description Returns a geometry object that is the topological symmetric difference XOR operation of two geometry objects Parameters geom1 Geometry object dim1 Dimensional information array corresponding to geom1 usually selected from one of the xxx_SDO_GEOM_METADATA views described in Section 2 4 geom2 Geometry object 13 42 Oracle Spatial User s Guide and Reference SDO_GEOM SDO_XOR Usage Notes Examples dim2 Dimensional information array corresponding to geom2 usually selected from one of the xxx_SDO_GEOM_METADATA views described in Section 2 4 tol Tolerance value see Section 1 5 5 In Figure 13 5 the shaded area represents the polygon returned when SDO_XOR is used with a square geom1 and another polygon geom2
178. NFO field of the USER_SDO_GEOM_ METADATA view If this check is required for your usage use the function format with theDimInfo You can use this function in a PL SQL procedure as an alternative to using the SDO_GEOM VALIDATE_LAYER_WITH_CONTEXT procedure See the Usage Notes for SDO_GEOM VALIDATE_LAYER_WITH_CONTEXT for more information The following example validates a geometry deliberately created as invalid named cola_invalid geonm Validate provide context if invalid SELECT c name SDO GEOM VALIDATE GEOMETRY WITH CONTEXT c shape 0 005 FROM cola_markets c WHERE c name cola_invalid geom cola invalid geom 13349 Element lt 1 gt Ring lt 1 gt Edge lt 1 gt Edge lt 3 gt a SDO_GEOM VALIDATE_LAYER_WITH_CONTEXT Geometry Subprograms 13 49 SDO_GEOM VALIDATE_LAYER SDO_GEOM VALIDATE_LAYER Format SDO_GEOM VALIDATE_LAYER geom_table IN VARCHAR2 geom_column IN VARCHAR2 pkey_column IN VARCHAR2 result_table IN VARCHAR2 commit_interval IN NUMBER Description Examines a geometry column to determine if the stored geometries follow the defined rules for geometry objects Note The VALIDATE_LAYER procedure was deprecated in a previous release of Spatial The current Spatial release is the last supported release for this procedure and it will not be included in future releases of this guide You should use instead the SDO_ GEOM VALIDATE_LAYER_WITH_CONTEXT procedure Para
179. NT Clips a geometric segment synonym of SDO_ LRS CLIP_GEOM_SEGMENT Concatenates two geometric segments into one segment Returns the geometric segment at a specified offset from a geometric segment Scales a geometric segment Splits a geometric segment into two segments Linear Referencing Subprograms 16 1 Table 16 1 Cont Subprograms for Creating and Editing Geometric Segments Subprogram Description SDO_LRS RESET_MEASURE SDO_LRS SET_PT_MEASURE SDO_LRS REVERSE_MEASURE SDO_LRS TRANSLATE_MEASURE SDO_LRS REVERSE_GEOMETRY Sets all measures of a geometric segment including the start and end measures to null values overriding any previously assigned measures Sets the measure value of a specified point Returns a new geometric segment by reversing the measure values but not the direction of the original geometric segment Returns a new geometric segment by translating the original geometric segment that is shifting the start and end measures by a specified value Returns a new geometric segment by reversing the measure values and the direction of the original geometric segment Table 16 2 lists subprograms related to querying geometric segments Table 16 2 Subprograms for Querying and Validating Geometric Segments Subprogram SDO_LRS VALID_GEOM_SEGMENT SDO_LRS VALID_LRS_PT SDO_LRS VALID_MEASURE SDO_LRS CONNECTED_GEOM_ SEGMENTS SDO_LRS GEOM_SEGMENT_LENGTH SDO_LRS GEOM_
180. NT as OBJECT SDO_DIMNAME VARCHAR2 64 SDO_LB NUMBER SDO_UB NUMBER SDO TOLERANCE NUMBER The SDO_DIM_ARRAY instance is of size n if there are n dimensions That is DIMINFO contains 2 SDO_DIM_ELEMENT instances for two dimensional geometries 3 instances for three dimensional geometries and 4 instances for four dimensional geometries Each SDO_DIM_ELEMENT instance in the array must have valid not null values for the SDO_LB SDO_UB and SDO_ TOLERANCE attributes Note The number of dimensions reflected in the DIMINFO information must match the number of dimensions of each geometry object in the layer For an explanation of tolerance and how to determine the appropriate SDO_ TOLERANCE value see Section 1 5 5 especially Section 1 5 5 1 Spatial assumes that the varying length array is ordered by dimension The DIMINFO varying length array must be ordered by dimension in the same way the ordinates for the points in SDO_ORDINATES varying length array are ordered For example if the SDO_ORDINATES varying length array contains X1 Y1 Xn Yn then the first DIMINFO entry must define the X dimension and the second DIMINFO entry must define the Y dimension Example 2 1 in Section 2 1 shows the use of the SDO_GEOMETRY and SDO_DIM_ ARRAY types This example demonstrates how geometry objects hypothetical Spatial Data Types and Metadata 2 27 Spatial Index Related Structures 2 4 4 SRID market areas for colas
181. NTAGE geom_segment IN SDO_GEOMETRY measure IN NUMBER RETURN NUMBER or SDO_LRS MEASURE_TO_PERCENTAGE geom_segment IN SDO_GEOMETRY dim_array IN SDO_DIM_ARRAY measure IN NUMBER RETURN NUMBER Description Returns the percentage 0 to 100 that a specified measure is of the measure range of a geometric segment Parameters geom_segment Cartographic representation of a linear feature dim_array Dimensional information array corresponding to geom_segment usually selected from one of the xxx_SDO_GEOM_METADATA views described in Section 2 4 measure Measure value This function returns the percentage that this measure value is of the measure range 16 74 Oracle Spatial Users Guide and Reference SDO_LRS MEASURE_TO_PERCENTAGE Usage Notes Examples This function returns a number 0 to 100 that is the percentage of the measure range that the specified measure represents The measure range is the end measure minus the start measure For example if the measure range of geom_segment is 50 and measure is 20 the function returns 40 because 20 50 40 This function performs the reverse of the SDO_LRS PERCENTAGE_TO_MEASURE function which returns the measure that corresponds to a percentage value An exception is raised if geom_segment or measure is invalid The following example returns the percentage that 5 is of the measure range of the geometric segment representing Route 1 This example uses the defini
182. OINT attribute see Section 2 2 3 SDO_ELEM_INFO and SDO_ORDINATES are both NULL as required if the SDO_POINT attribute is specified Example 2 6 shows a SQL statement that inserts the geometry illustrated in Figure 2 6 into the database Example 2 6 SQL Statement to Insert a Point Only Geometry INSERT INTO cola_markets VALUES 90 2 22 Oracle Spatial Users Guide and Reference Geometry Examples point_only SDO_GEOMETRY 2001 NULL SDO POINT TYPE 12 14 NULL NULL NULL You can search for point only geometries based on the X Y and Z values in the SDO_POINT_TYPE specification Example 2 7 is a query that asks for all points whose first coordinate the X value is 12 and it finds the point that was inserted in Example 2 6 Example 2 7 Query for Point Only Geometry Based on a Coordinate Value SELECT from cola_markets c WHERE c shape SDO POINT X 12 MKT ID NAME 90 point only SDO _ GEOMETRY 2001 NULL SDO POINT TYPE 12 14 NULL NULL NULL 2 3 6 Type 0 Zero Element Type 0 zero elements are used to model geometry types that are not supported by Oracle Spatial such as curves and splines A type 0 element has an SDO_ETYPE value of 0 See Section 2 2 4 for information about the SDO_ETYPE Type 0 elements are not indexed by Oracle Spatial and they are ignored by Spatial functions and procedures Geometries with type 0 elements must contain at least one nonzero element that is an element
183. OMETRY dim_array_1 IN SDO_DIM_ARRAY geom_segment_2 IN SDO_GEOMETRY dim_array_2 IN SDO_DIM_ARRAY RETURN SDO_GEOMETRY Description Returns the geometry object resulting from the concatenation of two geometric segments Parameters geom_segment_1 First geometric segment to be concatenated dim_array_1 Dimensional information array corresponding to geom_segment_1 usually selected from one of the xxx_SDO_GEOM_METADATA views described in Section 2 4 geom_segment_2 Second geometric segment to be concatenated 16 8 Oracle Spatial Users Guide and Reference SDO_LRS CONCATENATE_GEOM_SEGMENTS Usage Notes Examples dim_array_2 Dimensional information array corresponding to geom_segment_2 usually selected from one of the xxx_SDO_GEOM_METADATA views described in Section 2 4 tolerance Tolerance value see Section 1 5 5 and Section 7 6 An exception is raised if geom_segment_1 or geom_segment_2 has an invalid geometry type or dimensionality or if geom_segment_1 and geom_segment_2 are based on different coordinate systems The direction of the first geometric segment is preserved and all measures of the second segment are shifted so that its start measure is the same as the end measure of the first segment The geometry type of geom_segment_1 and geom_segment_2 must be line or multiline Neither can be a polygon The _3D format of this function DO_LRS CONCATENATE_GEOM_SEGMENTS_ 3D is available For inform
184. ON ID VARCHAR2 24 GEOMETRY MDSYS SDO_ GEOMETRY AGGREGATE VALUE NUMBER Examples The following example computes the sum of the population rows of POLY_4PT_ TEMP table intersecting with each tile The extent of the POLY_4PT_TEMP table stored in the USER_SDO_GEOM_METADATA view is used as the domain and a tiling level of 2 is used that is the domain is divided into 16 tiles SELECT a geometry a aggregate value from TABLE sdo_sam tiled_aggregates POLY 4PT_TEMP GEOMETRY SUM POPULATION 2 a GEOMETRY SDO_GTYPE SDO SRID SDO POINT X Y Z SDO ELEM INFO SDO_ORDINATES SDO GEOMETRY 2003 8307 NULL SDO ELEM INFO ARRAY 1 1003 3 SDO ORDINATE ARR 21 22 Oracle Spatial Users Guide and Reference SDO_SAM TILED_AGGREGATES AY 180 90 90 45 007150754 SDO GEOMETRY 2003 8307 AY 180 45 90 0 034831005 SDO GEOMETRY 2003 8307 AY 180 0 90 45 7 73307783 SDO GEOMETRY 2003 8307 AY 90 90 0 45 019498368 SDO GEOMETRY 2003 8307 AY 90 45 0 0 939061456 SDO GEOMETRY 2003 8307 AY 90 0 0 45 1 26691592 SDO GEOMETRY 2003 8307 AY 0 0 90 45 40 7 rows selected NULL NULL NULL NULL NULL NULL SDO_ELEM_INFO ARRAY 1 SDO_ELEM_INFO_ARRAY 1 SDO_ELEM_INFO_ARRAY 1 SDO_ELEM_INFO ARRAY 1 SDO_ELEM_INFO ARRAY 1 SDO_ELEM_INFO ARRAY 1 1003 1003 1003 1003 1003 1003 SDO_ORDINATE ARR
185. OP INDEX 10 16 Oracle Spatial User s Guide and Reference 11 SDO_GEOMETRY Object Type Methods This chapter contains reference and usage information for the SDO_GEOMETRY object type methods The SDO_GEOMETRY object type is described in Section 2 2 The type methods are listed in Table 11 1 Table 11 1 SDO_GEOMETRY Type Methods Method Description GET_DIMS Returns the number of dimensions of a geometry object GET_GTYPE Returns the geometry type of a geometry object GET_LRS_DIM Returns the measure dimension of an LRS geometry object SDO_GEOMETRY Object Type Methods 11 1 GET_DIMS GET_DIMS Format Description Parameters Usage Notes Examples GET_DIMS RETURN NUMBER Returns the number of dimensions of a geometry object as specified in its SDO_ GTYPE value None The SDO_TYPE value is 4 digits in the format dltt as described in Section 2 2 1 This method returns the d dimensionality value that is the number of dimensions The following example returns the number of dimensions of the cola_d geometry object The example uses the definitions and data from Section 2 1 SELECT c mkt_id c shape GET_DIMS FROM cola_markets c WHERE c name cola d MKT ID C SHAPE GET_DIMS 11 2 Oracle Spatial Users Guide and Reference GET_GTYPE GET_GTYPE Format GET_GTYPE RETURN NUMBER Description Returns the geometry type of a geometry object as specified in its SD
186. ORACLE Oracle Spatial User s Guide and Reference 10g Release 1 10 1 Part No B10826 01 December 2003 Provides usage and reference information for indexing and storing spatial data and for developing spatial applications using Oracle Spatial and Oracle Locator Oracle 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
187. OUTE GEOMETRY 5 10 SDO_GTYPE SDO SRID SDO POINT X SDO _ GEOMETRY 3302 NULL NULL SDO ELEM INFO ARRAY 1 2 1 SDO ORDINATE ARRAY 5 4 5 8 4 8 10 4 10 SQL gt Point 9 3 NULL is off the road should return 9 4 9 SQL gt SELECT SDO_LRS PROJECT PT route geometry 2 SDO GEOMETRY 3301 NULL NULL 3 SDO ELEM INFO ARRAY 1 1 1 4 SDO ORDINATE ARRAY 9 3 NULL 5 FROM lrs_ routes WHERE route_id 1 SDO_LRS PROJECT PT ROUTE GEOMETRY SDO GEOMETRY 3301 NULL NULL SDO EL SDO GEOMETRY 3301 NULL NULL SDO ELEM INFO ARRAY 1 1 1 SDO ORDINATE ARRAY 9 4 9 SQL gt Return the measure of the projected point SQL gt SELECT SDO_LRS GET MEASURE 2 SDO_LRS PROJECT PT a route_geometry m diminfo 3 SDO GEOMETRY 3301 NULL NULL 4 SDO ELEM INFO ARRAY 1 1 1 5 SDO ORDINATE ARRAY 9 3 NULL 6 m diminfo 7 FROM lrs routes a user _sdo geom metadata m 8 WHERE m table name LRS ROUTES AND m column_name ROUTE_GEOMETRY 9 AND a route_id 1 SDO_LRS GET MEASURE SDO_LRS PROJECT_PT A ROUTE GEOMETRY M DIMINFO SDO_GEOM SQL gt Is point 9 3 NULL a valid LRS point Should return TRUE SQL gt SELECT SDO LRS VALID LRS PT 2 SDO GEOMETRY 3301 NULL NULL SDO_ELEM_INFO_ARRAY 1 1 1 SDO ORDINATE ARRAY 9 3 NULL m diminfo FROM lrs_ routes a user_sdo geom metadata m WHERE m table name LRS ROUTES AND m column_name ROUTE GEOMETRY AND a route_id 1 arn uF 0 7 32 Orac
188. O_ADDR_ARRAY object contains multiple SDO_GEO_ADDR objects If your application needs to select one of the addresses for some further operations 20 4 Oracle Spatial User s Guide and Reference SDO_GCDR GEOCODE_ALL Examples you can use the information about each returned address to help you make that selection Each SDO_GEO_ADDR object in the returned SDO_ADDR_ARRAY array represents the center point of each street segment that matches the criteria in the addr_lines parameter For example if Main Street extends into two postal codes or if there are two separate streets named Main Street in two separate postal codes and if you specify Main Street and a city and state for this function the returned SDO_ADDR_ARRAY array contains two SDO_GEO_ADDR objects each reflecting the center point of Main Street in a particular postal code The house or building number in each SDO_GEO_ADDR object is the house or building number located at the center point of the street segment even if the input address contains no house or building number or a nonexistent number The following example returns an array of geocoded results each result reflecting the center point of Clay Street in all postal codes in San Francisco California in which the street extends The resulting array includes four SDO_GEOR_ADDR objects each reflecting the house at the center point of the Clay Street segment in each of the four postal codes 94108 94115 94118 and 94109 int
189. O_GTYPE value Parameters None Usage Notes The SDO_TYPE value is 4 digits in the format dltt as described in Section 2 2 1 This method returns the tt value that is the geometry type Examples The following example returns the geometry type of each geometry object in the COLA_MARKETS table The example uses the definitions and data from Section 2 1 SELECT c mkt_id c shape GET GTYPE FROM cola_markets c MKT_ID C SHAPE GET GTYPE SDO_GEOMETRY Object Type Methods 11 3 GET_LRS_DIM GET_LRS_DIM Format GET_LRS_DIM RETURN NUMBER Description Returns the measure dimension of an LRS geometry object as specified in its SDO_ GTYPE value Parameters None Usage Notes The SDO_TYPE value is 4 digits in the format dltt as described in Section 2 2 1 This method returns the l value The value is meaningful only for LRS geometry objects and must be 0 3 or 4 a 0 indicates that the geometry is a pre release 9 0 1 LRS geometry with measure as the default last dimension or that the geometry is a release 9 0 1 standard geometry 3 indicates that the third dimension contains the measure information 4 indicates that the fourth dimension contains the measure information Examples The following example returns the measure dimension of the Route 1 geometry object This example uses the definitions from the example in Section 7 7 SELECT a route_id a route geometry GET_LRS DIM FROM lrs_ rou
190. O_LRS IS_MEASURE_INCREASING geom_segment IN SDO_GEOMETRY dim_array IN SDO_DIM_ARRAY RETURN VARCHAR2 Checks if the measure values along an LRS segment are increasing that is ascending in numerical value geom_segment Geometric segment to be checked dim_array Dimensional information array corresponding to geom_segment usually selected from one of the xxx_SDO_GEOM_METADATA views described in Section 2 4 This function returns TRUE if the measure values along an LRS segment are increasing and FALSE if the measure values along an LRS segment are not increasing The start and end measures of geom_segment must be defined cannot be null The _3D format of this function GDO_LRS IS_MEASURE_INCREASING_3D is available For information about _3D formats of LRS functions see Section 7 4 See also the SDO_LRS IS MEASURE_DECREASING function The following example checks if the measure values along the geometric segment representing Route 1 are increasing This example uses the definitions from the example in Section 7 7 Linear Referencing Subprograms 16 65 SDO_LRS IS_MEASURE_INCREASING SELECT SDO LRS IS MEASURE INCREASING a route geometry m diminfo FROM lrs_ routes a user _sdo geom_ metadata m WHERE m table name LRS ROUTES AND m column_name ROUTE_GEOMETRY AND a route_id 1 SDO_LRS IS MEASURE INCREASING A ROUTE GEOMETRY M DIMINFO 16 66 Oracle Spatial User s Guide and Reference SDO_LRS IS
191. PE_PT_MEASURE_ 3D is available For information about _3D formats of LRS functions see Section 7 4 The following example returns the measure value of the next shape point after measure 14 on the geometric segment representing Route 1 This example uses the definitions from the example in Section 7 7 SELECT SDO_LRS GET NEXT SHAPE PT MEASURE a route_ geometry 14 FROM lrs_ routes a WHERE a route id 1 SDO_LRS GET NEXT SHAPE PT MEASURE A ROUTE GEOMETRY 14 Linear Referencing Subprograms 16 53 SDO_LRS GET_NEXT_SHAPE_PT_MEASURE 16 54 Oracle Spatial Users Guide and Reference SDO_LRS GET_PREV_SHAPE_PT SDO_LRS GET_PREV_SHAPE_PT Format SDO_LRS GET_PREV_SHAPE_PT geom_segment IN SDO_GEOMETRY measure IN NUMBER RETURN SDO_GEOMETRY or SDO_LRS GET_PREV_SHAPE_PT geom_segment IN SDO_GEOMETRY dim_array IN SDO_DIM_ARRAY measure IN NUMBER RETURN SDO_GEOMETRY or SDO_LRS GET_PREV_SHAPE_PT geom_segment IN SDO_GEOMETRY point IN SDO_GEOMETRY RETURN SDO_GEOMETRY or SDO_LRS GET_PREV_SHAPE_PT geom_segment IN SDO_GEOMETRY dim_array IN SDO_DIM_ARRAY point IN SDO_GEOMETRY RETURN SDO_GEOMETRY Description Returns the previous shape point on a geometric segment before a specified measure value or LRS point Linear Referencing Subprograms 16 55 SDO_LRS GET_PREV_SHAPE_PT Parameters Usage Notes Examples geom_segment Geometric segment measure Measure value o
192. Polygons A WHERE SDO_RELATE A Geometry aGeom mask ANYINTERACT TRUE The following example selects the GID values from the POLYGONS table where a GEOMETRY column object has any spatial interaction with the specified rectangle having the lower left coordinates x1 y1 and the upper right coordinates x2 y2 Select A Gid FROM Polygons A WHERE SDO_RELATE A Geometry sdo_geometry 2003 NULL NULL sdo_elem_info_array 1 1003 3 sdo_ordinate_array x1 y1l x2 y2 mask ANYINTERACT TRUE The following example selects the GID values from the POLYGONS table where the GEOMETRY column object has any spatial interaction with any GEOMETRY column object in the QUERY_POLYS table In this example the ORDERED optimizer hint is used and QUERY_POLYS geomet ry2 table is specified first in the FROM clause because multiple geometries from geomet ry2 are involved see the Usage Notes SELECT ORDERED A gid FROM query polys B polygons A WHERE SDO_ RELATE A Geometry B Geometry mask ANYINTERACT TRUE 12 42 Oracle Spatial User s Guide and Reference SDO_RELATE Related Topics SDO_FILTER SDO_JOIN SDO_WITHIN_DISTANCE SDO_GEOM RELATE function Spatial Operators 12 43 SDO_TOUCH SDO_TOUCH Format SDO_TOUCH geometry1 geometry2 Description Checks if any geometries in a table have the TOUCH topological relationship with a specified geometry Equivalent to specifying the SDO_RELATE operator with mask
193. 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
194. 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 xxvii Related Documentation For more information see the following documents a Oracle Spatial GeoRaster a Oracle Spatial Topology and Network Data Models a Oracle Database SQL Reference a Oracle Database Administrator s Guide a Oracle Database Application Developer s Guide Fundamentals a Oracle Database Error Messages Spatial messages are in the range of 13000 to 13499 a Oracle Database Performance Tuning Guide a Oracle Database Utilities a Oracle Database Advanced Replication a 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 Oracl
195. QL gt SQL gt Transform the entire SHAPE layer and put results in the table SQL gt named cola markets cs 8199 which the procedure will create SQL gt CALL SDO_CS TRANSFORM LAYER COLA MARKETS _CS SHAPE COLA MARKETS CS _ 8199 8199 Call completed SQL gt SQL gt Select all from the old existing table SQL gt SELECT from cola markets cs MKT ID NAME SHAPE SDO_GTYPE SDO SRID SDO POINT X Y Z SDO ELEM INFO SDO_ORDINATES 6 26 Oracle Spatial User s Guide and Reference Example of Coordinate System Transformation 1 cola a SDO GEOMETRY 2003 8307 NULL SDO ELEM INFO ARRAY 1 1003 1 SDO ORDINATE ARR Avi Ef 5 1d Sr Ti Dy 0 2 cola b SDO GEOMETRY 2003 8307 NULL SDO ELEM INFO ARRAY 1 1003 1 SDO ORDINATE ARR AY 5 1 8 1 8 6 5 7 5 1 3 cola c MKT_ID NAME SDO _ GEOMETRY 2003 8307 NULL SDO ELEM INFO ARRAY 1 1003 1 SDO ORDINATE ARR AY 3 3 6 3 6 5 4 5 3 3 4 cola d SDO GEOMETRY 2003 8307 NULL SDO ELEM INFO ARRAY 1 1003 1 SDO ORDINATE ARR AY 10 9 11 9 11 10 10 10 10 9 SQL gt SQL gt Select all from the new layer transformed table SQL gt SELECT from cola markets cs 8199 SDO_ROWID AAABZZAABAAAOab6AAA SDO GEOMETRY 2003 8199 NULL SDO ELEM INFO ARRAY 1 1003 1 SDO ORDINATE ARR AY 1 00078604 1 00274579 5 00069354 1 00274488 5 0006986 7 00323528 1 0007 9179 7 00324162 1 00078604 1 00274579 AAABZZAABAAAOa6AAB
196. R2 layer_gtype IN VARCHAR2 updateflag IN VARCHAR2 Description Upgrades data from a previous Spatial release to the current release The format depends on whether you are upgrading from the Spatial relational model release 8 1 5 or lower or object relational model release 8 1 6 or higher See the Usage Notes for the model that applies to you You should use this procedure for any spatial data upgrade Do not use the SDO_ MIGRATE TO_81X SDO_MIGRATE FROM_815_TO_81X or SDO_MIGRATE TO_ 734 procedures which were documented in previous Spatial releases but are no longer supported 17 2 Oracle Spatial Users Guide and Reference SDO_MIGRATE TO_CURRENT Parameters tabname Table with geometry objects column_name Column in tabname that contains geometry objects If column_name is not specified or is specified as null the column containing geometry objects is upgraded commit_int Number of geometries to upgrade before Spatial performs an internal commit operation If commit_int is not specified no internal commit operations are performed during the upgrade If you specify a commit_int value you can use a smaller rollback segment than would otherwise be needed layer Name of the layer to be upgraded newtabname Name of the new table to which you are upgrading the data gidcolumn Name of the column in which to store the GID from the old table geocolname Name of the column in the new table where the geometry objec
197. RE geom_segment IN SDO_GEOMETRY point IN SDO_GEOMETRY RETURN NUMBER or SDO_LRS FIND_MEASURE geom_segment IN SDO_GEOMETRY dim_array IN SDO_DIM_ARRAY point IN SDO_GEOMETRY RETURN NUMBER Returns the measure of the closest point on a segment to a specified projection point geom_segment Cartographic representation of a linear feature This function returns the measure of the point on this segment that is closest to the projection point dim_array Dimensional information array corresponding to geom_segment usually selected from one of the xxx_SDO_GEOM_METADATA views described in Section 2 4 point Projection point This function returns the measure of the point on geom_segment that is closest to the projection point 16 34 Oracle Spatial User s Guide and Reference SDO_LRS FIND_MEASURE Usage Notes Examples This function returns the measure of the point on geom_segment that is closest to the projection point For example if the projection point represents a shopping mall the function could be used to find how far from the start of the highway is the point on the highway that is closest to the shopping mall An exception is raised if geom_segment has an invalid geometry type or dimensionality or if geom_segment and point are based on different coordinate systems The _3D format of this function SDO_LRS FIND_MEASURE_ 3D is available For information about _3D formats of LRS functions see Section 7 4
198. RRAY 6 5 10 10 TRUE Example 6 1 produces the following output assuming the data as defined in Example 6 4 in Section 6 8 The following considerations apply to the use of geodetic MBRs Do not use a geodetic MBR with spatial objects stored in the database Use it only to construct a query window The lower left Y coordinate minY must be less than the upper right Y coordinate maxY If the lower left X coordinate minX is greater than the upper right X coordinate maxX the window is assumed to cross the date line meridian that is the meridian opposite the prime meridian or both 180 and 180 longitude For example an MBR of 10 10 100 20 with longitude latitude data goes three fourths of the way around the Earth crossing the date line meridian and goes from latitude lines 10 to 20 When Spatial constructs the MBR internally for the query lines along latitude lines are densified by adding points at one degree intervals This might affect results for objects within a few meters of the edge of the MBR especially objects near the North and South Poles The following additional examples show special or unusual cases to illustrate how a geodetic MBR is interpreted with longitude latitude data 10 0 110 20 crosses the date line meridian and goes most of the way around the world and goes from the equator to latitude 20 10 90 40 90 is a band from the South Pole to the North Pole between longitudes 10
199. RS_DIM_ARRAY dim_array IN SDO_DIM_ARRAY dim_name IN VARCHAR2 dim_pos IN INTEGER lower_bound IN NUMBER upper_bound IN NUMBER tolerance IN NUMBER RETURN SDO_DIM_ARRAY Linear Referencing Subprograms 16 13 SDO_LRS CONVERT_TO_LRS_DIM_ARRAY Description Parameters Usage Notes Converts a standard dimensional array to an LRS dimensional array by creating a measure dimension dim_array Dimensional information array corresponding to the layer column of geometries to be converted usually selected from one of the xxx_SDO_GEOM_METADATA views described in Section 2 4 dim_name Name of the measure dimension M if not otherwise specified dim_pos Position of the measure dimension the last SDO_DIM_ELEMENT object position in the SDO_DIM_ARRAY if not otherwise specified lower_bound Lower bound SDO_LB value in the SDO_DIM_ELEMENT definition of the ordinate in the measure dimension upper_bound Upper bound SDO_UB value in the SDO_DIM_ELEMENT definition of the ordinate in the measure dimension tolerance Tolerance value see Section 1 5 5 and Section 7 6 This function converts a standard dimensional array to an LRS dimensional array by creating a measure dimension Specifically it adds an SDO_DIM_ELEMENT object at the end of the current SDO_DIM_ELEMENT objects in the SDO_DIM_ ARRAY for the dimensional array unless another dim_pos is specified and sets the SDO_DIMNAME value in this added SDO_DIM_E
200. RY Usage Notes Examples bin_colname Column in bin_tablename that holds the bin geometries This function bins the geometry to the most intersecting bin in the specified bin table The following example computes the bin for a specified geometry SELECT sdo sam bin geometry a geometry 0 0000005 BINTBL GEOMETRY FROM poly 4pt a user_sdo_geom_metadata b WHERE b table name POLY 4PT AND a gid 1 SDO_SAM BIN GEOMETRY A GEOMETRY 0 0000005 BINTBL GEOMETRY 1 row selected Spatial Analysis and Mining Subprograms 21 9 SDO_SAM BIN_LAYER SDO_SAM BIN_LAYER Format SDO_SAM BIN_LAYER tablename IN VARCHAR2 colname IN VARCHAR2 bin_tablename IN VARCHAR2 bin_colname IN VARCHAR2 bin_id_colname IN VARCHAR2 commit_interval IN NUMBER DEFAULT 20 Description Assigns each location and the corresponding row in a data mining table to a spatial bin Parameters tablename Name of the data mining table colname Name of the column in table_name that holds the location coordinates bin_tablename Name of the table that contains information precomputed for the entire two dimensional space about the spatial bins bin_colname Column in bin_tablename that holds the bin geometries bin_id_colname Name of the column in bin_tablename that holds the bin ID value of each geometry added to a bin 21 10 Oracle Spatial Users Guide and Reference SDO_SAM BIN_LAYER Usage Notes Examples commit_i
201. RY deprecated SDO_GEOM VALIDATE_LAYER deprecated SDO_AGGR_MBR spatial aggregate function new to Locator Chapter 14 with release 9 2 Package SDO_MIGRATE to upgrade data from previous Chapter 17 Spatial releases to the current release Object replication Oracle Database Advanced Replication Graphical tool for tuning spatial quadtree indexes Spatial Online help for Oracle Index Advisor integrated application in Oracle Enterprise Enterprise Manager Manager B 2 Oracle Spatial Users Guide and Reference Table B 2 lists Spatial features that are not supported for Locator with the chapter in this guide or the separate manual that describes the feature Table B 2 Spatial Features Not Supported for Locator Spatial Feature Described in Deferred updates to spatial indexes index status deferred with the ALTER INDEX statement SDO_GEOM package functions and procedures except for those listed in Table B 1 Spatial aggregate functions except for any listed in Table B 1 Linear referencing system LRS support Coordinate system support for explicit geometry and layer transformations SDO_CS TRANSFORM function and SDO_CS TRANSFORM_LAYER procedure Tuning functions and procedures SDO_TUNE package Spatial utility functions SDO_UTIL package Spatial analysis and mining functions and procedures SDO_SAM package Geocoding support SDO_GCDR package GeoRaster support Topology data model Network data
202. Referencing Subprograms 16 77 SDO_LRS OFFSET_GEOM_SEGMENT Examples The direction and measures of the resulting geometric segment are preserved that is they reflect the original segment The geometry type of geom_segment must be line or multiline For example it cannot be a polygon An exception is raised if geom_segment start_measure or end_measure is invalid The following example returns the geometric segment 2 distance units to the left positive offset 2 of the segment from measures 5 through 10 of Route 1 This example uses the definitions from the example in Section 7 7 Create a segment offset 2 to the left from measures 5 through 10 First display the original segment then offset SELECT a route_geometry FROM lrs_routes a WHERE a route_id 1 ROUTE GEOMETRY SDO_GTYPE SDO SRID SDO POINT X Y Z SDO ELEM INFO SDO ORDIN SDO GEOMETRY 3302 NULL NULL SDO ELEM INFO ARRAY 1 2 1 SDO ORDINATE ARRAY 2 2 0 2 4 2 8 4 8 12 4 12 12 10 18 8 10 22 5 14 27 SELECT SDO_LRS OFFSET_GEOM SEGMENT a route_geometry m diminfo 5 10 2 FROM lrs_ routes a user sdo geom_ metadata m WHERE m table name LRS ROUTES AND m column_name ROUTE_GEOMETRY AND a route_id 1 SDO_LRS OFFSET GEOM SEGMENT A ROUTE GEOMETRY M DIMINFO 5 10 2 SDO_GTYPE SDO SR SDO GEOMETRY 3302 NULL NULL SDO ELEM INFO ARRAY 1 2 1 SDO ORDINATE ARRAY 5 6 5 10 6 10 Note in SDO ORDINATE ARRAY of th
203. Returns OVERLAPBDYDISJOINT if the objects overlap but their boundaries do not interact otherwise returns FALSE a OVERLAPBDYINTERSECT Returns OVERLAPBDYINTERSECT if the objects overlap and their boundaries intersect in one or more places otherwise returns FALSE a TOUCH Returns TOUCH if the two objects share a common boundary point but no interior points otherwise returns FALSE Values for mask can be combined using the logical Boolean operator OR For example INSIDE TOUCH returns INSIDE TOUCH or FALSE depending on the outcome of the test If the function format with tol is used all geometry objects must be defined using 4 digit SDO_GTYPE values explained in Section 2 2 1 An exception is raised if geom1 and geom2 are based on different coordinate systems Examples The following example finds the relationship between each geometry in the SHAPE column and the cola_b geometry The example uses the definitions and data from Section 2 1 The output is reformatted for readability SELECT c name SDO_GEOM RELATE c shape determine c_b shape 0 005 relationship FROM cola_markets c cola_markets c_b WHERE c_b name cola b NAME RELATIONSHIP cola a TOUCH cola b EQUAL cola c OVERLAPBDYINTERSECT cola d DISJOINT 13 6 Oracle Spatial Users Guide and Reference SDO_GEOM RELATE Related Topics a SDO_RELATE operator Geometry Subprograms 13 7 SDO_GEOM SDO_ARC_DENSIFY SDO_GEOM SDO_ARC_DENS
204. Rout e0 has decreasing measure values This example uses the definitions from the example in Section 7 7 Add a segment with route_id less than 1 here zero INSERT INTO lrs_ routes VALUES 0 Route0 SDO_GEOMETRY 3302 Line string 3 dimensions X Y M 3rd is measure dimension NULL NULL SDO ELEM INFO ARRAY 1 2 1 One line string straight segments SDO_ORDINATE ARRAY 5 14 5 Starting point 5 is measure from start 10 14 0 Ending point 0 measure decreasing measure Ne 1 row created Concatenate all routes no ordering specified SELECT SDO AGGR_LRS CONCAT SDOAGGRTYPE route geometry 0 005 FROM lrs_ routes SDO_AGGR_LRS_CONCAT SDOAGGRTYPE ROUTE GEOMETRY 0 005 SDO_GTYPE SDO SRID SDO GEOMETRY 3302 NULL NULL SDO ELEM INFO ARRAY 1 2 1 SDO ORDINATE ARRAY 2 2 0 2 4 2 8 4 8 12 4 12 12 10 18 8 10 22 5 14 27 10 14 32 Aggregate concatenation using subquery for ordering SELECT SDO_AGGR_LRS CONCAT SDOAGGRTYPE route geometry 0 005 FROM SELECT NO MERGE route geometry FROM lrs_ routes ORDER BY route_id SDO_AGGR_LRS_CONCAT SDOAGGRTYPE ROUTE GEOMETRY 0 005 SDO_GTYPE SDO SRID SDO GEOMETRY 3302 NULL NULL SDO ELEM INFO ARRAY 1 2 1 SDO ORDINATE ARRAY 2 2 32 2 4 30 8 4 24 12 4 20 12 10 14 8 10 10 5 14 5 10 14 0 14 8 Oracle Spatial Users Guide and Reference SDO_AGGR_MBR SDO_AGGR_MBR
205. S A Query Points B WHERE B GID 1 AND SDO WITHIN DISTANCE A Geometry B Geometry distance 10 TRUE See also the more complex SDO_WITHIN_DISTANCE examples in Section C 2 a SDO FILTER a SDO_RELATE 12 48 Oracle Spatial User s Guide and Reference 13 Geometry Subprograms This chapter contains descriptions of the geometry related PL SQL subprograms in the SDO_GEOM package which can be grouped into the following categories a Relationship True False between two objects RELATE WITHIN_DISTANCE a Validation VALIDATE _GEOMETRY_WITH_CONTEXT VALIDATE_LAYER_ WITH_CONTEXT a Single object operations SDO_ARC_DENSIFY SDO_AREA SDO_BUFFER SDO_CENTROID SDO_CONVEXHULL SDO_LENGTH SDO_MAX_MBR_ ORDINATE SDO_MIN_MBR_ORDINATE SDO_MBR SDO_ POINTONSURFACE Two object operations SDO_DISTANCE SDO_DIFFERENCE SDO_ INTERSECTION SDO_UNION SDO_XOR The geometry subprograms are listed Table 13 1 and some usage information follows the table Table 13 1 Geometry Subprograms Subprogram Description SDO_GEOM RELATE Determines how two objects interact SDO_GEOM SDO_ARC_DENSIFY Changes each circular arc into an approximation consisting of straight lines and each circle into a polygon consisting of a series of straight lines that approximate the circle SDO_GEOM SDO_AREA Computes the area of a two dimensional polygon SDO_GEOM SDO_BUFFER Generates a buffer polygon around or inside a geometry Geometry Sub
206. SDO_GEOMETRY Returns the minimum bounding rectangle of a geometry object that is a single rectangle that minimally encloses the geometry geom Geometry object dim Dimensional information array corresponding to geom usually selected from one of the xxx_SDO_GEOM_METADATA views described in Section 2 4 This function does not return an MBR geometry if a proper MBR cannot be constructed Specifically Ifthe input geometry is null the function returns a null geometry Ifthe input geometry is a point the function returns the point Ifthe input geometry consists of points all on a straight line the function returns a two point line The following example returns the minimum bounding rectangle of the cola_d geometry in the COLA_MARKETS table The example uses the definitions and data from Section 2 1 Because cola_d is a circle the minimum bounding rectangle in this case is a square Geometry Subprograms 13 33 SDO_GEOM SDO_MBR Related Topics Return the minimum bounding rectangle of cola d a circle SELECT SDO_GEOM SDO MBR c shape m diminfo FROM cola_markets c user _sdo geom metadata m WHERE m table name COLA MARKETS AND m column_ name SHAPE AND c name cola d SDO_GEOM SDO MBR C SHAPE M DIMINFO SDO_GTYPE SDO_SRID SDO POINT X Y Z SDO SDO GEOMETRY 2003 NULL NULL SDO ELEM INFO ARRAY 1 1003 3 SDO ORDINATE ARR AY 6 7 10 11 a SDO_GEOM SDO_MAX_MBR_ORDINATE a SDO_GEOM SDO_M
207. SDO_ORDINATE_ARRAY starts and ends at the same point 4 5 Related Topics SDO_GEOM SDO_DIFFERENCE a SDO_GEOM SDO_UNION a SDO_GEOM SDO_XOR 13 28 Oracle Spatial User s Guide and Reference SDO_GEOM SDO_LENGTH SDO_GEOM SDO_LENGTH Format SDO_GEOM SDO_LENGTH geom IN SDO_GEOMETRY dim IN SDO_DIM_ARRAY unit IN VARCHAR2 RETURN NUMBER or SDO_GEOM SDO_LENGTH geom IN SDO_GEOMETRY tol IN NUMBER unit IN VARCHAR2 RETURN NUMBER Description Returns the length or perimeter of a geometry object Parameters geom Geometry object dim Dimensional information array corresponding to geom usually selected from one of the xxx_SDO_GEOM_METADATA views described in Section 2 4 unit Unit of measurement a quoted string with unit and an SDO_UNIT value from the MDSYS SDO_DIST_UNITS table for example unit KM See Section 2 6 for more information about unit of measurement specification If this parameter is not specified the unit of measurement associated with the data is assumed For geodetic data the default unit of measurement is meters Geometry Subprograms 13 29 SDO_GEOM SDO_LENGTH Usage Notes Examples Related Topics tol Tolerance value see Section 1 5 5 If the input polygon contains one or more holes this function calculates the perimeters of the exterior boundary and all holes It returns the sum of all perimeters If the function format with tol is used all geometry
208. SEGMENT route geometry 2 FROM lrs_ routes WHERE route_id 1 SDO_LRS VALID GEOM SEGMENT ROUTE GEOMETRY SQL gt Is 50 a valid measure on Routel Should return FALSE highest Routel measure is 27 SQL gt SELECT SDO LRS VALID MEASURE route geometry 50 2 FROM lrs_ routes WHERE route_id 1 SDO_LRS VALID MEASURE ROUTE GEOMETRY 50 SQL gt Is the Routel segment defined SQL gt SELECT SDO_LRS IS GEOM SEGMENT DEFINED route geometry 2 FROM lrs_ routes WHERE route_id 1 SDO_LRS IS GEOM SEGMENT DEFINED ROUTE GEOMETRY SQL gt How long is Routel SQL gt SELECT SDO_LRS GEOM SEGMENT LENGTH route geometry 2 FROM lrs_ routes WHERE route_id 1 SDO_LRS GEOM SEGMENT LENGTH ROUTE GEOMETRY SQL gt What is the start measure of Routel Linear Referencing System 7 29 Example of LRS Functions SQL gt SELECT SDO_LRS GEOM SEGMENT START MEASURE route geometry 2 FROM lrs_ routes WHERE route_id 1 SDO_LRS GEOM SEGMENT START MEASURE ROUTE GEOMETRY SQL gt What is the end measure of Routel SQL gt SELECT SDO_LRS GEOM SEGMENT END MEASURE route geometry 2 FROM lrs_ routes WHERE route_id 1 SDO_LRS GEOM SEGMENT END MEASURE ROUTE GEOMETRY SQL gt What is the start point of Routel SQL gt SELECT SDO_LRS GEOM SEGMENT START PT route geometry 2 FROM lrs_ routes WHERE route_id 1 SDO_LRS GEOM SEGMENT START PT ROUTE GEOMETRY SDO_GTYPE SDO SRID SDO POINT X SDO GEOMETRY 3301 NU
209. SEGMENT_START_PT SDO_LRS GEOM_SEGMENT_END_PT SDO_LRS GEOM_SEGMENT_START_ MEASURE SDO_LRS GEOM_SEGMENT_END_ MEASURE SDO_LRS GET_MEASURE 16 2 Oracle Spatial Users Guide and Reference Description Checks if a geometric segment is valid Checks if an LRS point is valid Checks if a measure falls within the measure range ofa geometric segment Checks if two geometric segments are spatially connected Returns the length of a geometric segment Returns the start point of a geometric segment Returns the end point of a geometric segment Returns the start measure of a geometric segment Returns the end measure of a geometric segment Returns the measure of an LRS point Table 16 2 Cont Subprograms for Querying and Validating Geometric Segments Subprogram Description SDO_LRS GET_NEXT_SHAPE_PT SDO_LRS GET_NEXT_SHAPE_PT MEASURE SDO_LRS GET_PREV_SHAPE_PT SDO_LRS GET_PREV_SHAPE_PT MEASURE SDO_LRS IS_GEOM_SEGMENT_ DEFINED SDO_LRS IS_MEASURE_DECREASING SDO_LRS IS_MEASURE_INCREASING SDO_LRS IS_SHAPE_PT_MEASURE SDO_LRS MEASURE_RANGE SDO_LRS MEASURE_TO_PERCENTAGE SDO_LRS PERCENTAGE_TO_MEASURE SDO_LRS LOCATE_PT SDO_LRS PROJECT_PT Returns the next shape point on a geometric segment after a specified measure value or LRS point Returns the measure value of the next shape point on a geometric segment after a specified measure value or LRS point Returns the previ
210. SOIDS or MDSYS PROJECTIONS tables Section 6 5 describes how to create a user defined coordinate system 6 4 1 MDSYS CS_SRS Table The MDSYS CS_SRS reference table contains over 900 rows one for each valid coordinate system 6 8 Oracle Spatial User s Guide and Reference Coordinate Systems Data Structures Note You should probably not modify delete or add any information in the MDSYS CS_SRS table If you do plan to modify this table you should connect to the database as the MDSYS user If you plan to add any user defined coordinate systems be sure to use SRID values of 1000000 1 million or higher and follow the guidelines in Section 6 5 The MDSYS CS_SRS table contains the columns shown in Table 6 1 Table 6 1 MDSYS CS_SRS Table Column Name Data Type Description CS NAME VARCHAR2 68 SRID NUMBER 38 AUTH_SRID NUMBER 38 AUTH_NAME VARCHAR2 256 WKTEXT VARCHAR2 2046 CS_BOUNDS SDO_GEOMETRY A well known name often mnemonic by which a user can refer to the coordinate system The unique ID number Spatial Reference ID for a coordinate system Currently SRID values 1 999999 are reserved for use by Oracle Spatial and values 1000000 1 million and higher are available for user defined coordinate systems An optional ID number that can be used to indicate how the entry was derived it might be a foreign key into another coordinate table for example An authority name for
211. SORT_AREA_ SIZE parameter R tree index creation 4 2 spatial aggregate functions See aggregate functions spatial analysis and mining conceptual and usage information 8 1 function reference information 21 1 spatial binning 8 4 See also bins spatial clustering 8 6 spatial correlation 8 5 spatial data mining function reference information 21 1 spatial data structures 2 1 spatial data types 2 1 spatial index See index spatialjoin 4 16 SDO_JOIN operator 12 19 spatial operators See Operators spatial query 4 9 spatial reference systems conceptual and usage information 6 1 example 6 21 subprogram reference information 15 1 SPATIAL_CLUSTERS function 21 19 sphere authalic 6 2 spheroids ellipsoids 6 15 SPLIT_GEOM_SEGMENT procedure 16 99 splitting geometric segment 7 13 SOL and PL SQL examples 1 24 SQL statements for indexing spatial data 10 1 SQL Loader 3 1 SRID 0 zero special case with SDO_CS VIEWPORT_ TRANSFORM function 15 10 in USER_SDO_GEOM_METADATA 2 28 SDO_SRID attribute in SDO_GEOMETRY 2 8 subprograms coordinate system transformation 15 1 data mining 21 1 geocoding 20 1 geometry 13 1 linear referencing 16 1 not supported with geodetic data 6 21 SDO_MIGRATE 17 1 spatial analysis 21 1 tuning 18 1 utility 19 1 synchronizing deferred index updates 10 2 Index 11 T table name restrictions on spatial table names 2 26 TABLE_NAME in USER_SDO_GEOM_ METADATA 2 26 three dimensio
212. Section 2 2 1 except that UNKNOWN_GEOMETRY is not allowed In addition specifying POINT allows for optimized processing of point data Data type is VARCHAR2 Specifies the number of dimensions to be indexed For example a value of 2 causes the first two dimensions to be indexed Must be less than or equal to the number of actual dimensions number of SDO_DIM_ELEMENT instances in the dimensional array that describes the geometry objects in the column If the value is 3 or higher the only Spatial operator that can be used on the indexed geometries is SDO_FILTER the other operators described in Chapter 12 cannot be used Data type is NUMBER Default 2 10 10 Oracle Spatial Users Guide and Reference CREATE INDEX Value Description sdo_non_leaf_tbl sdo_rtr_pctfree PHYSICAL_STORAGE_ PARAMS tablespace initial next minextents maxextents pctincrease work_tablespace sdo_non_leaf_tbl TRUE creates a separate index table with a name in the form MDNT_ for nonleaf nodes of the index in addition to creating an index table with a name in the form MDRT_ for leaf nodes sdo_non leaf _tbl FALSE creates a single table with a name in the form MDRT_ for both leaf nodes and nonleaf nodes of the index See the Usage Notes for more information Data type is VARCHAR2 Default FALSE Specifies the minimum percentage of slots in each index tree node to be left empty when the index is created Slots
213. Spatial Analysis and Mining Subprograms The MDSYS SDO_SAM package contains subprograms for spatial analysis and data mining To use the subprograms in this chapter you must understand the conceptual information about spatial analysis and data mining in Chapter 8 Table 21 1 lists the spatial analysis and mining subprograms Table 21 1 Subprograms for Spatial Analysis and Mining Function Description SDO_SAM AGGREGATES_FOR_ GEOMETRY SDO_SAM AGGREGATES_FOR_ LAYER SDO_SAM BIN_GEOMETRY SDO_SAM BIN_LAYER SDO_SAM COLOCATED_ REFERENCE_FEATURES SDO_SAM SIMPLIFY_GEOMETRY SDO_SAM SIMPLIFY_LAYER SDO_SAM SPATIAL_CLUSTERS Computes the thematic aggregate for a geometry Computes thematic aggregates for a layer of geometries Computes the most intersecting tile for a geometry Assigns each location and the corresponding row in a data mining table to a spatial bin Performs a partial predicate based join of tables and materializes the join results into a table Simplifies a geometry Simplifies a geometry layer Computes clusters using the existing R tree index and returns a set of SDO_REGION objects where the geometry column specifies the boundary of each cluster and the geometry_key value is set to null Spatial Analysis and Mining Subprograms 21 1 Table 21 1 Cont Subprograms for Spatial Analysis and Mining Function Description SDO_SAM TILED_AGGREGATES Tiles aggregates for a domain
214. Standard_Parallel_2 in decimal degrees Central_Meridian in decimal degrees Latitude_of_Origin in decimal degrees Azimuth in decimal degrees False Easting in meters False Northing in meters Perspective Point Height in meters Landsat Number must be 1 2 3 4 or 5 Path Number Scale Factor 6 18 Oracle Spatial Users Guide and Reference Creating a User Defined Coordinate System Some of these parameters are appropriate for several projections They are not all appropriate for every projection Example 6 2 creates a user defined projected coordinate system The first four columns are not the WKT information but specify other fields in the MSDYD CS_ SRS table The WKT information starts with PROJCS This example is similar to an existing coordinate system but has a different name SRID and central meridian Example 6 2 Creating a User Defined Projected Coordinate System INSERT INTO mdsys cs_ srs VALUES UTM Zone 44 5 Northern Hemisphere WGS 84 1082378 1082378 Oracle PROJCS UTM Zone 44 5 Northern Hemisphere WGS 84 GEOGCS WGS 84 DATUM WGS 84 SPHEROID WGS 84 6378137 000000 298 257224 PRIMEM Greenwich 0 000000 J UNIT Decimal Degree 0 01745329251994330 PROJECTION Transverse Mercator PARAMETER Scale Factor 0 999600 PARAMETER Central Meridian 84 000000 PARAMETER False Easting 500000 000000 UNIT Meter 1 000000000000 NULL Exa
215. Store PL SQL and SQL Plus are trademarks or registered trademarks of Oracle Corporation Other names may be trademarks of their respective owners Contents Send Us Your Comments oo cccccccccesssessssssssssessecssecssscssnscssecenccssccsuceusecsuecsseesseceaneesnecesecasseess xxi A E RE xxiii AU ICI CO 2004 SB essere Hen See ees a Oe Sa te i ee ese te ceo eso Sad eS ee xxiv Documentation Accessibility serena iii di bits aiii xxiv OP RANIZ ATOM AAA e Ee E A E EENE ETENEE aA AT E AEE ANEL E E E EE sb XXV Technologies Released Separately ccccccsscssscsssssesesescscesesescsessesesescsssssesesescsesesesescseseseseecenes xxvii Related DoCuMmentation inaen anse entea ae a aa iea aa aae ai Eada ori nia a aa dnia aAa xxviii CONVENTIONS india sara a a esia s a ene a a e xxviii New and Changed Features occ eccccescssssssseeessnsecsnsesssssessneessncesnscesnseesnseesnseesnneeesnteesaness xxxi G oR stet iii a a a T S S XXxi Topology and Network Management cccccccccescssseeseesesssescecenesesesnsneenesescenesesessenesesesnsneneneeeeney XXxi Spatial Analysis QA Mining coi dae iaa XXxii GOO COG TING es cess les Sect A E E TA XXxii Quadtree Indexing Discouraged R Tree Indexing Encouraged ococononicinnnnnonininnononinnaninorinninss Xxxii New Utility Subprogram pirea iria Aa XXxii New Operators noia AI A OOO xxxiii SDO_NN Operator Behavior Chan geSsssieisennenissannu aai XXXIV New Spatial Aggregate Function icon iii int XXXIV Ne
216. Structures 6 4 Coordinate Systems Data Structures The coordinate systems functions and procedures use information provided in the following tables supplied with Oracle Spatial MDSYS CS_SRS see Section 6 4 1 defines the valid coordinate systems It associates each coordinate system with its well known text description which is in conformance with the standard published by the Open GIS Consortium http www opengis org MDSYS SDO_ANGLE_UNITS see Section 6 4 2 defines the valid angle units The angle unit is part of the well known text description MDSYS SDO_DIST_UNITS see Table 2 6 in Section 2 6 defines the valid distance units The distance unit is included in the well known text description MDSYS SDO_DATUMS see Section 6 4 3 defines the valid datums The datum is part of the well known text description MDSYS SDO_ELLIPSOIDS see Section 6 4 4 defines the valid ellipsoids The ellipsoid SPHEROID specification is part of the well known text description MDSYS SDO_PROJECTIONS see Section 6 4 5 defines the valid map projections The map projection is part of the well known text description Note You should not modify or delete any Oracle supplied information in any of the tables that are used for coordinate system support You should not add any information to the MDSYS CS_SRS table unless you are creating a user defined coordinate system Do not add information to the MDSYS SDO_DATUMS MDSYS SDO_ ELLIP
217. T SDO_CS VIEWPORT_ TRANSFORM SDO GEOMETRY 2003 0 NULL SDO ELEM INFO ARRAY 1 1003 3 SDO_ORDINATE ARRAY 180 90 180 90 8307 window _ geom FROM DUAL WHERE SDO FILTER c shape window _geom TRUE Coordinate System Transformation Subprograms 15 11 SDO_CS VIEWPORT_TRANSFORM 15 12 Oracle Spatial Users Guide and Reference 16 Linear Referencing Subprograms The MDSYS SDO_LRS package contains subprograms that create modify query and convert linear referencing elements These subprograms do not change the state of the database Most LRS subprograms are functions To use the subprograms in this chapter you must understand the linear referencing system LRS concepts and techniques described in Chapter 7 Table 16 1 lists subprograms related to creating and editing geometric segments Table 16 1 Subprograms for Creating and Editing Geometric Segments Subprogram Description SDO_LRS DEFINE_GEOM_SEGMENT SDO_LRS REDEFINE_GEOM_SEGMENT SDO_LRS CLIP_GEOM_SEGMENT SDO_LRS DYNAMIC_SEGMENT SDO_LRS CONCATENATE_GEOM_ SEGMENTS SDO_LRS OFFSET_GEOM_SEGMENT SDO_LRS SCALE_GEOM_SEGMENT deprecated SDO_LRS SPLIT_GEOM_SEGMENT Defines a geometric segment Populates the measures of all shape points of a geometric segment based on the start and end measures overriding any previously assigned measures between the start point and end point Clips a geometric segment synonym of SDO_ LRS DYNAMIC_SEGME
218. TS table 2 33 CONVERT_TO_LRS_DIM_ARRAY function 16 13 CONVERT_TO_LRS_GEOM function 16 16 CONVERT_TO_LRS_LAYER function 16 19 CONVERT_TO_STD_DIM_ARRAY function 16 22 CONVERT_TO_STD_GEOM function 16 24 CONVERT_TO_STD_LAYER function 16 26 CONVERT_UNIT function 19 9 converting geometric segments overview 7 19 subprograms for 16 4 convex hull SDO_AGGR_CONVEXHULL aggregate function 14 6 SDO_CONVEXHULL function 13 19 coordinate systems conceptual and usage information 6 1 example 6 21 local 6 7 subprogram reference information 15 1 unit of measurement support 2 32 user defined 6 17 coordinates Cartesian 1 7 6 2 geodetic 1 7 6 2 6 3 geographic 1 7 6 2 local 1 7 6 2 projected 1 7 6 2 COVEREDBY SDO_COVEREDBY operator 12 7 topological relationship 1 16 COVERS SDO_COVERS operator 12 9 topological relationship 1 16 CPU requirements for spatial applications 1 23 CREATE INDEX statement 10 10 creating geometric segments subprograms for 16 1 cross schema index creation 4 5 CS_SRS table 6 8 current release upgrading spatial data to 17 2 D data mining spatial colocation mining 8 5 conceptual and usage information 8 1 function reference information 21 1 data model 1 5 LRS 7 8 data types spatial 2 1 database links not supported if spatial index is defined on the table 4 9 datum geodetic 1 7 6 2 MDSYS SDO_DATUMS table 6 12 transformation 6 3 dblink n
219. TT SDO_KEYWORDARRAY 1 Carlton B Goodlett Pl San Francisco CA 94102 USS RELAX BASE NAME Side RROM DUAL SELECT SDO_GCDR GEOCODE SCOTT SDO_KEYWORDARRAY 1 Carlton B Goodlett Pl San Francisco CA 94102 US RELAX BASE NAME Percent FROM DUAL SDO_GCDR GEOCODE SCOTT SDO_KEYWORDARRAY 1CARLTONBGOODLETTPL SANFRANCISCO SELECT SDO_GCDR GEOCODE SCOTT SDO_KEYWORDARRAY 1 Carlton B Goodlett Pl San Francisco CA 94102 US RELAX BASE NAME EdgeID FROM DUAL 5 8 Oracle Spatial User s Guide and Reference Using the Geocoding Capabilities SDO_GCDR GEOCODE SCOTT SDO_KEYWORDARRAY 1CARLTONBGOODLETTPL SANFRANCISCO 23614360 SELECT SDO_GCDR GEOCODE SCOTT SDO_KEYWORDARRAY 1 Carlton B Goodlett Pl San Francisco CA 94102 US RELAX BASE NAME MatchCode FROM DUAL SDO_GCDR GEOCODE SCOTT SDO_KEYWORDARRAY 1CARLTONBGOODLETTPL SANFRANCISCO 5 2 2 SDO_ADDR_ARRAY Type The SDO_ADDR_ARRAY type is a VARRAY of SDO_GEO_ADDR objects described in Section 5 2 1 used to store geocoded address results Multiple address objects can be returned when multiple addresses are matched as a result of a geocoding operation The SDO_ADDR_ARRAY type is defined as follows CREATE TYPE sdo_addr_array AS VARRAY 1000 OF sdo geo addr 5 2 3 SDO_KEYWORDARRAY Type The SDO_KEYWORDARRAY type is a VARRAY of VARCHAR strings used to store address lines for unformatted addresses Formatted and u
220. TYPE SDO SRID SDO P SDO GEOMETRY 3302 NULL NULL SDO ELEM INFO ARRAY 1 2 1 SDO ORDINATE ARRAY 2 2 0 2 4 3 218 8 4 12 872 12 4 19 308 12 10 28 962 8 10 35 398 5 14 43 443 Linear Referencing Subprograms 16 95 SDO_LRS SET_PT_MEASURE SDO_LRS SET_PT_MEASURE Format Description SDO_LRS SET_PT_MEASURE geom_segment IN OUT SDO_GEOMETRY point IN SDO_GEOMETRY measure IN NUMBER RETURN VARCHAR2 or SDO_LRS SET_PT_MEASURE geom_segment IN OUT SDO_GEOMETRY dim_array IN SDO_DIM_ARRAY point IN SDO_GEOMETRY pt_dim_array IN SDO_DIM_ARRAY measure IN NUMBER RETURN VARCHAR2 or SDO_LRS SET_PT_MEASURE point IN OUT SDO_GEOMETRY measure IN NUMBER RETURN VARCHAR2 or SDO_LRS SET_PT_MEASURE point IN OUT SDO_GEOMETRY dim_array IN SDO_DIM_ARRAY measure IN NUMBER RETURN VARCHAR2 Sets the measure value of a specified point 16 96 Oracle Spatial User s Guide and Reference SDO_LRS SET_PT_MEASURE Parameters Usage Notes geom_segment Geometric segment containing the point dim_array Dimensional information array corresponding to geom_segment in the second format or point in the fourth format usually selected from one of the xxx_SDO_ GEOM_METADATA views described in Section 2 4 point Point for which the measure value is to be set pt_dim_array Dimensional information array corresponding to point in the second format usually selected from one of the xxx_SDO_GEOM
221. T_OF function 18 7 geodetic 6 4 SDO_AGGR_MBR aggregate function 14 9 SDO_MAX_MBR_ORDINATE function 13 31 SDO_MBR function 13 33 SDO_MIN_MBR_ORDINATE function 13 35 mining See data mining MIX_INFO procedure 18 9 multiline string boundary of 1 15 multimaster replication SDO_GEOMETRY objects B 4 multipolygon 2 17 N nearest neighbor SDO_NN operator 12 23 SDO_NN_DISTANCE operator 12 29 neighborhood influence 8 5 NLS_LENGTH_SEMANTICS parameter spatial queries on UTF8 data 4 9 non geodetic index 4 3 O object types embedding SDO_GEOMETRY objects in 9 1 9 6 OCI Oracle Call Interface examples 1 23 ODM See Oracle Data Mining ODM offset 7 4 FIND_OFFSET function 16 36 OFFSET_GEOM_SEGMENT function 16 76 offsetting geometric segment 7 16 ON SDO_ON operator 12 31 topological relationship 1 16 operators cross schema invocation 4 17 overview 1 18 performance related guidelines 1 18 SDO_ANYINTERACT 12 3 SDO_CONTAINS 125 SDO_COVEREDBY 12 7 SDO_COVERS 12 9 SDO_EQUAL 12 11 SDO_FILTER 12 13 SDO_INSIDE 12 17 SDO_JOIN 12 19 SDO_NN 12 23 SDO_NN_DISTANCE 12 29 SDO_ON 12 31 SDO_OVERLAPBDYDISJOINT 12 33 SDO_OVERLAPBDYINTERSECT 12 35 SDO_OVERLAPS 12 37 SDO_RELATE 12 39 SDO_TOUCH 12 44 SDO_WITHIN_DISTANCE 12 46 optimized rectangle 2 13 Oracle Call Interface OCI examples 1 23 Oracle Data Mining ODM spatial analysis and mining information 8 1 Oracle Database 10 upgradi
222. T_PT Format Description Parameters Usage Notes Examples SDO_LRS GEOM_SEGMENT_START_PT geom_segment IN SDO_GEOMETRY dim_array IN SDO_DIM_ARRAY RETURN SDO_GEOMETRY Returns the start point of a geometric segment geom_segment Geometric segment whose start point is to be returned dim_array Dimensional information array corresponding to geom_segment usually selected from one of the xxx_SDO_GEOM_METADATA views described in Section 2 4 This function returns the start point of geom_segment An exception is raised if geom_segment has an invalid geometry type or dimensionality The _3D format of this function GDO_LRS GEOM_SEGMENT_START_PT_3D is available For information about _3D formats of LRS functions see Section 7 4 The following example returns the start point of the geometric segment representing Route 1 This example uses the definitions from the example in Section 7 7 SELECT SDO_LRS GEOM SEGMENT START PT route geometry FROM lrs_ routes WHERE route_id 1 SDO_LRS GEOM SEGMENT START PT ROUTE GEOMETRY SDO_GTYPE SDO SRID SDO POINT X 16 46 Oracle Spatial User s Guide and Reference SDO_LRS GEOM_SEGMENT_START_PT SDO_GEOMETRY 3301 NULL NULL SDO ELEM INFO ARRAY 1 1 1 SDO ORDINATE ARRAY 2 2 0 Linear Referencing Subprograms 16 47 SDO_LRS GET_MEASURE SDO_LRS GET_MEASURE Format Description Parameters Usage Notes Examples SDO_LRS GET_MEASURE po
223. The following example finds the measure for the point on the geometric segment representing Route 1 that is closest to the point 10 7 This example uses the definitions from the example in Section 7 7 Find measure for point on segment closest to 10 7 Should return 15 for point 12 7 SELECT SDO_LRS FIND MEASURE a route_geometry m diminfo SDO GEOMETRY 3001 NULL NULL SDO_ELEM_INFO ARRAY 1 1 1 SDO_ORDINATE ARRAY 10 7 NULL FROM lrs_ routes a user_sdo geom metadata m WHERE m table name LRS ROUTES AND m column_name ROUTE GEOMETRY AND a route_id 1 SDO_LRS FIND MEASURE A ROUTE GEOMETRY M DIMINFO SDO GEOMETRY 3001 NULL NUL Linear Referencing Subprograms 16 35 SDO_LRS FIND_OFFSET SDO_LRS FIND_OFFSET Format SDO_LRS FIND_OFFSET geom_segment IN SDO_GEOMETRY point IN SDO_GEOMETRY tolerance IN NUMBER RETURN NUMBER or SDO_LRS FIND_OFFSET geom_segment IN SDO_GEOMETRY dim_array IN SDO_DIM_ARRAY point IN SDO_GEOMETRY point_dim_array IN SDO_GEOMETRY RETURN NUMBER Description Returns the signed offset shortest distance from a point to a geometric segment Parameters geom_segment Geometric segment to be checked for distance from point point Point whose shortest distance from geom_segment is to be returned tolerance Tolerance value see Section 1 5 5 and Section 7 6 dim_array Dimensional information array corresponding to geom_segment usually selected from one
224. Type and Description values reflect the OGIS specification Table 2 1 Valid SDO_GTYPE Values Value Geometry Type Description dl00 UNKNOWN_ Spatial ignores this geometry GEOMETRY dl01 POINT Geometry contains one point dl02 LINE or CURVE Geometry contains one line string that can contain straight or circular arc segments or both LINE and CURVE are synonymous in this context dl03 POLYGON Geometry contains one polygon with or without holes dl04 COLLECTION Geometry is a heterogeneous collection of elements COLLECTION is a superset that includes all other types dl05 MULTIPOINT Geometry has one or more points MULTIPOINT is a superset of POINT Spatial Data Types and Metadata 2 7 SDO_GEOMETRY Object Type Table 2 1 Cont Valid SDO_GTYPE Values Value Geometry Type Description dl06 MULTILINE or Geometry has one or more line strings MULTILINE MULTICURVE and MULTICURVE are synonymous in this context and each is a superset of both LINE and CURVE dl07 MULTIPOLYGON Geometry can have multiple disjoint polygons more than one exterior boundary MULTIPOLYGON is a superset of POLYGON 1 For a polygon with holes enter the exterior boundary first followed by any interior boundaries 2 Polygons in the collection can be disjoint The d in the Value column of Table 2 1 is the number of dimensions 2 3 or 4 For example an SDO_GTYPE value of 2003 indicates a two dimensional polygon Note The pre re
225. UL SDO_GEOMETRY 2003 NULL NULL SDO ELEM INFO ARRAY 1 1003 1 SDO_ORDINATE ARR AY 5 1 8 1 8 6 5 7 5 1 Related Topics None 19 28 Oracle Spatial User s Guide and Reference SDO_UTIL REVERSE_LINESTRING SDO_UTIL REVERSE_LINESTRING Format Description Parameters Usage Notes Examples SDO_UTIL REVERSE_LINESTRING geometry IN SDO_GEOMETRY RETURN SDO_GEOMETRY Returns a line string geometry with the vertices of the input geometry in reverse order geometry Line string geometry whose vertices are to be reversed in the output geometry The SDO_GTYPE value of the input geometry must be 2002 Section 2 2 1 explains SDO_GTYPE values Because the SDO_GTYPE value of the input geometry must be 2002 this function cannot be used to reverse LRS geometries To reverse an LRS geometry use the SDO_LRS REVERSE_GEOMETRY function which is described in Chapter 16 The following example returns a line string geometry that reverses the vertices of the input geometry SELECT SDO UTIL REVERSE LINESTRING SDO GEOMETRY 2002 8307 NULL SDO ELEM INFO ARRAY 1 2 1 SDO_ORDINATE ARRAY 72 43 71 5 43 5 71 42 70 40 FROM DUAL SDO_UTIL REVERSE LINESTRING SDO GEOMETRY 2002 8307 NULL SDO ELEM INFO ARRAY 1 2 SDO_ GEOMETRY 2002 8307 NULL SDO ELEM INFO ARRAY 1 2 1 SDO ORDINATE ARRAY 70 40 71 42 71 5 43 5 72 43 Spatial Utility Subprograms 19 29 SDO_UTIL REVERSE_LINESTRING
226. ULL SDO ELEM INFO ARRAY 1 2 1 SDO ORDINATE ARRAY 5 1 8 1 Perform aggregate concatenation of all line geometries in layer SELECT SDO_AGGR CONCAT LINES c shape FROM cola_markets c WHERE c mkt_id gt 1000 SDO_AGGR_CONCAT LINES C SHAPE SDO_GTYPE SDO SRID SDO POINT X Y Z SDO ELEM SDO GEOMETRY 2002 NULL NULL SDO ELEM INFO ARRAY 1 2 1 SDO ORDINATE ARRAY db 8 A Spatial Aggregate Functions 14 5 SDO_AGGR_CONVEXHULL SDO_AGGR_CONVEXHULL Format Description Parameters Usage Notes Examples SDO_AGGR_CONVEXHULL AggregateGeometry SDOAGGRTYPE RETURN SDO_GEOMETRY Returns a geometry object that is the convex hull of the specified geometry objects AggregateGeometry An object of type SDOAGGRTYPE see Section 1 10 1 that specifies the geometry column and dimensional array See also the information about the SDO_GEOM SDO_CONVEXHULL function in Chapter 13 The following example returns the convex hull of the geometry objects in the COLA_MARKETS table The example uses the definitions and data from Section 2 1 SELECT SDO AGGR_CONVEXHULL SDOAGGRTYPE shape 0 005 FROM cola_markets SDO_AGGR CONVEXHULL SDOAGGRTYPE SHAPE 0 005 SDO_GTYPE SDO SRID SDO POI SDO GEOMETRY 2003 NULL NULL SDO ELEM INFO ARRAY 1 1003 1 SDO ORDINATE ARR AY 8 1 10 7 10 11 8 11 6 11 1 7 1 1 8 1 14 6 Oracle Spatial Users Guide and Reference SDO_AGGR_LRS_CON
227. UTIL PREPARE_FOR_TTS table_space IN VARCHAR2 Prepares a tablespace to be transported to another database so that spatial indexes will be preserved during the transport operation table_space Tablespace to be transported Before Oracle Database 10 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 PREPARE _FOR_TTS procedure just before you perform the export operation and you must call it for each user that has a spatial index in the specified tablespace After the export operation is complete you must call the SDO_UTIL INITIALIZE_ INDEXES_FOR_TTS procedure to initialize all spatial indexes in the transported tablespace For detailed information about transportable tablespaces and transporting tablespaces to other databases see Oracle Database Administrator s Guide The following example prepares a tablespace named TS1 to be transported to another database CALL SDO UTIL PREPARE FOR TTS TS1 Spatial Utility Subprograms 19 25 SDO_UTIL PREPARE_FOR_TTS Related Topics SDO_UTIL INITIALIZE INDEXES_FOR_TTS 19 26 Oracle Spatial Users Guide and Reference SDO_UTIL REMOVE_DUPLICATE_VERTICES SDO_UTIL REMOVE_DUPLICATE_VERTICES Format Description Parameters Usage Notes Examples SDO
228. XHULL aggregate function 14 6 SDO_AGGR_LRS_CONCAT aggregate function 14 7 SDO_AGGR_MBR aggregate function 14 9 SDO_AGGR_UNION aggregate function 14 11 SDO_ANGLE_UNITS table 6 12 SDO_ANYINTERACT operator 12 3 SDO_ARC_DENSIFY function 13 8 SDO_AREA function 13 11 SDO_AREA_UNITS table 2 33 SDO_BUFFER function 13 13 SDO_CENTROID function 13 17 SDO_CONTAINS operator 12 5 SDO_CONVEXHULL function 13 19 SDO_COVEREDBY operator 12 7 SDO_COVERS operator 12 9 SDO_CS package 15 1 TRANSFORM 15 2 TRANSFORM_LAYER 15 5 VALIDATE_WKT 15 7 VIEWPORT_TRANSFORM 15 9 SDO_DATUMS table 6 12 SDO_DIFFERENCE function 13 21 SDO_DIST_UNITS table 2 33 SDO_DISTANCE function 13 24 SDO_ELEM_INFO attribute 2 9 SDO_ELEM_INFO_ARRAY type 2 6 SDO_ELLIPSOIDS table 6 15 SDO_EQUAL operator 12 11 SDO_ETYPE value 2 10 2 11 SDO_FILTER operator 12 13 SDO_GCDR package 20 1 GEOCODE 20 2 GEOCODE_ALL 20 4 GEOCODE_AS_GEOMETRY 20 6 SDO_GEO_ADDR data type and constructors 5 6 SDO_GEOM package RELATE 13 4 SDO_ARC_DENSIFY 13 8 SDO_AREA 13 11 SDO_BUFFER 13 13 SDO_CENTROID 13 17 SDO_CONVEXHULL 13 19 SDO_DIFFERENCE 13 21 SDO_DISTANCE 13 24 SDO_INTERSECTION 13 26 SDO_LENGTH 13 29 SDO_MAX_MBR_ORDINATE 13 31 SDO_MBR 13 33 SDO_MIN_MBR_ORDINATE 13 35 SDO_POINTONSURFACE 13 37 SDO_UNION 13 39 SDO_XOR 13 42 VALIDATE _GEOMETRY 13 45 VALIDATE _GEOMETRY_WITH_ CONTEXT 13 47 VALIDATE_LAYER 13 50 VALIDATE_LAYER_WITH_CONTEXT
229. _ANYINTERACT geometry1 geometry2 Checks if any geometries in a table have the ANYINTERACT topological relationship with a specified geometry Equivalent to specifying the SDO_RELATE operator with mask ANYINTERACT See the section on the SDO_RELATE operator in this chapter for information about the operations performed by this operator and for usage requirements Keywords and Parameters Returns Usage Notes Value Description geometryl Specifies a geometry column in a table The column must be spatially indexed Data type is SDO_GEOMETRY geometry2 Specifies either a geometry from a table or a transient instance of a geometry Specified using a bind variable or SDO_GEOMETRY constructor Data type is SDO_GEOMETRY The expression SDO_ANYINTERACT geometry1 geometry2 TRUE evaluates to TRUE for object pairs that have the ANYINTERACT topological relationship and FALSE otherwise See the Usage Notes for the SDO_RELATE operator in this chapter For an explanation of the topological relationships and the nine intersection model used by Spatial see Section 1 8 Spatial Operators 12 3 SDO_ANYINTERACT Examples The following example finds geometries that have the ANYINTERACT relationship with a query window here a rectangle with lower left upper right coordinates 4 6 8 8 The example uses the definitions and data described in Section 2 1 and illustrated in Figure 2 1 SELECT c mkt_id c name FROM co
230. _LRS VALID_GEOM_SEGMENT SDO_LRS VALID_GEOM_SEGMENT Format Description Parameters Usage Notes Examples SDO_LRS VALID_GEOM_SEGMENT geom_segment IN SDO_GEOMETRY dim_array IN SDO_DIM_ARRAY RETURN VARCHAR2 Checks if a geometry object is a valid geometric segment geom_segment Geometric segment to be checked for validity dim_array Dimensional information array corresponding to geom_segment usually selected from one of the xxx_SDO_GEOM_METADATA views described in Section 2 4 This function returns TRUE if geom_segment is valid and FALSE if geom_ segment is not valid Measure information is assumed to be stored in the last element of the SDO_DIM_ ARRAY in the Oracle Spatial metadata This function only checks for geometry type and number of dimensions of the geometric segment To further validate measure information use the SDO_LRS IS_ GEOM_SEGMENT_DEFINED function The _3D format of this function SDO_LRS VALID_GEOM_SEGMENT_3D is available For information about _3D formats of LRS functions see Section 7 4 The following example checks if the geometric segment representing Route 1 is valid This example uses the definitions from the example in Section 7 7 16 104 Oracle Spatial User s Guide and Reference SDO_LRS VALID_GEOM_SEGMENT SELECT SDO LRS VALID GEOM SEGMENT route_geometry FROM lrs_ routes WHERE route_id 1 SDO_LRS VALID_GEOM SEGMENT ROUTE GEOMETRY Linear Referencing Subpro
231. _METADATA views described in Section 2 4 measure Measure value to be assigned to the specified point The function returns TRUE if the measure value was successfully set and FALSE if the measure value was not set If both geom_segment and point are specified the behavior of the procedure depends on whether or not point is a shape point on geom_segment Ifpoint isa shape point on geom_segment the measure value of point is set a If point is nota shape point on geom_segment the shape point on geom_ segment that is nearest to point is found and the measure value of that shape point is set The _3D format of this function SDO_LRS SET_PT_MEASURE_3D is available however only the formats that include the geom_segment parameter are available for SDO_LRS SET_PT_MEASURE_3D For information about _3D formats of LRS functions see Section 7 4 An exception is raised if geom_segment or point is invalid Linear Referencing Subprograms 16 97 SDO_LRS SET_PT_MEASURE Examples The following example sets the measure value of point 8 10 to 20 This example uses the definitions from the example in Section 7 7 Set the measure value of point 8 10 to 20 originally 22 DECLARE geom_segment SDO GEOMETRY dim_array SDO DIM ARRAY result VARCHAR2 32 BEGIN SELECT a route geometry into geom_segment FROM lrs routes a WHERE a route name Routel SELECT m diminfo into dim_array from user_sdo_geom metadata m WHERE
232. _NN Examples Example C 2 finds all interstate highways within 15 miles of the city of Tampa Example C 2 Finding All Highways Within a Distance of a City SELECT ORDERED i highway FROM geod cities c geod_interstates i WHERE c city Tampa AND sdo within distance i geom c location distance 15 unit mile TRUE Example C 2 finds all highways within 15 miles distance 15 unit mile of the specified city c city Tampa and by default the result is exact because the querytype parameter was not used to limit the query to a primary filter operation In the WHERE clause of this example a c city refers to the CITY column of the GEOD_CITIES table and Tampa is a value from the CITY column a i geom specifies the search column geomet ry1 the GEOM column of the GEOD_INTERSTATES table c location specifies the query window aGeom the spatial geometry in the LOCATION column of the GEOD_CITIES table in the row whose CITY column contains the value Tampa C 3 SDO_NN Examples The SDO_NN operator determines the nearest neighbor geometries to a geometry No assumptions should be made about the order of the returned results If you specify no optional parameters one nearest neighbor geometry is returned If you specify the optional sdo_num_res keyword you can request how many nearest neighbors you want but no other conditions in the WHERE clause are evaluated For example assume that you want the five
233. _SHAPE_PT_MEASURE SDO_LRS IS_SHAPE_PT_MEASURE Format Description Parameters Usage Notes SDO_LRS IS_SHAPE_PT_MEASURE geom_segment IN SDO_GEOMETRY measure IN NUMBER RETURN VARCHAR2 or SDO_LRS IS_SHAPE_PT_MEASURE geom_segment IN SDO_GEOMETRY dim_array IN SDO_DIM_ARRAY measure IN NUMBER RETURN VARCHAR2 Checks if a specified measure value is a shape point on a geometric segment geom_segment Geometric segment to be checked measure Measure value on the geometric segment to check if it is a shape point dim_array Dimensional information array corresponding to geom_segment usually selected from one of the xxx_SDO_GEOM_METADATA views described in Section 2 4 This function returns TRUE if the specified measure value is associated with a shape point and FALSE if the measure value is not associated with a shape point An exception is raised if measure is not a valid value for geom_segment Linear Referencing Subprograms 16 67 SDO_LRS IS_SHAPE_PT_MEASURE The _3D format of this function SDO_LRS IS_ SHAPE_PT_MEASURE_3D is available For information about _3D formats of LRS functions see Section 7 4 Examples The following example checks if measure 14 on the geometric segment representing Route 1 is a shape point This example uses the definitions from the example in Section 7 7 SELECT SDO_LRS IS SHAPE PT MEASURE a route geometry 14 FROM lrs_ routes a WHERE a route_ id
234. _UTIL REMOVE_DUPLICATE_VERTICES geometry IN SDO_GEOMETRY tolerance IN NUMBER RETURN SDO_GEOMETRY Removes duplicate redundant vertices from a geometry geometry Geometry from which to remove duplicate vertices tolerance Tolerance value see Section 1 5 5 When two consecutive vertices in a geometry are the same or within the tolerance value associated with the geometry Spatial considers the geometry to be invalid The Spatial geometry validation functions return the error ORA 13356 in these cases You can use the REMOVE_DUPLICATE_VERTICES function to change such invalid geometries into valid geometries If the input geometry does not contain any duplicate vertices it is returned The following example removes a duplicate vertex from the input geometry which is the same geometry as cola_b see Figure 2 1 and Example 2 1 in Section 2 1 except that it has been deliberately made invalid by adding a third vertex that is the same point as the second vertex 8 1 SELECT SDO UTIL REMOVE DUPLICATE VERTICES SDO_GEOMETRY 2003 two dimensional polygon Spatial Utility Subprograms 19 27 SDO_UTIL REMOVE_DUPLICATE_VERTICES NULL NULL SDO_ELEM_ INFO ARRAY 1 1003 1 one polygon exterior polygon ring SDO ORDINATE ARRAY 5 1 8 1 8 1 8 6 5 7 5 1 2nd and 3rd points are duplicates 0 005 tolerance value FROM DUAL SDO_UTIL REMOVE DUPLICATE VERTICES SDO GEOMETRY 2003 TWO DIMENSIONALPOLYGONN
235. _val gt TRUE evaluates to TRUE for object pairs that have the topological relationship specified by lt some_mask_val gt and FALSE otherwise The operator is disabled if the table does not have a spatial index or if the index has been built on more than two dimensions The operator must always be used in a WHERE clause and the condition that includes the operator should be an expression of the form SDO_RELATE arg l arg2 mask lt some_mask_val gt TRUE geometry2 can come from a table or be a transient SDO_GEOMETRY object such as a bind variable or SDO_GEOMETRY constructor a Ifthe geomet ry2 column is not spatially indexed the operator indexes the query window in memory and performance is very good Ifthe geometry2 column is spatially indexed with the same SDO_LEVEL value as the geomet ry1 column the operator reuses the existing index and performance is very good or better Ifthe geometry2 column is spatially indexed with a different SDO_LEVEL value than the geomet ry1 column the operator reindexes geomet ry2 in the same way as if there were no index on the column originally and then performance is very good a If two or more geometries from geomet ry2 are passed to the operator the ORDERED optimizer hint must be specified and the table in geomet ry2 must be specified first in the FROM clause If geometry1 and geomet ry2 are based on different coordinate systems geomet ry2 is temporarily transformed to
236. a Topology data model client interface sdotopo described in Oracle Spatial Topology and Network Data Models Network data model client interface sdonm described in Oracle Spatial Topology and Network Data Models The sdoapi Java client interface consists of the following classes JGeometry class that maps the SQL type SDO_GEOMETRY The main methods for reading and writing database raster images are load STRUCT and store JGeometry Point convenience class that represents a double typed point DataException class for MapViewer data access exceptions For detailed reference information about these classes see the Javadoc generated API documentation open index html in a directory that includes the path sdoapi doc javadoc 1 12 Geocoding Geocoding is the process of converting tables of address data into standardized address location and possibly other data The result of a geocoding operation includes the pair of longitude and latitude coordinates that correspond with the input address or location For example if the input address is 22 Monument Square Concord MA 01742 the longitude and latitude coordinates in the result of the geocoding operation may be depending on the geocoding data provider 71 34937 and 42 46101 respectively Given a geocoded address you can perform proximity or location queries using a spatial engine such as Oracle Spatial or demographic analysis using tools and data from Oracle
237. a rectangle and cola_b four sided polygon are side by side share one border cola_c is a small four sided polygon that overlaps parts of cola_a and cola_b A rough sketch The next INSERT statement creates an area of interest for Cola A This area happens to be a rectangle The area could represent any user defined criterion for example where Cola A is the preferred drink where Cola A is under competitive pressure where Cola A has strong growth potential and so on INSERT INTO cola_markets _cs VALUES Ly cola_a 6 22 Oracle Spatial Users Guide and Reference Example of Coordinate System Transformation SDO_GEOMETRY i 2003 two dimensional polygon 8307 SRID for Longitude Latitude WGS 84 coordinate system NULL SDO ELEM INFO ARRAY 1 1003 1 polygon SDO_ORDINATE ARRAY 1 1 5 1 5 7 1 7 1 1 All vertices must be defined for rectangle with geodetic data The next two INSERT statements create areas of interest for Cola B and Cola C These areas are simple polygons but not rectangles INSERT INTO cola markets cs VALUES 2 cola b SDO_GEOMETRY i 2003 two dimensional polygon 8307 NULL SDO ELEM INFO ARRAY 1 1003 1 one polygon exterior polygon ring SDO ORDINATE ARRAY 5 1 8 1 8 6 5 7 5 1 INSERT INTO cola markets cs VALUES 3 cola_c SDO_GEOMETRY Nie 2003 two dimensional polygon 8307 NULL
238. a 1957 Bogota Observatory CH 1903 Switzerland Campo Inchauspe Canton Astro 1966 Cape Cape Canaveral Carthage Chatham 1971 Coordinate Systems Spatial Reference Systems 6 13 Coordinate Systems Data Structures Chua Astro DOS 1968 European 1950 GRS 67 Gandajika Base Hito XVIII 1963 Hu Tzu Shan Indian Thailand Vietnam Kandawala L C 5 Astro Luzon Mindanao Island Marco Astro Merchich NAD 27 Alaska NAD 27 Canal Zone NAD 27 Continental US NAD 27 Mexico NAD 83 NWGL 10 Nahrwan Un Arab Emirates Observatorio 1966 Oman Pitcairn Astro 1967 Pulkovo 1942 6 14 Oracle Spatial Users Guide and Reference Corrego Alegre Djakarta Batavia European 1979 GRS 80 Geodetic Datum 1949 Hjorsey 1955 ISTS 073 Astro 1969 Ireland 1965 Kerguelen Island Liberia 1964 Luzon Philippines Massawa Midway Astro 1961 NAD 27 Bahamas NAD 27 Caribbean NAD 27 Cuba NAD 27 Michigan NTF Greenwich meridian Nahrwan Masirah Island Naparima BWI Old Egyptian Ordinance Survey Great Brit Provisional South American Qatar National DHDN Potsdam Rauenberg Easter Island 1967 European 1987 GUX 1 Astro Guam 1963 Hong Kong 1963 Indian Bangladesh etc Johnston Island 1961 Kertau 1948 Lisboa DLx Mahe 1971 Melrica 1973 D73 Minna NAD 27 Canada NAD 27 Central America NAD 27 Greenland NAD 27 San Salvador NTF Paris meridian
239. a ahea a a a na a ATE 8 6 Extending Spatial Indexing Capabilities 9 1 SDO_GEOMETRY Objects in User Defined Type Definitions cece eee 9 1 9 2 SDO_GEOMETRY Objects in Function Based Indexes oooiiconicnnnnnnncnincnnornonincononorinnanas 9 3 9 2 1 Example Function with Standard Types ooocccoconinnnnnnarininonananonononononononononcnnonanarncncnos 9 4 9 2 2 Example Function with a User Defined Object Type coconccccconinnnicacinononininaninanincncncnos 9 6 Part Il Reference Information 10 11 12 SQL Statements for Indexing Spatial Data ALTERTNDEN vota alii atucten cease sted euitdives cdueuteess duconcusetetvay AAE debi 10 2 ALTER INDEX REBUUED EERE celica a 10 6 ALTERINDEX RENAME TO viii dois a des 10 9 GREATE INDEX 200 A Ai A n 10 10 DROP INDEX lt a ia O ana er e e 10 15 SDO_GEOMETRY Object Type Methods GETSDIMS aiii e a ER eee A A A tee fas 11 2 GET GTYPE aia ed 11 3 GETLERSEDIM a A a ai ia E E 11 4 Spatial Operators SDO ANYINTERAC Tosca iii e e a ad eii a AAN 12 3 SDOXCON TATI Si il dde ico eo ic N E E 12 5 SDO COVEREDD Y iii diari sali 12 7 SDOCOVERS coto italia Aa A EL E a AE a AA 12 9 SDOtEQUAL 000 AA a a dives Dette detente Sus did iio da 12 11 SDO SEIT ER coi aiii 12 13 SDOLSIN SIDE r Ee A A tE de A ARA lusts AAA AA 12 17 SDOTO N lt a E dev avons dd aiii 12 19 DON Ni iia iia A ai 12 23 SDOLNN DISTANCE 0 ada 12 29 SDO ON a AA A arab la ATA AE ANA 12 31 SDOc OVERLAPBDY DISJOINT sercot
240. agner Soe b Segment Splitting Segment 2 ca Segment 2 c Segment Concatenation In Figure 7 10 part a a segment is created from part of a larger segment The new segment has its own start and end points and the direction is the same as in the original larger segment 7 5 4 Splitting a Geometric Segment You can create two new geometric segments by splitting a geometric segment as shown in Figure 7 10 part b The direction of each new segment is the same as in the original segment Note In Figure 7 10 and several figures that follow small gaps between segments are used in illustrations of segment splitting and concatenation Each gap simply reinforces the fact that two different segments are involved However the two segments such as segment 1 and segment 2 in Figure 7 10 parts b and c are actually connected The tolerance see Section 1 5 5 is considered in determining whether or not segments are connected 7 5 5 Concatenating Geometric Segments You can create a new geometric segment by concatenating two geometric segments as shown in Figure 7 10 part c The geometric segments do not need to be spatially Linear Referencing System 7 13 LRS Operations connected although they are connected in the illustration in Figure 7 10 part c The measures of the second geometric segment are shifted so that the end measure of the first segment is the same as the start measure of the second segment The direction
241. alculates geometry type information for a spatial layer such as the percentage of each geometry type Returns the quality degradation for an index or the average quality degradation for all index tables for an index Spatial Tuning Subprograms 18 1 SDO_TUNE AVERAGE_MBR SDO_TUNE AVERAGE_MBR Format Description Parameters Usage Notes SDO_TUNE AVERAGE_MBR table_name IN VARCHAR2 column_name IN VARCHAR2 width OUT NUMBER height OUT NUMBER Calculates the average minimum bounding rectangle MBR for geometries in a layer table_name Spatial geometry table column_name Geometry column for which the average minimum bounding rectangle is to be computed width Width of the average minimum bounding rectangle height Height of the average minimum bounding rectangle This procedure computes and stores the width and height of the average minimum bounding rectangle for all geometries in a spatial geometry table It calculates the average MBR by keeping track of the maximum and minimum X and Y values for all geometries in a spatial geometry table 18 2 Oracle Spatial Users Guide and Reference SDO_TUNE AVERAGE_MBR Examples Related Topics The following example calculates the minimum bounding rectangle for the SHAPE column of the COLA_MARKETS table DECLARE table name VARCHAR2 32 COLA MARKETS column name VARCHAR2 32 SHAPE width NUMBER height NUMBER BEGIN SDO_TUNE AVERAGE MBR
242. alue of WINS_1 Example 4 5 Secondary Filter Using a Stored Query Window SELECT A Feature_ID FROM TARGET A WINDOWS B WHERE B ID WINS 1 AND sdo relate A shape B shape mask anyinteract TRUE If the B SHAPE column is not spatially indexed the SDO_RELATE operator indexes the query window in memory and performance is very good If the B SHAPE column is spatially indexed with the same SDO_LEVEL value as the A SHAPE column the SDO_RELATE operator reuses the existing index and performance is very good or better If the B SHAPE column is spatially indexed with a different SDO_LEVEL value than the A SHAPE column the SDO_RELATE operator reindexes B SHAPE in the same Indexing and Querying Spatial Data 4 13 Querying Spatial Data way as if there were no index on the column originally and then performance is very good 4 2 1 3 Within Distance Operator The SDO_WITHIN_DISTANCE operator described in Chapter 12 is used to determine the set of objects in a table that are within n distance units from a reference object This operator can be used only if a spatial index has been created on two dimensions of data The reference object may be a transient or persistent instance of SDO_GEOMETRY such as a temporary query window or a permanent geometry stored in the database The syntax of the operator is as follows SDO WITHIN DISTANCE geometryl SDO GEOMETRY aGeom SDO_GEOMETRY params VARCHAR2 In the preceding syntax
243. ame LRS ROUTES AND m column_name ROUTE GEOMETRY SDO_LRS VALI D_LRS PT SDO GEOMETRY 3301 NULL NULL SDO ELEM INFO ARRAY 1 1 1 SDO_ Linear Referencing Subprograms 16 107 SDO_LRS VALID_MEASURE SDO_LRS VALID_MEASURE Format SDO_LRS VALID_MEASURE geom_segment IN SDO_GEOMETRY measure IN NUMBER RETURN VARCHAR2 or SDO_LRS VALID_MEASURE geom_segment IN SDO_GEOMETRY dim_array IN SDO_DIM_ARRAY measure IN NUMBER RETURN VARCHAR2 Description Checks if a measure falls within the measure range of a geometric segment Parameters geom_segment Geometric segment to be checked to see if measure falls within its measure range dim_array Dimensional information array corresponding to geom_segment usually selected from one of the xxx_SDO_GEOM_METADATA views described in Section 2 4 measure Measure value to be checked to see if it falls within the measure range of geom_ segment 16 108 Oracle Spatial Users Guide and Reference SDO_LRS VALID_MEASURE Usage Notes Examples This function returns TRUE if measure falls within the measure range of geom_ segment and FALSE if measure does not fall within the measure range of geom_ segment An exception is raised if geom_segment has an invalid geometry type or dimensionality The _3D format of this function SDO_LRS VALID_MEASURE_3D is available For information about _3D formats of LRS functions see Section 7 4 The following example checks i
244. ame2 column_name2 params preserve_join_ order Name of the first table to be used in the spatial join operation The table must have a column of type SDO_GEOMETRY Data type is VARCHAR2 Name of the spatial column of type SDO_GEOMETRY in table_namel A spatial R tree index must be defined on this column Data type is VARCHAR2 Name of the second table to be used in the spatial join operation It can be the same as or different from table_name1 The table must have a column of type SDO_GEOMETRY Data type is VARCHAR2 Name of the spatial column of type SDO_GEOMETRY in table_name2 A spatial R tree index must be defined on this column Data type is VARCHAR2 Optional parameter string of keywords and values available only if mask ANYINTERACT Determines the behavior of the operator See Table 12 3 in the Usage Notes for information about the available keywords Data type is VARCHAR2 Default is NULL Optional parameter to specify if the join order is guaranteed to be preserved during processing of the operator If the value is 0 the default the order of the tables might be changed if the value is 1 the order of the tables is not changed Data type is NUMBER Default is 0 Spatial Operators 12 19 SDO_JOIN Returns Usage Notes SDO_JOIN returns an object of SDO_ROWIDSET which consists of a table of objects of SDO_ROWIDPAIR Oracle Spatial defines the type SDO_ROWIDSET as CREATE TYPE sdo_rowidset
245. ameter is not specified the unit of measurement associated with the data is assumed tol Tolerance value see Section 1 5 5 If the function format with tol is used all geometry objects must be defined using 4 digit SDO_GTYPE values explained in Section 2 2 1 An exception is raised if geom1 and geom2 are based on different coordinate systems The following example returns the shortest distance between cola_band cola_d The example uses the definitions and data from Section 2 1 Return the distance between two geometries SELECT SDO GEOM SDO DISTANCE c_b shape c_d shape 0 005 FROM cola markets c_b cola markets c d WHERE c_b name cola b AND c_d name cola d SDO_GEOM SDO DISTANCE C _B SHAPE C D SHAPE 0 005 846049894 a SDO_GEOM WITHIN_DISTANCE Geometry Subprograms 13 25 SDO_GEOM SDO_INTERSECTION SDO_GEOM SDO_INTERSECTION Format SDO_GEOM SDO_INTERSECTION geom1 IN SDO_GEOMETRY dim1 IN SDO_DIM_ARRAY geom2 IN SDO_GEOMETRY dim2 IN SDO_DIM_ARRAY RETURN SDO_GEOMETRY or SDO_GEOM SDO_INTERSECTION geom1 IN SDO_GEOMETRY geom2 IN SDO_GEOMETRY tol IN NUMBER RETURN SDO_GEOMETRY Description Returns a geometry object that is the topological intersection AND operation of two geometry objects Parameters geom1 Geometry object dim1 Dimensional information array corresponding to geom1 usually selected from one of the xxx_SDO_GEOM_METADATA views described in Section 2 4
246. amples 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 The Oracle Spatial training course covers many of these examples and provides additional examples and explanations Before you use any of the examples in this appendix be sure you understand the usage and reference information for the relevant operator or function in Part I Conceptual and Usage Information and Part II Reference Information This appendix contains the following major sections a Section C 1 Tables Used in the Examples Section C 2 SDO_WITHIN_DISTANCE Examples a Section C 3 SDO_NN Examples Section C 4 SDO_AGGR_UNION Example C 1 Tables Used in the Examples The examples in this appendix refer to tables named GEOD_CITIES GEOD_ COUNTIES and GEOD_INTERSTATES which are defined as follows CREATE TABLE GEOD CITIES LOCATION SDO_GEOMETRY CITY VARCHAR2 42 STATE ABRV VARCHAR2 2 POP90 NUMBER Complex Spatial Queries Examples C 1 SDO_WITHIN_DISTANCE Examples RANK90 NUMBER CREATE TABLE GEOD COUNTIES COUNTY NAME VARCHAR2 40 STATE ABRV VARCHAR2 2 GEOM SDO _ GEOMETRY CREATE TABLE GEOD INTERSTATES HIGHWAY VARCHAR2 35 GEOM SDO GEOMETRY C 2 SDO_WITHIN_DISTANCE Exa
247. an area affecting some nonspatial attribute of the object For example the value nonspatial attribute of a house at a given address geocoded to give a spatial attribute is largely determined by the value of other houses in the neighborhood To use spatial correlation in a data mining application you materialize the spatial correlation by adding attributes columns in a data mining table You use associated thematic tables to add the appropriate attributes You then perform mining tasks on the data mining table using ODM functions The following functions and procedures documented in Chapter 21 perform operations related to materializing spatial correlation a SDO_SAM SIMPLIFY_GEOMETRY a SDO_SAM AGGREGATES_FOR_GEOMETRY a SDO_SAM AGGREGATES_FOR_LAYER 8 4 Colocation Mining Colocation is the presence of two or more spatial objects at the same location or at significantly close distances from each other Colocation patterns can indicate interesting associations among spatial data objects with respect to their nonspatial attributes For example a data mining application could discover that sales at franchises of a specific pizza restaurant chain were higher at restaurants colocated with video stores than at restaurants not colocated with video stores Two types of colocation mining are supported Colocation of items in a data mining table Given a data layer this approach identifies the colocation of multiple features For example p
248. are represented and how the COLA_MARKETS feature table and the USER_SDO_GEOM_METADATA view are populated with the data for those objects The SRID column should contain either of the following the SRID value for the coordinate system for all geometries in the column or NULL if no specific coordinate system should be associated with the geometries For information about coordinate systems see Chapter 6 2 5 Spatial Index Related Structures This section describes the structure of the tables containing the spatial index data and metadata Concepts and usage notes for spatial indexing are explained in Section 1 7 The spatial index data and metadata are stored in tables that are created and maintained by the Spatial indexing routines These tables are created in the schema of the owner of the feature underlying table that has a spatial index created on a column of type SDO_GEOMETRY 2 5 1 Spatial Index Views There are two sets of spatial index metadata views for each schema user xxx_ SDO_INDEX_INFO and xxx_SDO_INDEX_METADATA where xxx can be USER or ALL These views are read only to users they are created and maintained by the Spatial indexing routines 2 5 1 1 xxx_SDO_INDEX_INFO Views The following views contain basic information about spatial indexes a USER_SDO_INDEX_INFO contains index information for all spatial tables owned by the user a ALL_SDO_INDEX_INFO contains index information for all spatial tables on which the us
249. art point of a geometric segment to the start point of the linear feature 16 102 Oracle Spatial User s Guide and Reference SDO_LRS TRANSLATE_MEASURE Usage Notes Examples This function adds translate_mto the start and end measures of geom_segment For example if geom_segment has a start measure of 50 and an end measure of 100 and if translate_mis 10 the returned geometric segment has a start measure of 60 and an end measure of 110 as shown in Figure 16 1 Figure 16 1 Translating a Geometric Segment S M 50 M 100 M 60 M 110 Translate 10 An exception is raised if geom_segment has an invalid geometry type or dimensionality The _3D format of this function SDO_LRS TRANSLATE_MEASURE_3D is available For information about _3D formats of LRS functions see Section 7 4 The following example translates shifts by 10 the geometric segment representing Route 1 This example uses the definitions from the example in Section 7 7 SELECT SDO_LRS TRANSLATE MEASURE a route_geometry m diminfo 10 FROM lrs_ routes a user_sdo_geom_metadata m WHERE m table name LRS ROUTES AND m column_name ROUTE GEOMETRY AND a route_id 1 SDO_LRS TRANSLATE MEASURE A ROUTE GEOMETRY M DIMINFO 10 SDO_GTYPE SDO SRID SD SDO GEOMETRY 3002 NULL NULL SDO ELEM INFO ARRAY 1 2 1 SDO ORDINATE ARRAY 2 27210 2 4y 12 8 4 18 12 Ap 227 12 10 287 83 10 32 5 145 37 Linear Referencing Subprograms 16 103 SDO
250. as TABLE OF sdo_rowidpair Oracle Spatial defines the object type SDO_ROWIDPAIR as CREATE TYPE sdo rowidpair AS OBJECT rowidl VARCHAR2 24 rowid2 VARCHAR2 24 In the SDO_ROWIDPAIR definition rowid1 refers to a rowid from table _namel and rowid2 refers to a rowid from table_name2 SDO_JOIN is technically not an operator but a table function For an explanation of table functions see PL SQL User s Guide and Reference 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 This function is recommended when you need to perform full table joins The geometries in column_namel and column_name2 must have the same SRID coordinate system value and the same number of dimensions Table 12 3 shows the keywords for the params parameter 12 20 Oracle Spatial User s Guide and Reference SDO_JOIN Examples Table 12 3 params Keywords for the SDO_JOIN Operator Keyword Description mask distance unit The topological relationship of interest Valid values are mask lt value gt where lt value gt is one or more of the mask values valid for the SDO_RELATE operator TOUCH OVERLAPBDYDISJOINT OVERLAPBDYINTERSECT EQUAL INSIDE COVEREDBY CONTAINS COVERS ANYINTERACT ON or FILTER which checks if the MBRs the filter level approximations intersect Multiple masks are
251. at contain any spatial indexes Use this procedure after the import operation is completed each user that has a spatial index in the tablespace must call the procedure You must also have called the SDO_ UTIL PREPARE_FOR_TTS procedure just before performing the export operation See the Usage Notes for the SDO_UTIL PREPARE_FOR_TTS procedure for more information about using the transportable tablespace feature with spatial data For detailed information about transportable tablespaces and transporting tablespaces to other databases see Oracle Database Administrator s Guide The following example initializes all spatial indexes in a tablespace that was transported to another database CALL SDO_UTIL INITIALIZE INDEX FOR TTS a SDO_UTIL PREPARE FOR_TTS 19 20 Oracle Spatial User s Guide and Reference SDO_UTIL POINT_AT_BEARING SDO_UTIL POINT_AT_BEARING Format Description Parameters Usage Notes SDO_UTIL POINT_AT_BEARING start_point IN SDO_GEOMETRY bearing IN NUMBER distance IN NUMBER RETURN SDO_GEOMETRY Returns a point geometry that is at the specified distance and bearing from the start point start_point Point geometry object from which to compute the distance at the specified bearing to locate the desired point The point geometry must be based on a geodetic coordinate system bearing Number of radians measured clockwise from North Must be in the range of either pi to pi or 0 to 2 pi Either conve
252. ate system 6 20 Oracle Spatial Users Guide and Reference Example of Coordinate System Transformation 6 7 2 Functions Not Supported with Geodetic Data In the current release the following functions are not supported with geodetic data SDO_GEOM SDO_MAX_MBR_ORDINATE SDO_GEOM SDO_MIN_MBR_ORDINATE All 3D formats of LRS functions explained in Section 7 4 6 7 3 Functions Supported by Approximations with Geodetic Data In the current release the following functions are supported by approximations with geodetic data a SDO_GEOM SDO_BUFFER a SDO_GEOM SDO_CENTROID a SDO_GEOM SDO_CONVEXHULL When these functions are used on data with geodetic coordinates they internally perform the operations in an implicitly generated local tangent plane Cartesian coordinate system and then transform the results to the geodetic coordinate system For SDO_GEOM SDO_BUFFER generated arcs are approximated by line segments before the back transform 6 8 Example of Coordinate System Transformation This section presents a simplified example that uses coordinate system transformation functions and procedures It refers to concepts that are explained in this chapter and uses functions documented in Chapter 15 Example 6 4 uses mostly the same geometry data cola markets as in Section 2 1 except that instead of null SDO_SRID values the SDO_SRID value 8307 is used That is the geometries are defined as using the coordinate system whose SRID is
253. atement that inserts the geometry illustrated in Figure 2 2 into the database Example 2 2 SQL Statement to Insert a Rectangle INSERT INTO cola markets VALUES 1 cola_a SDO_GEOMETRY 2003 two dimensional polygon NULL NULL SDO ELEM INFO ARRAY 1 1003 3 one rectangle 1003 exterior SDO_ORDINATE ARRAY 1 1 5 7 only 2 points needed to define rectangle lower left and upper right with Cartesian coordinate data Spatial Data Types and Metadata 2 15 Geometry Examples Y 2 3 2 Polygon with a Hole Figure 2 3 illustrates a polygon consisting of two elements an exterior polygon ring and an interior polygon ring The inner element in this example is treated as a void a hole Figure 2 3 Polygon with a Hole 10 10 In the SDO_GEOMETRY definition of the geometry illustrated in Figure 2 3 a SDO_GTYPE 2003 The 2 indicates two dimensional and the 3 indicates a polygon a SDO_SRID NULL a SDO_POINT NULL a SDO_ELEM_INFO 1 1003 1 19 2003 1 There are two triplet elements 1 1003 1 and 19 2003 1 1003 indicates that the element is an exterior polygon ring 2003 indicates that the element is an interior polygon ring 2 16 Oracle Spatial Users Guide and Reference Geometry Examples 19 indicates that the second element the interior polygon ring ordinate specification starts at the 19th number in the SDO_ORDINATES array that is 7 meaning that the first point is 7 5
254. atial User s Guide and Reference SDO_NN_DISTANCE SDO_NN_DISTANCE Format Description SDO_NN_DISTANCE number Returns the distance of an object returned by the SDO_NN operator Valid only within a call to the SDO_NN operator Keywords and Parameters Returns Usage Notes Value Description number Specifies a number that must be the same as the last parameter passed to the SDO_NN operator Data type is NUMBER This operator returns the distance of an object returned by the SDO_NN operator In determining how near two geometry objects are the shortest possible distance between any two points on the surface of each object is used SDO_NN_DISTANCE is an ancillary operator to the SDO_NN operator It returns the distance between the specified geometry and a nearest neighbor object This distance is passed as ancillary data to the SDO_NN operator For an explanation of how operators can use ancillary data see the section on ancillary data in the chapter on domain indexes in Oracle Data Cartridge Developer s Guide You can choose any arbitrary number for the number parameter The only requirement is that it must match the last parameter in the call to the SDO_NN operator Use a bind variable to store and operate on the distance value Spatial Operators 12 29 SDO_NN_DISTANCE Examples Related Topics The following example finds the two objects from the SHAPE column in the COLA_ MARKETS table that a
255. atial Users Guide and Reference SDO_UTIL CONCAT_LINES SDO_UTIL CONCAT_LINES Format Description Parameters Usage Notes SDO_UTIL CONCAT_LINES geom1 IN SDO_GEOMETRY geom2 IN SDO_GEOMETRY RETURN SDO_GEOMETRY Concatenates two line or multiline two dimensional geometries to create a new geometry geom1 First geometry object for the concatenation operation geom2 Second geometry object for the concatenation operation Each input geometry must be a two dimensional line or multiline geometry that is the SDO_GTYPE value must be 2002 or 2006 This function is not supported for LRS geometries To concatenate LRS geometric segments use the SDO_ LRS CONCATENATE_GEOM_SEGMENTS function described in Chapter 16 The input geometries must be line strings whose vertices are connected by straight line segments Circular arcs and compound line strings are not supported The topological relationship between geom1 and geom2 must be DISJOINT or TOUCH and if the relationship is TOUCH the geometries must intersect only at two end points You can use the SDO_AGGR_CONCAT_LINES spatial aggregate function described in Chapter 14 to concatenate multiple two dimensional line or multiline geometries Spatial Utility Subprograms 19 7 SDO_UTIL CONCAT_LINES An exception is raised if geom1 and geom2 are based on different coordinate systems Examples The following example concatenates two simple line string g
256. atial features you must index geodetic data using a geodetic R tree index Geodetic data consists of geometries that have geodetic SDO_ SRID values reflecting the fact that they are based on a geodetic coordinate system such as using longitude and latitude as opposed to a flat or projected plane coordinate system Chapter 6 explains coordinate systems and related concepts A geodetic index is one that provides the full range of Spatial features with geodetic data Thus it is highly recommended that you use a geodetic index with geodetic data Only R tree indexes can be geodetic indexes Quadtree indexes cannot be geodetic indexes If you create an R tree or quadtree index and specify geodetic false in the CREATE INDEX statement the index is non geodetic The following notes and restrictions apply to non geodetic indexes If you create a non geodetic index on geodetic data you cannot use the unit parameter with the SDO_WITHIN_DISTANCE operator or the SDO_NN_ DISTANCE ancillary operator with the SDO_NN operator If you create a non geodetic index on projected data that has a projected SDO_ SRID value you can use the full range of Spatial features a If you create a non geodetic index on projected data that has a null SDO_SRID value you cannot use the unit parameter with the SDO_WITHIN_DISTANCE operator or the SDO_NN_DISTANCE ancillary operator with the SDO_NN operator For additional information see the Usage Notes about the
257. ating a geometric segment with three line segments is shown in Figure 7 7 7 8 Oracle Spatial User s Guide and Reference Indexing of LRS Data Figure 7 7 Creating a Geometric Segment Start Measure End Measure 5 10 0 35 10 NULL 55 10 100 Start Point End Point 20 5 NULL In Figure 7 7 the geometric segment has the following definition with measure values underlined SDO_GEOMETRY 3302 NULL NULL SDO_ELEM_INFO ARRAY 1 2 1 SDO ORDINATE ARRAY 5 10 0 20 5 NULL 35 10 NULL 55 10 100 Whenever a geometric segment is defined its start and end measures must be defined or derived from some existing geometric segment The unsigned measures of all shape points on a geometric segment will be automatically populated The LRS API works with geometries in formats of Oracle Spatial before release 8 1 6 but the resulting geometries will be converted to the Oracle Spatial release 8 1 6 or higher format specifically with 4 digit SDO_GTYPE and SDO_ETYPE values For example in Oracle Spatial release 8 1 6 and higher the geometry type SDO_GTYPE of a spatial object includes the number of dimensions of the object as the first digit of the SDO_GTYPE value Thus the SDO_GTYPE value of a point is 1 in the pre release 8 1 6 format but 2001 in the release 8 1 6 format the number of dimensions of the point is 2 However an LRS point which includes measure information has three dimensions and thus the SDO_GTYPE of any point
258. ation about _3D formats of LRS functions see Section 7 4 For more information about concatenating geometric segments see Section 7 5 5 The following example defines the geometric segment splits it into two segments then concatenates those segments This example uses the definitions from the example in Section 7 7 The definitions of result_geom_1 result_geom_2 and result_geom_3 are displayed in Example 7 3 DECLARE geom_segment SDO GEOMETRY line string SDO_GEOMETRY dim array SDO DIM ARRAY result_geom_1 SDO GEOMETRY result_geom 2 SDO GEOMETRY result_geom 3 SDO GEOMETRY BEGIN SELECT a route_geometry into geom segment FROM lrs_routes a WHERE a route_name Routel Linear Referencing Subprograms 16 9 SDO_LRS CONCATENATE_GEOM_SEGMENTS SELECT m diminfo into dim_array from user _sdo_geom metadata m WHERE m table name LRS ROUTES AND m column_name ROUTE_GEOMETRY Define the LRS segment for Routel SDO_LRS DEFINE GEOM SEGMENT geom segment dim array 0 Zero starting measure LRS segment starts at start of route 27 End of LRS segment is at measure 27 SELECT a route_geometry INTO line_string FROM lrs_routes a WHERE a route name Routel Split Routel into two segments SDO_LRS SPLIT_GEOM SEGMENT line string dim_array 5 result_geom_1 result_geom_2 Concatenate the segments that were just split result_geom_3 SDO_LRS CONCATENATE_GEOM SEGMENTS result_geom_1 dim _ array resu
259. ations 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 xxxviii 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 Part Conceptual and Usage Information This document has three parts Part I provides conceptual and usage information about Oracle Spatial a Part II provides reference information about Oracle Spatial methods operators functions and procedures a 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 Syste
260. ay corresponding to geom_segment usually selected from one of the xxx_SDO_GEOM_METADATA views described in Section 2 4 If measure or point identifies the start point of the geometric segment a null value is returned An exception is raised if measure is not a valid value for geom_segment or if point is not a valid LRS point Contrast this function with SDO_LRS GET_NEXT_SHAPE_PT_MEASURE which returns the measure value of the next shape point on a geometric segment after a specified measure value or LRS point The _3D format of this function SDO_LRS GET_PREV_SHAPE_PT_MEASURE_ 3D is available For information about _3D formats of LRS functions see Section 7 4 The following example returns the measure value of the closest shape point to measure 14 and before measure 14 on the geometric segment representing Route 1 This example uses the definitions from the example in Section 7 7 SELECT SDO_LRS GET PREV SHAPE PT MEASURE a route geometry 14 FROM lrs_ routes a WHERE a route_ id 1 SDO_LRS GET PREV SHAPE PT MEASURE A ROUTE GEOMETRY 14 Linear Referencing Subprograms 16 59 SDO_LRS GET_PREV_SHAPE_PT_MEASURE 16 60 Oracle Spatial Users Guide and Reference SDO_LRS IS_GEOM_SEGMENT_DEFINED SDO_LRS IS GEOM_SEGMENT_DEFINED Format Description Parameters Usage Notes Examples SDO_LRS IS_GEOM_SEGMENT_DEFINED geom_segment IN SDO_GEOMETRY dim_array IN SDO_DIM_ARRAY RETURN VARCHAR2
261. ayer It is equivalent to calling the SDO_SAM SIMPLIFY_GEOMETRY function for each geometry in the layer except that each simplified geometry is put in a separate column in the table instead of being returned to the caller See also the Usage Notes for the SDO_SAM SIMPLIFY_ GEOMETRY function Examples The following example adds a column named SMPL_GEOM to the POLY_4PT_ TEMP table then simplifies all geometries in the GEOMETRY column of the POLY_ 4PT_TEMP table placing each simplified geometry in the SMPL_GEOM column in the same row with its associated original geometry ALTER TABLE poly 4pt temp ADD smpl_geom mdsys sdo_geometry Table altered EXECUTE sdo_sam simplify layer POLY 4PT TEMP GEOMETRY SMPL GEOM PL SQL procedure successfully completed 21 18 Oracle Spatial Users Guide and Reference SDO_SAM SPATIAL_CLUSTERS SDO_SAM SPATIAL_CLUSTERS Format Description Parameters SDO_SAM SPATIAL_CLUSTERS tablename IN VARCHAR2 colname IN VARCHAR2 max_clusters IN NUMBER allow_outliers IN VARCHAR2 DEFAULT TRUE tablepartition IN VARCHAR2 DEFAULT NULL RETURN SDO_REGIONSET Computes clusters using the existing R tree index and returns a set of SDO_ REGION objects where the geometry column specifies the boundary of each cluster and the geometry_key value is set to null tablename Name of the data mining table colname Name of the column in tablename that holds the location coordinates max_clust
262. blename tablename Name of the data mining table colname Name of the column in tablename that holds the location coordinates 21 12 Oracle Spatial Users Guide and Reference SDO_SAM COLOCATED_REFERENCE_FEATURES Usage Notes Examples ref_predicate Qualifying WHERE clause predicate to be applied to tablename Must be a single table predicate such as country_code 10 dst_spec A quoted string containing a distance value and optionally a unit value See the Usage Notes for an explanation of the format and meaning result_tablename The table in which materialized join results are stored This table must have the following definition tid NUMBER ridl VARCHAR2 24 rid2 VARCHAR2 24 commit_interval Number of internal join operations to perform before Spatial performs an internal commit operation If commit_interval is not specified a commit is performed after every 100 internal join operations This procedure materializes each pair of ROWIDs returned from a predicate based join operation and stores them in the rid1 rid2 columns of result_ tablename The tid is a unique generated interaction number corresponding to each rid1 value The dst_spec parameter if specified is a quoted string that must contain the distance keyword and that may contain the unit keyword to identify the unit of measurement associated with the distance value For example distance 2 unit km If the unit keyword is specified the valu
263. by using the function varray_variable Count in PL SQL or OCICollSize in the Oracle Call Interface OCI The semantics of each SDO_ETYPE element and the relationship between the SDO_ ELEM_INFO and SDO_ORDINATES varying length arrays for each of these SDO_ ETYPE elements are given in Table 2 2 Spatial Data Types and Metadata 2 11 SDO_GEOMETRY Object Type Table 2 2 Values and Semantics in SDO_ELEM_INFO ETYPE INTERPRETATION Meaning SDO_ SDO_ 0 any numeric value 1 1 1 n gt 1 2 1 2 2 1003 or 1 2003 1003 or 2 2003 Type 0 zero element Used to model geometry types not supported by Oracle Spatial For more information see Section 2 3 6 Point type Point cluster with n points Line string whose vertices are connected by straight line segments Line string made up of a connected sequence of circular arcs Each circular arc is described using three coordinates the arc s start point any point on the arc and the arc s end point The coordinates for a point designating the end of one arc and the start of the next arc are not repeated For example five coordinates are used to describe a line string made up of two connected circular arcs Points 1 2 and 3 define the first arc and points 3 4 and 5 define the second arc where point 3 is only stored once Simple polygon whose vertices are connected by straight line segments You must specify a point for each vertex and the last point specified
264. c segment and all other measures are adjusted accordingly a Reverses the direction of geom Compare this function with SDO_LRS REVERSE_MEASURE which reverses only the measure values not the direction of a geometric segment To reverse the vertices of a non LRS line string geometry use the SDO_ UTIL REVERSE_LINESTRING function which is described in Chapter 19 Linear Referencing Subprograms 16 89 SDO_LRS REVERSE_GEOMETRY An exception is raised if geom has an invalid geometry type or dimensionality The geometry type must be a line or multiline and the dimensionality must be 3 two dimensions plus the measure dimension The _3D format of this function SDO_LRS REVERSE_GEOMETRY_3D is available For information about _3D formats of LRS functions see Section 7 4 Examples The following example reverses the measure values and the direction of the geometric segment representing Route 1 This example uses the definitions from the example in Section 7 7 Reverse direction and measures for example to prepare for concatenating with another road First display the original segment then reverse SELECT a route geometry FROM lrs routes a WHERE a route_id 1 ROUTE GEOMETRY SDO_GTYPE SDO SRID SDO POINT X Y Z SDO ELEM INFO SDO_ORDIN SDO GEOMETRY 3302 NULL NULL SDO ELEM INFO ARRAY 1 2 1 SDO ORDINATE ARRAY 2 2 0 2 4 2 8 4 8 12 4 12 12 10 18 8 10 22 5 14 27 SELECT SDO_LRS REV
265. c shape SDO GEOMETRY 2002 NULL NULL SDO_ELEM_INFO ARRAY 1 2 1 SDO_ORDINATE ARRAY 0 6 2 6 TRUE MKT ID NAME 12 34 Oracle Spatial User s Guide and Reference SDO_OVERLAPBDYINTERSECT SDO_OVERLAPBDYINTERSECT Format Description SDO_OVERLAPBDYINTERSECT geometry1 geometry2 Checks if any geometries in a table have the OVERLAPBDYINTERSECT topological relationship with a specified geometry Equivalent to specifying the SDO_RELATE operator with mask OVERLAPBDYINTERSECT See the section on the SDO_RELATE operator in this chapter for information about the operations performed by this operator and for usage requirements Keywords and Parameters Returns Usage Notes Value Description geometryl Specifies a geometry column in a table The column must be spatially indexed Data type is SDO_GEOMETRY geometry2 Specifies either a geometry from a table or a transient instance of a geometry Specified using a bind variable or SDO_GEOMETRY constructor Data type is SDO_GEOMETRY The expression SDO_OVERLAPBDYINTERSECT geometry1 geometry2 TRUE evaluates to TRUE for object pairs that have the OVERLAPBDYINTERSECT topological relationship and FALSE otherwise See the Usage Notes for the SDO_RELATE operator in this chapter For an explanation of the topological relationships and the nine intersection model used by Spatial see Section 1 8 Spatial Operators 12 35 SDO_OVERLAPBDYINTERSECT
266. c shape m diminfo 1 FROM cola_markets c user _sdo geom metadata m WHERE m table name COLA MARKETS AND m column_name SHAPE AND c name cola d SDO_GEOM SDO MIN MBR ORDINATE C SHAPE M DIMINFO 1 a SDO_GEOM SDO_MAX_MBR_ORDINATE a SDO_GEOM SDO_MBR 13 36 Oracle Spatial User s Guide and Reference SDO_GEOM SDO_POINTONSURFACE SDO_GEOM SDO_POINTONSURFACE Format Description Parameters Usage Notes SDO_GEOM SDO_POINTONSURFACE geom1 IN SDO_GEOMETRY dim1 IN SDO_DIM_ARRAY RETURN SDO_GEOMETRY or SDO_GEOM SDO_POINTONSURFACE geom1 IN SDO_GEOMETRY tol IN NUMBER RETURN SDO_GEOMETRY Returns a point that is guaranteed to be on the surface of a polygon geometry object geom1 Polygon geometry object dim1 Dimensional information array corresponding to geom1 usually selected from one of the xxx_SDO_GEOM_METADATA views described in Section 2 4 tol Tolerance value see Section 1 5 5 This function returns a point geometry object representing a point that is guaranteed to be on the surface of geom1 Geometry Subprograms 13 37 SDO_GEOM SDO_POINTONSURFACE Examples Related Topics The returned point can be any point on the surface You should not make any assumptions about where on the surface the returned point is or about whether the point is the same or different when the function is called multiple times with the same input parameter values If the function format with tol is us
267. c toleranceand an arc tolerance value See the Usage Notes for the SDO_ GEOM SDO_ARC_DENSIFY function in this chapter for more information about the arc_tolerance keyword For example unit km arc_tolerance 0 05 If the input geometry is geodetic data this parameter is required and arc_ tolerance must be specified because Spatial uses the value to perform arc densification in computing the result If the input geometry is Cartesian or projected data arc_tolerance has no effect and should not be specified If this parameter is not specified for a Cartesian or projected geometry or if the arc_tolerance keyword is specified for a geodetic geometry but the unit keyword is not specified the unit of measurement associated with the data is assumed This function returns a geometry object representing the buffer polygon This function creates a rounded buffer around a point line or polygon or inside a polygon The buffer within a void is also rounded and is the same distance from the inner boundary as the outer buffer is from the outer boundary See Figure 1 7 for an illustration If the function format with tol is used all geometry objects must be defined using 4 digit SDO_GTYPE values explained in Section 2 2 1 With geodetic data this function is supported by approximations as explained in Section 6 7 3 13 14 Oracle Spatial User s Guide and Reference SDO_GEOM SDO_BUFFER Examples The following example returns a pol
268. cally be populated if measure values are not assigned 7 5 2 Redefining a Geometric Segment You can redefine a geometric segment to replace the existing measures of all shape points between the start and end point with automatically calculated measures Redefining a segment can be useful if errors have been made in one or more explicit measure assignments and you want to start over with proportionally assigned measures Figure 7 9 shows the redefinition of a segment where the existing before assigned measure values are not proportional and reflect widely varying gaps Figure 7 9 Redefining a Geometric Segment Assigned 0 88 97 100 Measures _ o o a CO e a 22 44 66 91 94 98 99 Populated Before Segment Redefinition Measures Assigned 0 100 Measures O OO On Or On es Oe 10 20 30 40 50 60 70 80 90 Populated Measures After Segment Redefinition After the segment redefinition in Figure 7 9 the populated measures reflect proportional distances along the segment 7 5 3 Clipping a Geometric Segment You can clip a geometric segment to create a new geometric segment out of an existing geometric segment as shown in Figure 7 10 part a 7 12 Oracle Spatial Users Guide and Reference LRS Operations Figure 7 10 Clipping Splitting and Concatenating Geometric Segments _ Segment Direction Start Point i End Point Start Poin S Ms End Point l Me Segment Direction a Segment Clipping e a a G
269. ccnnncccnnnnncninnanicnnnaninnnass 16 94 TUNING S bpr r m Si esst lira dial ia 18 1 Spatial Utility Subprogram sosea atungorri atita ieas ie anaa ien TE 19 1 Subprograms for Geocoding Address Data c ccccccssessssssesescsnesesestsneesesceeenesesesnanenens 20 1 Subprograms for Spatial Analysis and Mining se ssssersssessrsrtsrtessterteesseentesstentessnees 21 1 Spatial Features Supported for Locator cococococoninonannnnnnenonncncncnnnernronnennnnnnnenenerarananannnrannnos B 2 Spatial Features Not Supported for Locator ssseessssssestesstesstsrteestesstesstenteesstttessten tes B 3 Feature Availability with Standard and Enterprise Editions ocococoonenennononnnnnonrnnnnnos B 4 xix XX Send 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 followin
270. cconoonnonccnconnnnonnononnnnco non niian ii aa 6 16 Highway Features and LRS CounterpartiS ocooccininononnononoconannnononanananonononananononononanananononoso 7 22 Spatial Index Creation and Usage Statements ococincncocononenonnnncnnnnnncnrannnnncnnnnnnnrrarannnannnnos 10 1 SDO_GEOMETRY Type Methods ecccocococonnininnoninincnracanononanonncnnncnranononono nono ar nn anranon on ano cronos 11 1 Main Spatial Operators cocino aida 12 1 Convenience Operators for SDO_RELATE Operations eccnocincnnncncnnnnncnncnacrarnancnnnoos 12 2 params Keywords for the SDO_JOIN Operator cmococoninononncnrnnnnnnnncannnnanannrnrnnnaninaninanass 12 21 Keywords for the SDO_NN Param Parameter cocccncnnncoconinonononinononcncnconanacncncncnononcncnoos 12 24 Geometry SUPPrograms mito lali il a 13 1 Spatial Aggregate FUNctiONS ocococionoononconononncncnnononanancnonononananonononananonononanananonononaronononanoss 14 1 Subprograms for Coordinate System Transformation cooccncnnnnononinncinnnaninoninonanononcncnnos 15 1 Table to Hold Transformed Layer cccocinnnincnnoninonononananononononononononononononon coco cn nnonon cn co nannoncnoos 15 6 Subprograms for Creating and Editing Geometric Segment mecccccononenennoncnnncnannnnnnoss 16 1 Subprograms for Querying and Validating Geometric Segments ooconininnonarinanononoso 16 2 Subprograms for Converting Geometric Segments cococononennonnnncncnnnnncnrnancnrnrnrnnnos 16 4 Functions to Use Instead of SCALE_GEOM_ SEGMENT cccconnc
271. ch of the geometries in one layer is compared with each of the geometries in the other layer Comparable to a spatial cross product spatial query A query that includes criteria for which selected features must meet location conditions spatial reference system See coordinate system spatiotemporal data Data that contains time and or location components as one of its dimensions also referred to as geographically referenced data or georeferenced data SQL Loader A utility to load formatted data into spatial tables tolerance The distance that two points can be apart and still be considered the same for example to accommodate rounding errors The tolerance value must be a positive number greater than zero The significance of the value depends on whether or not the spatial data is associated with a geodetic coordinate system touch A geometric relationship where two objects share a common point on their boundaries but their interiors do not intersect transformation The conversion of coordinates from one coordinate system to another coordinate system If the coordinate system is georeferenced transformation can involve datum transformation the conversion of geodetic coordinates from one geodetic datum to another geodetic datum usually involving changes in the shape orientation and center position of the reference ellipsoid two tier query model The query model used by Spatial to resolve spatial queries and spatial
272. ch the data used for geocoding but the street address does not match 10 The city name matches the data used for geocoding but the postal code does not match 5 4 Oracle Spatial User s Guide and Reference Concepts for Geocoding Table 5 3 Cont Match Codes for Geocoding Operations Match Code Description 11 The postal code matches the data used for geocoding but the city name does not match 5 1 4 Error Messages for Output Geocoded Addresses For an output geocoded address the ErrorMessage attribute of the SDO_GEO_ ADDR object described in Section 5 2 1 contains a string that indicates which address attributes have been matched against the data used for geocoding Before and the value is modified to reflect which attributes have been matched Table 5 4 lists the character positions in the string and the address attribute corresponding to each position It also lists the character value that the position is set to if the attribute is matched Table 5 4 Geocoded Address Error Message Interpretation Position Attribute Value If Matched 1 4 Reserved for future 222 use 5 House or building number 6 Street prefix E 7 Street base name N 8 Street suffix U 9 Street type T 10 Secondary unit S 11 Built up area or city B 14 Region 1 15 Country C 16 Postal code P 17 Postal add on code A Geocoding Address Data 5 5 Data Types for Geocoding 5 2 Data Types for Geocoding This section des
273. cicocncnnnnnncnnoninnnninnnnonnnnonnn conc nonno non cncnncocnncnos 16 28 SDO_LRS DYNAMIC SEGMENT rerin oan E E EAE cgebeugeveseeses 16 31 SDO_ERS FINDERS DIM POS iria artos E ii 16 33 SDOERS FIND MEASURE cintura be EE ei 16 34 SDO LERS FIND OFFSET it ti di A 16 36 SDO_LRS GEOM_SEGMENT_END_MEASURE srn an A 16 38 SDO_LRS GEOM_SEGMENT_END_ PTrorrira sirar ii nsr E ET 16 40 SDO_LRS GEOM_SEGMENT_LENGTH oaia i ee E a EAE ERES 16 42 SDO_LRS GEOM_SEGMENT_START_MEASURE paein aE aki 16 44 SDO_LRS GEOM_SEGMENT_START_ PT ou ccc E con cnncnnnnos 16 46 SDO ERS GEL MEASURE rarae e E a A aa N As 16 48 SDOLLRS GET NEXT SHAPE Pintos 16 50 SDO LRSGET NEXT SHAPE PT MEASURE seres ioien iia iere tea EE S 16 52 SDO LRS GET PREV SHA PE PT eer ra e e A E EE 16 55 SDO_LRS GET_PREV_SHAPE_PT_MEASURE 1 0 eee cece cseecseeeneeeeee 16 58 SDO_LRS IS_GEOM_SEGMENT_DEFINED asire ri ni E 16 61 SDO_LRS IS_MEASURE_DECREASING eraga nar Ea E AN caninos 16 63 SDO_LRS IS_MEASURE_INCREASING maia e e RA AEEA KA EA 16 65 SDO_LRS IS_SHAPE_PT_MEASURE E oro a oi e e E E E Ee 16 67 SDO ERS LOCATE Pri a toes chess it ed ida ar 16 69 SDO_LRS MEASURE RANGE is csdessesccssistsecoscessscg stars die latina aneii RR 16 72 SDO_LRS MEASURE_TO_PERCENTAGE urairi i a E E 16 74 SDO_LRS OFFSET_GEOM_SEGMENT sereo ia a E E A E 16 76 SDO_LRS PERCENTAGE_TO_MEASURE ararte eso serei cee eNOS EEE reS ISONA EErEE EAAS 16 79 SDOLERS PROJECT P e eoe EEEE e EEEE T AEE EEEE EEE cad 16 81 SDO_
274. closest banks from an intersection but only where the bank name is CHASE If the five closest banks are not named CHASE SDO_NN with sdo_batch_size 5 will return no rows because the sdo_num_res keyword only takes proximity into account and not any conditions in the WHERE clause If you specify the optional sdo_batch_size keyword SDO_NN keeps returning neighbor geometries in distance order to the WHERE clause If the WHERE clause specifies bank _name CHASE AND rownum lt 6 you can return the five closest banks with bank_name CHASE Complex Spatial Queries Examples C 3 SDO_NN Examples SDO_NN_DISTANCE is an ancillary operator to the SDO_NN operator It returns the distance of an object returned by the SDO_NN operator and is valid only within a call to the SDO_NN operator Example C 3 finds the five cities nearest to the interstate highway 1170 and the distance in miles for each city ordered by distance in miles Example C 3 Finding the Cities Nearest to a Highway SELECT ORDERED c city sdo nn distance 1 distance_in miles FROM geod_interstates i geod_cities c WHERE i highway 1170 AND sdo nn c location i geom sdo num res 5 unit mile 1 TRUE ORDER by distance in miles In Example C 3 because the ORDERED optimizer hint is used it is important to have an index on the GEOD_INTERSTATES HIGHWAY column In this example the hint forces the query to locate highway 1170 before it tries to find
275. coding data a location in the first match found in the following is returned postal code city or town settlement within the state and state For example if the street name is incorrect but a valid postal code is specified a location in the postal code is returned RELAX_STREET_TYPE The street type can be different from the data used for geocoding For example if Main St is in the data used for geocoding Main Street would also match that as would Main Blvd if there was no Main Blvd and no other street type named Main in the relevant area RELAX_POIL NAME The name of the point of interest does not have to match the data used for geocoding For example if Jones State Park is in the data used for geocoding Jones State Pk and Jones Park would also match as long as there were no ambiguities or other matches in the data RELAX_HOUSE_ The house or building number and street type can be different NUMBER from the data used for geocoding For example if 123 Main St is in the data used for geocoding 123 Main Lane and 124 Main St would also match as long as there were no ambiguities or other matches in the data Geocoding Address Data 5 3 Concepts for Geocoding Table 5 2 Cont Match Modes for Geocoding Operations Match Mode Description RELAX_BASE_NAME RELAX_POSTAL_CODE RELAX_BUILTUP_AREA RELAX_ALL DEFAULT The base name of the street the house or building number and the street type can be different from
276. cribes the data types specific to geocoding functions and procedures 5 2 1 SDO_GEO_ADDR Type The SDO_GEO_ADDR object type is used to describe an address When a geocoded address is output by an SDO_GCDR function or procedure it is stored as an object of type SDO_GEO_ADDR Table 5 5 lists the attributes of the SDO_GEO_ADDR type Not all attributes will be relevant in any given case The attributes used for a returned geocoded address depend on the geographical context of the input address especially the country Table 5 5 SDO_GEO_ADDR Type Attributes Attribute Data Type Description Id NUMBER Not used AddressLines SDO_ Address lines The SDO_KEYWORDARRAY KEYWORDARRAY type is described in Section 5 2 3 PlaceName VARCHAR2 200 Not used StreetName VARCHAR2 200 Street name including street type Example MAIN ST IntersectStreet VARCHAR2 200 Intersecting street SecUnit VARCHAR2 200 Secondary unit such as an apartment number or building number Settlement VARCHAR2 200 Lowest level administrative area to which the address belongs See Table 5 1 Municipality VARCHAR2 200 Administrative area above settlement See Table 5 1 Region VARCHAR2 200 Administrative area above municipality if applicable or above settlement if municipality does not apply See Table 5 1 Country VARCHAR2 100 Country name or ISO country code PostalCode VARCHAR2 20 Postal code optional if administrative area 5 6 Oracle S
277. cribing a Point Along a Segment with a Measure and an OffS t ocicicinionninnnnnes 7 5 Measures Distances and Their Mapping Relationship cccccccescsceseesesteteseeeees 7 5 Measure Populating of a Geometric Seg Eeoocnincncnonnnnennncannnnncnrnrornnnennnananonnararannnnananoso 7 6 Measure Populating with Disproportional Assigned Measures cooncncoconinononinananincnononos 7 6 Linear Feature Geometric Segments and LRS PointS ococoinininnnnnonininnnnnnncnnrnocncncnos 7 8 Creating a Geometric SEQMeNt ccccceccessessssesesenseeescsesesetseseecssseceseesesessesesesesseesseesseneees 7 9 Defining a Geometric Segment cinco shee eee ia ia dai ce e 7 11 Redefining a Geometric Seg ccccoccnnonocononinonononanonononcncnononononononnnnnon cono ranorn corona ra rnrnnnaninos 7 12 Clipping Splitting and Concatenating Geometric Segments ococnnncnconinicnnnninononincncnos 7 13 Measure Assignment in Geometric Segment Operations mmccccncocononncnnnnonononcnononononcnnnos 7 14 Segment Direction with Concatemation oococnoncnccncnnnnnnnnonennncnrnnncnnnrnnnennnananan caro rornrnnnnnanoss 7 15 Scaling a Geometric Sement nea e Eaa aR ea eE ro ran nana oro iae rR Eere 7 16 Offsetting a Geometric Segment 0 cece cece cece cs cseseseececscseseseececeseesnseececesensneseeeesees 7 17 Locating a Point Along a Segment with a Measure and an Offset oooocicicinonicininanananso 7 17 Ambiguity in Location Referencing with Offsets 0 cccccccceses c
278. cts is the spatial data When the map is rendered this spatial data is used to project the locations of the objects on a two dimensional piece of paper A GIS is often used to store retrieve and render this Earth relative spatial data Types of spatial data other than GIS data that can be stored using Spatial include data from computer aided design CAD and computer aided manufacturing CAM systems Instead of operating on objects on a geographic scale CAD CAM systems work on a smaller scale such as for an automobile engine or printed circuit boards The differences among these systems are in the size and precision of the data not the data s complexity The systems might all involve the same number of data points On a geographic scale the location of a bridge can vary by a few tenths of an inch without causing any noticeable problems to the road builders whereas if the Spatial Concepts 1 3 Geometry Types diameter of an engine s pistons is off by a few tenths of an inch the engine will not run In addition the complexity of data is independent of the absolute scale of the area being represented For example a printed circuit board is likely to have many thousands of objects etched on its surface containing in its small area information that may be more complex than the details shown on a road builder s blueprints These applications all store retrieve update or query some collection of features that have both nonspa
279. d Projection Point 1 in both illustrations in Figure 7 17 7 18 Oracle Spatial Users Guide and Reference LRS Operations Figure 7 17 Multiple Projection Points I Projection Point 11 A segment gt dl s Segment Direction Projection Point Direction I I 7 Projection Point 2 P gt y Point to Be Projected Point to Be Projected 7 5 10 Converting LRS Geometries You can convert geometries from standard line string format to LRS format and the reverse The main use of conversion functions will probably occur if you have a large amount of existing line string data in which case conversion is a convenient alternative to creating all of the LRS segments manually However if you need to convert LRS segments to standard line strings for certain applications that capability is provided also Functions are provided to convert Individual line strings or points For conversion from standard format to LRS format a measure dimension named M by default is added and measure information is provided for each point For conversion from LRS format to standard format the measure dimension and information are removed In both cases the dimensional information DIMINFO metadata in the USER_SDO_GEOM_METADATA view is not affected Layers all geometries in a column For conversion from standard format to LRS format a measure dimension named M by default is added but no measure information is provid
280. d in geodetic space and therefore this type of viewport query could not be sent to the database The VIEWPORT_TRANSFORM function was created to provide a workaround to this previous restriction The viewport rectangles should be constructed with the SRID value as 0 and input to the function to generate a corresponding valid geodetic polygon This geodetic polygon can then be used in the SDO_FILTER or SDO_GEOM RELATE call as the window object An SRID value of 0 should only be specified when calling the VIEWPORT_ TRANSFORM function It is not valid in any other context in Spatial This function should be used only when the display space is equirectangular a rectangle and the data displayed is geodetic Examples The following example specifies the viewport as the whole Earth represented by an optimized rectangle It returns the names of all four cola markets This example uses the definitions from the example in Section 6 8 SELECT c name FROM cola_markets _cs c WHERE SDO FILTER c shape SDO CS VIEWPORT TRANSFORM SDO_GEOMETRY 2003 0 SRID 0 special case NULL SDO ELEM INFO ARRAY 1 1003 3 SDO ORDINATE ARRAY 180 90 180 90 8307 TRUE 15 10 Oracle Spatial User s Guide and Reference SDO_CS VIEWPORT_TRANSFORM If the optimizer does not generate an optimal plan and performance is not as you expect you can try the following alternative version of the query SELECT c name FROM cola markets_cs c SELEC
281. d objects for example nonpoint objects such as lines and polygons is defined as the minimum distance between these two objects Thus the distance between two adjacent polygons is zero If the function format with tol is used all geometry objects must be defined using 4 digit SDO_GTYPE values explained in Section 2 2 1 An exception is raised if geom1 and geom2 are based on different coordinate systems Geometry Subprograms 13 57 SDO_GEOM WITHIN_DISTANCE Examples The following example checks if cola_band cola_d are within 1 unit apart at the shortest distance between them The example uses the definitions and data from Section 2 1 Are two geometries within 1 unit of distance apart SELECT SDO GEOM WITHIN DISTANCE c b shape m diminfo 1 c d shape m diminfo FROM cola_markets c_b cola markets c_d user sdo geom metadata m WHERE m table name COLA MARKETS AND m column_ name SHAPE AND c_b name cola b AND c_d name cola d SDO_GEOM WITHIN DISTANCE C_B SHAPE M DIMINFO 1 C_D SHAPE M DIMINFO TRUE Related Topics a SDO_GEOM SDO_DISTANCE 13 58 Oracle Spatial User s Guide and Reference 14 Spatial Aggregate Functions This chapter contains reference and usage information for the spatial aggregate functions which are listed in Table 14 1 Table 14 1 Spatial Aggregate Functions Method Description SDO_AGGR_CENTROID SDO_AGGR_CONCAT_LINES SDO_AGGR_CONVEXHULL SDO_AGGR_LRS_CONC
282. d so that its vertices are presented in counterclockwise order as opposed to the clockwise order within an interior ring If geomet ry is null or has an SDO_GTYPE value ending in O this function returns a null geometry geometry cannot contain a type 0 zero element Type 0 elements are described in Section 2 3 6 An exception is raised if element or ring is an invalid number for geometry The following example extracts the first and only element in the cola_c geometry The example uses the definitions and data from Section 2 1 SELECT c name SDO UTIL EXTRACT c shape 1 FROM cola_markets c WHERE c name cola c cola c SDO GEOMETRY 2003 NULL NULL SDO ELEM INFO ARRAY 1 1003 1 SDO ORDINATE ARR AY 3 3 6 3 6 5 4 5 3 3 The following example inserts a polygon with a hole using the same INSERT statement as in Example 2 3 in Section 2 3 2 and extracts the geometry representing the hole the second subelement Notice that in the geometry returned 19 14 Oracle Spatial User s Guide and Reference SDO_UTIL EXTRACT Related Topics by the EXTRACT function the vertices are in counterclockwise order as opposed to the clockwise order in the hole second subelement in the input geometry Insert polygon with hole INSERT INTO cola markets VALUES 10 polygon with hole SDO_GEOMETRY 2003 two dimensional polygon NULL NULL SDO ELEM INFO ARRAY 1 1003 1 19 2003 1 polygon with hole
283. data i The next two INSERT statements create areas of interest for Cola B and Cola C These areas are simple polygons but not rectangles INSERT INTO cola_markets VALUES 2 cola b SDO_GEOMETRY Spatial Data Types and Metadata 2 3 Simple Example Inserting Indexing and Querying Spatial Data 2003 two dimensional polygon NULL NULL SDO ELEM INFO ARRAY 1 1003 1 one polygon exterior polygon ring SDO ORDINATE ARRAY 5 1 8 1 8 6 5 7 5 1 E INSERT INTO cola_markets VALUES 3 cola c SDO GEOMETRY 2003 two dimensional polygon NULL NULL SDO ELEM INFO ARRAY 1 1003 1 one polygon exterior polygon ring SDO_ORDINATE ARRAY 3 3 6 3 6 5 4 5 3 3 i Now insert an area of interest for Cola D This is a circle with a radius of 2 It is completely outside the first three areas of interest INSERT INTO cola_markets VALUES 4 cola _d SDO_GEOMETRY 2003 two dimensional polygon NULL NULL SDO ELEM INFO ARRAY 1 1003 4 one circle SDO ORDINATE ARRAY 8 7 10 9 8 11 Update the USER_SDO GEOM METADATA view This is required before the Spatial index can be created Do this only once for each layer that is table column combination here COLA MARKETS and SHAPE INSERT INTO USER _SDO_GEOM METADATA VALUES 2 4 Oracle Spatial User s Guide and Reference Simple Example Inserting Indexing and Querying Spatial
284. data efficiently based on an understanding of the Oracle Spatial query model and primary and secondary filtering see Section 4 2 4 1 Creating a Spatial Index Once data has been loaded into the spatial tables through either bulk or transactional loading a spatial index must be created on the tables for efficient access to the data Although each spatial index can be an R tree index or a quadtree index you are strongly encouraged to use R tree indexes and to avoid using quadtree indexes 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 If the index creation does not complete for any reason the index is invalid and must be deleted with the DROP INDEX lt index_name gt FORCE statement 4 1 1 Creating R Tree Indexes If you create a spatial index without specifying any quadtree specific parameters an R tree index is created For example the following statement creates a spatial R tree index named territory _idx using default values for parameters that apply to R tree indexes CREATE INDEX territory_idx ON territories territory geom INDEXTYPE IS MDSYS SPATIAL INDEX Indexing and Querying Spatial Data 4 1 Creating a Spatial Index For detailed information about options for creating a spatial index see the documentation for the CREATE INDEX statement in Chapter 10 R tr
285. dex Syntax ALTER INDEX schema Jindex PARAMETERS index_params physical_storage_params NOPARALLEL PARALLEL integer Keywords and Parameters Value Description INDEX_PARAMS index_status sdo_batch_size sdo_indx_dims Allows you to change the characteristics of the spatial index Specifies that index modifications are to be deferred index status deferred or that deferred index modifications are to be synchronized with the data in the spatial table index_ status synchronize See the Usage Notes for further details Data type is VARCHAR2 Specifies the number of rows to be processed at a time when the index is synchronized index_status synchronize See Section 4 1 3 for more information about using this keyword to improve performance when many rows need to be inserted Data type is NUMBER For example sdo_batch_size 500 Specifies the number of dimensions to be indexed For example a value of 2 causes the first two dimensions to be indexed Must be less than or equal to the number of actual dimensions number of SDO_DIM_ELEMENT instances in the dimensional array that describes the geometry objects in the column If the value is 3 or higher the only Spatial operator that can be used on the indexed geometries is SDO_FILTER the other operators described in Chapter 12 cannot be used Data type is NUMBER Default 2 10 2 Oracle Spatial Users Guide and Reference ALTER INDEX
286. do_rowid ROWID result VARCHAR2 2000 CALL SDO GEOM VALIDATE LAYER WITH CONTEXT COLA MARKETS SHAPE VAL RESULTS 2 SELECT from val_results 2 2 SDO_GEOMETRY Object Type With Spatial the geometric description of a spatial object is stored in a single row in a single column of object type SDO_GEOMETRY in a user defined table Any table that has a column of type SDO_GEOMETRY must have another column or set of columns that defines a unique primary key for that table Tables of this sort are sometimes referred to as spatial tables or spatial geometry tables Oracle Spatial defines the object type SDO_GEOMETRY as CREATE TYPE sdo geometry AS OBJECT SDO_GTYPE NUMBER SDO_SRID NUMBER SDO_POINT SDO POINT TYPE SDO_ELEM_INFO SDO ELEM INFO ARRAY SDO_ORDINATES SDO ORDINATE ARRAY Oracle Spatial also defines the SDO_POINT_TYPE SDO_ELEM_INFO_ARRAY and SDO_ORDINATE_ARRAY types which are used in the SDO_GEOMETRY type definition as follows CREATE TYPE sdo point type AS OBJECT X NUMBER Y NUMBER Z NUMBER CREATE TYPE sdo_elem_info_array AS VARRAY 1048576 of NUMBER CREATE TYPE sdo ordinate array AS VARRAY 1048576 of NUMBER The sections that follow describe the semantics of each SDO_GEOMETRY attribute and then describe some usage considerations Section 2 2 6 The SDO_GEOMETRY object type has methods that provide convenient access to some of the attributes These methods are described in Chapter 11 S
287. ds the index using supplied parameters Spatial index creation involves creating and inserting index data for each row in the underlying table column being spatially indexed into a table with a prescribed format All rows in the underlying table are processed before the insertion of index data is committed and this requires adequate rollback segment space This statement does not use any previous parameters from the index creation All parameters should be specified for the index you want to rebuild For more information about using the layer_gtype keyword to constrain data in a layer to a geometry type see Section 4 1 4 With a partitioned spatial index you must use a separate ALTER INDEX REBUILD statement for each partition to be rebuilt See also the Usage Notes for the CREATE INDEX statement for usage information about many of the available parameters and about the use of the PARALLEL keyword The following example rebuilds OLDINDEX with an SDO_LEVEL value of 12 ALTER INDEX oldindex REBUILD PARAMETERS sdo level 12 a CREATE INDEX a DROP INDEX ALTER TABLE and ALTER INDEX clauses for partition maintenance in Oracle Database SQL Reference 10 8 Oracle Spatial Users Guide and Reference ALTER INDEX RENAME TO ALTER INDEX RENAME TO Syntax Purpose ALTER INDEX schema Jindex RENAME TO lt new_index_name gt ALTER INDEX schema index PARTITION partition RENAME TO lt new_partition_name gt Changes the
288. e geometric segment Linear Referencing Subprograms 16 81 SDO_LRS PROJECT_PT Parameters Usage Notes geom_segment Geometric segment to be checked dim_array Dimensional information array corresponding to geom_segment usually selected from one of the xxx_SDO_GEOM_METADATA views described in Section 2 4 point Point to be projected tolerance Tolerance value see Section 1 5 5 and Section 7 6 point_dim_array Dimensional information array corresponding to point usually selected from one of the xxx_SDO_GEOM_METADATA views described in Section 2 4 offset Offset shortest distance from the point to the geometric segment This function returns the projection point including its measure of a specified point point The projection point is on the geometric segment If multiple projection points exist the first projection point encountered from the start point is returned If you specify the output parameter of fset the function stores the signed offset shortest distance from the point to the geometric segment For more information about the offset to a geometric segment see Section 7 1 5 An exception is raised if geom_segment or point has an invalid geometry type or dimensionality or if geom_segment and point are based on different coordinate systems The _3D format of this function SDO_LRS PROJECT_PT_3D is available For information about _3D formats of LRS functions see Section 7 4 For more i
289. e Chapter 12 Spatial procedures and functions are provided as subprograms in PL SQL packages such as SDO_GEOM SDO_CS and SDO_LRS These subprograms do not require that a spatial index be defined and they do not use a spatial index if it is defined These subprograms can be used in the WHERE clause or in a subquery If two geometries are input parameters to a Spatial procedure or function both must have the same coordinate system The following performance related guidelines apply to the use of spatial operators procedures and functions a If an operator and a procedure or function perform comparable operations and if the operator satisfies your requirements use the operator For example unless you need to do otherwise use SDO_RELATE instead of SDO_GEOM RELATE and use SDO_WITHIN_DISTANCE instead of SDO_GEOM WITHIN_ DISTANCE 1 18 Oracle Spatial Users Guide and Reference Spatial Aggregate Functions a With operators always specify TRUE in uppercase That is specify TRUE and do not specify lt gt FALSE or true With operators use the ORDERED optimizer hint if the query window comes from a table You must use this hint if multiple windows come from a table See the Usage Notes and Examples for specific operators for more information 1 10 Spatial Aggregate Functions SQL has long had aggregate functions which are used to aggregate the results of a SQL query The following example uses the SUM agg
290. e 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 INDEX statement 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 xxxvi DBA_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
291. e C4 ORDER BY distance_in_miles orders the results from the WHERE clause by distance in miles The statement in Example C 4 produces the following output slightly reformatted for readability CITY POP90 DISTANCE IN MILES St Louis 396685 5 36297295 Kansas City 435146 227 404883 Indianapolis 741952 234 708666 Memphis 610337 244 202072 Chicago 2783726 253 547961 C 4 SDO_AGGR_UNION Example When you use the SDO_AGGR_UNION aggregate function very large geometries can result When geometries have many coordinates spatial operations such as union can be time consuming It may be better to divide a single spatial aggregate union operation function into multiple nested aggregate functions in the same SQL statement Example C 5 aggregates all the counties in Texas producing the boundary for the state of Texas Example C 5 Performing Aggregate Union of All Counties in Texas select sdo_aggr_union mdsys sdoaggrtype aggr_geom 0 5 aggr_geom from select sdo_aggr_union mdsys sdoaggrtype aggr_geom 0 5 aggr_geom from select sdo aggr_union mdsys sdoaggrtype aggr_geom 0 5 aggr_geom from select sdo aggr_union mdsys sdoaggrtype aggr_geom 0 5 aggr_geom from select sdo aggr_union mdsys sdoaggrtype geom 0 5 aggr_geom from geod_counties where state_abrv TX group by mod rownum 16 group by mod rownum 8 group by mod rownum 4 group by mod rownum 2 1 Oracle Spatial User s Guide and Reference Glos
292. e Store at http 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 http otn oracle com membership If you already have a username and password for OTN then you can go directly to the documentation section of the OTN Web site at http otn oracle com documentation Conventions The following conventions are used in this guide xxviii Convention Meaning Vertical ellipsis points in an example mean that information not directly related to the example has been omitted Horizontal 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 lt gt Angle brackets enclose user supplied names Brackets enclose optional clauses from which you can choose one or none Xxix XXX New and Changed Features This section describes new and changed Oracle Spatial features for the current release GeoRaster GeoRa
293. e a particular spatial interaction This operator performs both primary and secondary filter operations Keywords and Parameters Value Description geometry1 Specifies a geometry column in a table The column must be spatially indexed Data type is SDO_GEOMETRY geometry2 Specifies either a geometry from a table or a transient instance of a geometry Specified using a bind variable or SDO_GEOMETRY constructor Data type is SDO_GEOMETRY param Uses the mask keyword to specify the topological relationship of interest This is a required parameter Data type is VARCHAR2 Valid mask keyword values are one or more of the following in the nine intersection pattern TOUCH OVERLAPBDYDISJOINT OVERLAPBDYINTERSECT EQUAL INSIDE COVEREDBY CONTAINS COVERS ANYINTERACT ON Multiple masks are combined with the logical Boolean operator OR for example nask inside touch however see the Usage Notes for an alternative syntax using UNION ALL that may result in better performance See Section 1 8 for an explanation of the nine intersection relationship pattern For backward compatibility any additional keywords for the param parameter that were supported in the previous release will still work however the use of those keywords is discouraged and is not supported for new uses of the operator Spatial Operators 12 39 SDO_RELATE Returns Usage Notes The expression SDO_RELATE geometry1 geometry2 mask lt some_mask
294. e and Reference SDO_LRS GEOM_SEGMENT_END_MEASURE SDO_LRS GEOM SEGMENT END MEASURE ROUTE GEOMETRY Linear Referencing Subprograms 16 39 SDO_LRS GEOM_SEGMENT_END_PT SDO_LRS GEOM_SEGMENT_END_PT Format Description Parameters Usage Notes Examples SDO_LRS GEOM_SEGMENT_END_PT geom_segment IN SDO_GEOMETRY dim_array IN SDO_DIM_ARRAY RETURN SDO_GEOMETRY Returns the end point of a geometric segment geom_segment Geometric segment whose end point is to be returned dim_array Dimensional information array corresponding to geom_segment usually selected from one of the xxx_SDO_GEOM_METADATA views described in Section 2 4 This function returns the end point of geom_segment An exception is raised if geom_segment has an invalid geometry type or dimensionality The _3D format of this function GSDO_LRS GEOM_SEGMENT_END_PT_3D is available For information about _3D formats of LRS functions see Section 7 4 The following example returns the end point of the geometric segment representing Route 1 This example uses the definitions from the example in Section 7 7 SELECT SDO_LRS GEOM SEGMENT END PT route_geometry FROM lrs_ routes WHERE route_id 1 SDO_LRS GEOM SEGMENT END PT ROUTE GEOMETRY SDO_GTYPE SDO SRID SDO POINT X Y 16 40 Oracle Spatial User s Guide and Reference SDO_LRS GEOM_SEGMENT_END_PT SDO GEOMETRY 3301 NULL NULL SDO ELEM INFO ARRAY 1 1 1 SDO ORDINATE ARRAY
295. e data A tolerance value is specified in two cases Inthe geometry metadata definition for a layer see Section 1 5 5 1 a Asan input parameter to certain functions see Section 1 5 5 2 For additional information about tolerance with linear referencing system LRS data see Section 7 6 1 5 5 1 Tolerance in the Geometry Metadata for a Layer The dimensional information for a layer includes a tolerance value Specifically the DIMINFO column described in Section 2 4 3 of the xxx_SDO_GEOM_METADATA views includes an SDO_TOLERANCE value for each dimension and the value should be the same for each dimension 1 8 Oracle Spatial Users Guide and Reference Data Model If a function accepts an optional tolerance parameter and this parameter is null or not specified the SDO_TOLERANCE value of the layer is used Using the non geodetic data from the example in Section 2 1 the actual distance between geometries cola_b and cola_d is 0 846049894 If a query uses the SDO_ GEOM SDO_DISTANCE function to return the distance between cola_b and cola_dand does not specify a tolerance parameter value the result depends on the SDO_TOLERANCE value of the layer For example a Ifthe SDO_TOLERANCE value of the layer is 0 005 this query returns 846049894 Ifthe SDO_TOLERANCE value of the layer is 0 5 this query returns 0 The zero result occurs because Spatial first constructs an imaginary buffer of the tolerance value 0 5 around each geometry
296. e embedded in a user defined data type definition The procedure is very similar to that for using the SDO_GEOMETRY type for a spatial data column 1 Create the user defined data type Create a table with a column based on that data type Insert data into the table Update the USER_SDO_GEOM_METADATA view nn PF p Create the spatial index on the geometry attribute Extending Spatial Indexing Capabilities 9 1 SDO_GEOMETRY Objects in User Defined Type Definitions 6 Perform queries on the data For example assume that you want to follow the cola markets scenario in the simplified example in Section 2 1 but want to incorporate the market name attribute and the geometry attribute in a single type First create the user defined data type as in the following example that creates an object type named MARKET_ TYPE CREATE OR REPLACE TYPE market _type AS OBJECT name VARCHAR2 32 shape SDO GEOMETRY Create a table that includes a column based on the user defined type The following example creates a table named COLA_MARKETS_2 that will contain the same information as the COLA_MARKETS table used in the example in Section 2 1 CREATE TABLE cola markets 2 mkt_id NUMBER PRIMARY KEY market MARKET TYPE Insert data into the table using the object type name as a constructor For example INSERT INTO cola_markets 2 VALUES 1 MARKET TYPE cola a SDO_GEOMETRY 2003 two dimensional polygon NULL NULL
297. e must be an SDO_UNIT value from the MDSYS SDO_DIST_UNITS table for example unit KM If the unit keyword is not specified the unit of measurement associated with the geometry is used See Section 2 6 for more information about unit of measurement specification The following example identifies cities with a 1990 population POP90 column value greater than 120 000 that are located within 20 kilometers of interstate highways GEOM column in the GEOD_INTERSTATES table It stores the results in a table named COLOCATION_TABLE and performs an internal commit operation after each 20 internal operations Spatial Analysis and Mining Subprograms 21 13 SDO_SAM COLOCATED_REFERENCE_FEATURES EXECUTE SDO SAM COLOCATED REFERENCE FEATURES geod_cities location pop90 gt 120000 geod_interstates geom null distance 20 unit km colocation table 20 21 14 Oracle Spatial User s Guide and Reference SDO_SAM SIMPLIFY_GEOMETRY SDO_SAM SIMPLIFY_GEOMETRY Format Description Parameters SDO_SAM SIMPLIFY_GEOMETRY geom IN SDO_GEOMETRY dim IN SDO_DIM_ARRAY pct_area_change_limit IN NUMBER DEFAULT 2 RETURN SDO_GEOMETRY or SDO_SAM SIMPLIFY_GEOMETRY geom IN SDO_GEOMETRY tol IN NUMBER pct_area_change_limit IN NUMBER DEFAULT 2 RETURN SDO_GEOMETRY Simplifies a geometry geom Geometry to be simplified dim Dimensional array for the geometry to be simplified tol Tolerance value see Section 1 5
298. e point 1 7 a SDO_GEOM SDO_INTERSECTION a SDO_GEOM SDO_UNION a SDO_GEOM SDO_XOR Geometry Subprograms 13 23 SDO_GEOM SDO_DISTANCE SDO_GEOM SDO_DISTANCE Format SDO_GEOM SDO_DISTANCE geom1 IN SDO_GEOMETRY dimi IN SDO_DIM_ARRAY geom2 IN SDO_GEOMETRY dim2 IN SDO_DIM_ARRAY unit IN VARCHAR2 RETURN NUMBER or SDO_GEOM SDO_DISTANCE geom1 IN SDO_GEOMETRY geom2 IN SDO_GEOMETRY tol IN NUMBER unit IN VARCHAR2 RETURN NUMBER Description Computes the distance between two geometry objects The distance between two geometry objects is the distance between the closest pair of points or segments of the two objects Parameters geom1 Geometry object whose distance from geom2 is to be computed dim1 Dimensional information array corresponding to geom1 usually selected from one of the xxx_SDO_GEOM_METADATA views described in Section 2 4 13 24 Oracle Spatial User s Guide and Reference SDO_GEOM SDO_DISTANCE Usage Notes Examples Related Topics geom2 Geometry object whose distance from geom1 is to be computed dim2 Dimensional information array corresponding to geom2 usually selected from one of the xxx_SDO_GEOM_METADATA views described in Section 2 4 unit Unit of measurement a quoted string with unit and an SDO_UNIT value from the MDSYS SDO_DIST_UNITS table for example unit KM See Section 2 6 for more information about unit of measurement specification If this par
299. e returned segment that the Y values 6 are 2 greater than the Y values 4 of the relevant part of the original segment 16 78 Oracle Spatial User s Guide and Reference SDO_LRS PERCENTAGE_TO_MEASURE SDO_LRS PERCENTAGE_TO_MEASURE Format SDO_LRS PERCENTAGE_TO_MEASURE geom_segment IN SDO_GEOMETRY percentage IN NUMBER RETURN NUMBER or SDO_LRS PERCENTAGE_TO_MEASURE geom_segment IN SDO_GEOMETRY dim_array IN SDO_DIM_ARRAY percentage IN NUMBER RETURN NUMBER Description Returns the measure value of a specified percentage 0 to 100 of the measure range of a geometric segment Parameters geom_segment Cartographic representation of a linear feature dim_array Dimensional information array corresponding to geom_segment usually selected from one of the xxx_SDO_GEOM_METADATA views described in Section 2 4 percentage Percentage value Must be from 0 to 100 This function returns the measure value corresponding to this percentage of the measure range Linear Referencing Subprograms 16 79 SDO_LRS PERCENTAGE_TO_MEASURE Usage Notes This function returns the measure value corresponding to this percentage of the measure range The measure range is the end measure minus the start measure For example if the measure range of geom_segment is 50 and percentage is 40 the function returns 20 because 40 of 50 20 This function performs the reverse of the SDO_LRS MEASURE_TO_PERCENTAGE function whic
300. e string boundary of 1 15 compound 2 13 2 18 reversing 19 29 self crossing 1 5 linear features 7 7 linear measure 7 4 linear referencing system LRS 3D formats of functions 7 10 conceptual and usage information 7 1 data model 7 8 example 7 21 GET_LRS_DIM method 11 4 limiting indexing to X and Y dimensions 7 9 LRS point 7 7 segments 7 2 subprogram reference information 16 1 tolerance values with LRS functions 7 20 upgrading data to current release A 1 loading spatial data 3 1 local coordinate systems 6 7 local coordinates 1 7 6 2 LOCAL partitioning spatial index 4 5 LOCATE_PT function 16 69 location prospecting 8 6 Locator B 1 LRS See linear referencing system LRS LRS point 7 7 map projections 6 16 match codes 5 4 match modes 5 3 MBR Index 6 See minimum bounding rectangle MDDATA schema 1 22 MDSYS schema 1 2 MDSYS CS_SRS table 6 8 MDSYS SDO_ANGLE_UNITS table 6 12 MDSYS SDO_AREA_UNITS table 2 33 MDSYS SDO_CS package 15 1 MDSYS SDO_DATUMS table 6 12 MDSYS SDO_DIST_UNITS table 2 33 MDSYS SDO_ELLIPSOIDS table 6 15 MDSYS SDO_GCDR package 20 1 MDSYS SDO_PROJECTIONS table 6 16 MDSYS SDO_SAM package 21 1 measure 7 4 populating 7 5 resetting 16 87 reversing 16 91 measure range 7 7 MEASURE_RANGE function 16 72 MEASURE_TO_PERCENTAGE function 16 74 messages Spatial error messages 1 23 migration See upgrading minimum bounding rectangle AVERAGE _MBR procedure 18 2 EXTEN
301. earest restaurants If geometryl1 and geomet ry2 are based on different coordinate systems geomet ry2 is temporarily transformed to the coordinate system of geomet ry1 for the operation to be performed as described in Section 6 7 1 SDO_NN is not supported for spatial joins In some situations the SDO_NN operator will not use the spatial index unless an optimizer hint forces the index to be used This can occur when a query involves a join and if the optimizer hint is not used in such situations an internal error occurs To prevent such errors you should always specify an optimizer hint to use the spatial index with the SDO_NN operator regardless of how simple or complex the query is For example the following excerpt from a query specifies to use the COLA_SPATIAL_IDX index that is defined on the COLA_MARKETS table SELECT INDEX c cola_spatial_idx c mkt_id c name FROM cola_markets c However if there is an index associated with the column predicate in the WHERE clause be sure that this index is not used by specifying the NO_INDEX hint for that index For example if there was an index named COLA_NAME_IDX defined on the NAME column you would need to specify the hints in the preceding example as follows SELECT INDEX c cola_spatial_idx NO _INDEX c cola_name_idx c mkt_id c name FROM cola markets c 12 26 Oracle Spatial User s Guide and Reference SDO_NN Examples Note however that
302. ece ceeeseeseeeeenees 7 18 Multiple Projection Points is ccc c cstsevicscdustetescestetetetedcosutsesestsbuatutedss ubasassterdeveatatessteebdes 7 19 Conversion from Standard to LRS Line String 0 ceeesesesesteteteseeceeesesesneneneneaes 7 20 Segment for Clip Operation Affected by Tolerance ccccccccccecsesesteteteeceeesesestaneneneaes 7 21 Simplified LRS Example Highway concncncccnnonononocananonicinanonononononononononcnononononon rn cono nanncncnioss 7 22 Spatial Mining and Oracle Data Mining cccccncnnncanonananininonanoncncnrnnononororonon ono no ron nn nino nario canso 8 3 AT TOLEDO 13 9 SDO_GEOM SDO_DIFFERENCE ccccsscssssssssscesseesceseeececseeesecssesaecseceeseseseeseeseessseeees 13 22 xvii xviii 13 3 13 4 13 5 16 1 19 1 SDO_GEOM SDO_INTERSECTION areia ni iet en E EEE 13 27 SDO GEOM SDO UNION eeheehe e E A EE Ea E EERE 13 40 SPOSGEOM SPO XOR mea ehoa er io AA ae E a EN A 13 43 Translating a Geometric Segment ss sssesiesississesssesissteseesrestetissessententessesnenienressesnes 16 103 Simplification of a Geometry s sessesessessessessiesissesssesiestestssnesnentensisnesnentinnissisnententeenesseene 19 34 List of Tables PAPER SEPARA IO IS 0 s Ay Tpl k k 12 1 12 2 12 3 12 4 13 1 14 1 15 1 15 2 16 1 16 2 16 3 16 4 18 1 19 1 20 1 21 1 B 1 B 2 B 3 Valid SDO GTYPE Valles aa Ses esca 2 7 Values and Semantics in SDO_ELEM_INFO ooocccnonnnnonnncninnnnnnnnn
303. ect that represents the convex hull of a geometry object geom1 Geometry object dim1 Dimensional information array corresponding to geoml usually selected from one of the xxx_SDO_GEOM_METADATA views described in Section 2 4 tol Tolerance value see Section 1 5 5 The convex hull is a simple convex polygon that completely encloses the geometry object Spatial uses as few straight line sides as possible to create the smallest polygon that completely encloses the specified object A convex hull is a convenient way to get an approximation of a complex geometry object Geometry Subprograms 13 19 SDO_GEOM SDO_CONVEXHULL Examples Related Topics If the geometry geom1 contains any arc elements the function calculates the minimum bounding rectangle MBR for each arc element and uses these MBRs in calculating the convex hull of the geometry If the geometry object geom1 is a circle the function returns a square that minimally encloses the circle The function returns a null value if geom1 is of point type has fewer than three points or vertices or consists of multiple points all in a straight line If the function format with tol is used all geometry objects must be defined using 4 digit SDO_GTYPE values explained in Section 2 2 1 With geodetic data this function is supported by approximations as explained in Section 6 7 3 The following example returns a geometry object that is the convex hull of cola_c The
304. ed all geometry objects must be defined using 4 digit SDO_GTYPE values explained in Section 2 2 1 The following example returns a geometry object that is a point on the surface of cola_a The example uses the definitions and data from Section 2 1 Return a point on the surface of a geometry SELECT SDO GEOM SDO POINTONSURFACE c shape m diminfo FROM cola_markets c user_sdo geom metadata m WHERE m table_name COLA MARKETS AND m column_name SHAPE AND c name cola_a SDO_GEOM SDO_ POINTONSURFACE C SHAPE M DIMINFO SDO_GTYPE SDO_SRID SDO POINT X SDO _ GEOMETRY 2001 NULL NULL SDO ELEM INFO ARRAY 1 1 1 SDO ORDINATE ARRAY 1 1 None 13 38 Oracle Spatial User s Guide and Reference SDO_GEOM SDO_UNION SDO_GEOM SDO_UNION Format SDO_GEOM SDO_UNION geom1 IN SDO_GEOMETRY dim1 IN SDO_DIM_ARRAY geom2 IN SDO_GEOMETRY dim2 IN SDO_DIM_ARRAY RETURN SDO_GEOMETRY or SDO_GEOM SDO_UNION geom1 IN SDO_GEOMETRY geom2 IN SDO_GEOMETRY tol IN NUMBER RETURN SDO_GEOMETRY Description Returns a geometry object that is the topological union OR operation of two geometry objects Parameters geom1 Geometry object dim1 Dimensional information array corresponding to geom1 usually selected from one of the xxx_SDO_GEOM_METADATA views described in Section 2 4 geom2 Geometry object Geometry Subprograms 13 39 SDO_GEOM SDO_UNION Usage Notes Examples dim2 Dimensiona
305. ed for each point For conversion from LRS format to standard format the measure dimension and information are removed In both cases the dimensional information DIMINFO metadata in the USER_SDO_GEOM_METADATA view is modified as needed a Dimensional information DIMINFO The dimensional information DIMINFO metadata in the USER_SDO_GEOM_ METADATA view is modified as needed For example converting a standard Linear Referencing System 7 19 Tolerance Values with LRS Functions dimensional array with X and Y dimensions SDO_DIM_ELEMENT to an LRS dimensional array causes an M dimension SDO_DIM_ELEMENT to be added Figure 7 18 shows the addition of measure information when a standard line string is converted to an LRS line string using the SDO_LRS CONVERT_TO_LRS_GEOM function The measure dimension values are underlined in Figure 7 18 Figure 7 18 Conversion from Standard to LRS Line String Standard Line String OOO 0 0 10 0 20 0 LRS Line String After Conversion O C 0 0 0 10 0 10 20 0 20 For conversions of point geometries the SDO_POINT attribute described in Section 2 2 3 in the returned geometry is affected as follows a Ifa standard point is converted to an LRS point the SDO_POINT attribute information in the input geometry is used to set the SDO_ELEM_INFO and SDO_ORDINATES attributes described in Section 2 2 4 and Section 2 2 5 in the resulting geometry and the SDO_POINT attribute in the
306. ee also bins bins assigning 21 10 computing 21 8 tiled 21 24 boundary ofan area 1 14 of line string 1 15 of multiline string 1 15 of polygon 1 15 bounding rectangle Index 1 minimum 18 7 buffer area 13 13 bulk loading of spatial data 3 1 C C language examples using OCI 1 23 Cartesian coordinates 1 7 6 2 center of gravity centroid 13 17 centroid SDO_AGGR_CENTROID aggregate function 14 2 SDO_CENTROID function 13 17 circle creating polygon approximating 19 5 not supported with geodetic data 6 6 type 2 13 CIRCLE POLYGON function 19 5 CLIP_GEOM_SEGMENT function 16 6 clipping geometric segment 7 12 COLOCATED_REFERENCE_FEATURES procedure 21 12 colocation mining 8 5 column name restrictions on spatial column names 2 26 COLUMN_NAME in USER_SDO_GEOM_ METADATA 2 26 compatibility A 1 complex examples queries C 1 compound element 2 10 compound line string 2 13 2 18 compound polygon 2 13 CONCAT_LINES function 19 7 CONCATENATE_GEOM_SEGMENTS function 16 8 concatenating geometric segments 7 13 line or multiline geometries 14 4 LRS geometries 7 15 14 7 CONNECTED_GEOM_SEGMENTS function 16 11 consistency Index 2 checking for valid geometry types 13 47 constraining data toa geometry type 4 4 CONTAINS SDO_CONTAINS operator 12 5 topological relationship 1 16 CONVERSION_FACTOR column in SDO_ANGLE_UNITS table 6 12 in SDO_AREA_UNITS table 2 34 in SDO_DIST_UNI
307. ee indexes can be built on two three or four dimensions of data The default number of dimensions is two but if the data has more than two dimensions you can use the sdo_indx_dims parameter keyword to specify the number of dimensions on which to build the index However if a spatial index has been built on more than two dimensions of a layer the only spatial operator that can be used against that layer is SDO_FILTER the primary filter or index only query which considers all dimensions The SDO_RELATE SDO_NN and SDO_WITHIN_ DISTANCE operators are disabled if the index has been built on more than two dimensions If the rollback segment is not large enough an attempt to create an R tree index will fail The rollback segment should be 100 n bytes where n is the number of rows of data to be indexed For example if the table contains 1 million 1 000 000 rows the rollback segment size should be 100 000 000 100 million bytes To ensure an adequate rollback segment or if you have tried to create an R tree index and received an error that a rollback segment cannot be extended review or have a DBA review the size and structure of the rollback segments Create a public rollback segment of the appropriate size and place that rollback segment online In addition ensure that any small inappropriate rollback segments are placed offline during large spatial index operations For information about performing these operations on a rollback segment
308. el A commit operation is performed by this procedure If any of the upgrade steps fails nothing is upgraded for the layer layer is the underlying layer name without the SDOGEOM suffix The old SDO_GID is stored in gidcolumn SDO_GTYPE values of 4 digits are created using the format ditt shown in Table 2 1 in Section 2 2 1 SDO_ETYPE values are created using the values discussed in Section 2 2 4 The procedure orders geometries so that exterior rings are followed by their interior rings and saves them in the correct rotation counterclockwise for exterior rings and clockwise for interior rings The following example changes the definitions of geometry objects in the ROADS table from the release 8 1 5 or higher format to the format of the current release SQL gt execute sdo migrate to current ROADS 17 4 Oracle Spatial Users Guide and Reference 18 Spatial Tuning Subprograms This chapter contains descriptions of the tuning subprograms shown in Table 18 1 Table 18 1 Tuning Subprograms Subprogram Description SDO_TUNE AVERAGE_MBR SDO_TUNE ESTIMATE_RTREE_ INDEX_SIZE SDO_TUNE EXTENT_OF deprecated SDO_TUNE MIX_INFO SDO_TUNE QUALITY_ DEGRADATION Calculates the average minimum bounding rectangle for geometries in a layer Estimates the maximum number of megabytes needed for an R tree spatial index table Returns the minimum bounding rectangle of the data in a layer C
309. em is georeferenced transformation can involve datum transformation the conversion of geodetic coordinates from one geodetic datum to another geodetic datum usually involving changes in the shape orientation and center position of the reference ellipsoid 6 2 Geodetic Coordinate Support Effective with Oracle9i Spatial provides a rational and complete treatment of geodetic coordinates Before Oracle9i Spatial computations were based solely on flat Cartesian coordinates regardless of the coordinate system specified for the layer of geometries Consequently computations for data in geodetic coordinate systems were inaccurate because they always treated the coordinates as if they were on a flat surface and they did not consider the curvature of the surface Effective with release 9 2 ellipsoidal surface computations consider the curvatures of arcs in the specified geodetic coordinate system and return correct accurate results In other words Spatial queries return the right answers all the time 6 2 1 Geodesy and Two Dimensional Geometry A two dimensional geometry is a surface geometry but the important question is What is the surface A flat surface plane is accurately represented by Cartesian coordinates However Cartesian coordinates are not adequate for representing the surface of a solid A commonly used surface for spatial geometry is the surface of the Earth and the laws of geometry there are different than they are in a p
310. end_measure is invalid start_measure and end_measure can be any points on the geometric segment They do not have to be in any specific order For example start_measure and end measure can be 5 and 10 respectively or 10 and 5 respectively The direction and measures of the resulting geometric segment are preserved that is they reflect the original segment The _3D format of this function SDO_LRS CLIP_GEOM_SEGMENT_3D is available For information about _3D formats of LRS functions see Section 7 4 For more information about clipping geometric segments see Section 7 5 3 The following example clips the geometric segment representing Route 1 returning the segment from measures 5 through 10 This segment might represent a construction zone This example uses the definitions from the example in Section 7 7 SELECT SDO _LRS CLIP_GEOM SEGMENT route geometry 5 10 FROM lrs_ routes WHERE route _id 1 SDO_LRS CLIP_GEOM SEGMENT ROUTE GEOMETRY 5 10 SDO_GTYPE SDO SRID SDO POINT X SDO GEOMETRY 3302 NULL NULL SDO ELEM INFO ARRAY 1 2 1 SDO ORDINATE ARRAY 5 4 5 8 4 8 10 4 10 Linear Referencing Subprograms 16 7 SDO_LRS CONCATENATE_GEOM_SEGMENTS SDO_LRS CONCATENATE_GEOM_SEGMENTS Format SDO_LRS CONCATENATE_GEOM_SEGMENTS geom_segment_1 IN SDO_GEOMETRY geom_segment_2 IN SDO_GEOMETRY tolerance IN NUMBER RETURN SDO_GEOMETRY or SDO_LRS CONCATENATE_GEOM_SEGMENTS geom_segment_1 IN SDO_GE
311. eometries Concatenate two touching lines one from 1 1 to 5 1 and the other from 5 1 to 8 1 SELECT SDO_UTIL CONCAT LINES SDO GEOMETRY 2002 NULL NULL SDO ELEM INFO ARRAY 1 2 1 SDO_ORDINATE ARRAY 1 1 5 1 SDO GEOMETRY 2002 NULL NULL SDO ELEM INFO ARRAY 1 2 1 SDO_ORDINATE ARRAY 5 1 8 1 FROM DUAL SDO_UTIL CONCAT LINES SDO GEOMETRY 2002 NULL NULL SDO ELEM INFO ARRAY 1 2 1 SDO SDO GEOMETRY 2002 NULL NULL SDO ELEM INFO ARRAY 1 2 1 SDO ORDINATE ARRAY 1 1 5 1 8 1 Related Topics a SDO_AGGR_CONCAT_LINES in Chapter 14 a SDO_LRS CONCATENATE_GEOM_SEGMENTS in Chapter 16 19 8 Oracle Spatial Users Guide and Reference SDO_UTIL CONVERT_UNIT SDO_UTIL CONVERT_UNIT Format Description Parameters Usage Notes SDO_UTIL CONVERT_UNIT input_value IN NUMBER from_unit IN VARCHAR2 to_unit IN VARCHAR2 RETURN NUMBER Converts values from one angle area or distance unit of measure to another input_value Number of units to be converted For example to convert 10 decimal degrees to radians specify 10 from_unit The unit of measure from which to convert the input value Must be a value from the SDO_UNIT column of the MDSYS ANGLE_UNITS table described in Section 6 4 2 the MDSYS SDO_AREA_UNITS table described in Section 2 6 or the MDSYS SDO_DIST_UNITS table described in Section 2 6 For example to convert decimal degrees to radians specify Degree to_unit The un
312. eometry object geom Geometry object dim Dimensional information array corresponding to geom usually selected from one of the xxx SDO_GEOM_METADATA views described in Section 2 4 ordinate_pos Position of the ordinate dimension in the definition of the geometry object 1 for the first ordinate 2 for the second ordinate and so on For example if geom has X Y ordinates 1 identifies the X ordinate and 2 identifies the Y ordinate Geometry Subprograms 13 31 SDO_GEOM SDO_MAX_MBR_ORDINATE Usage Notes Examples Related Topics This function is not supported with geodetic data The following example returns the maximum X first ordinate value of the minimum bounding rectangle of the cola_d geometry in the COLA_MARKETS table The example uses the definitions and data from Section 2 1 The minimum bounding rectangle of cola_d is returned in the example for the SDO_ GEOM SDO_MBR function SELECT SDO GEOM SDO MAX MBR ORDINATE c shape m diminfo 1 FROM cola_markets c user_sdo geom metadata m WHERE m table_name COLA MARKETS AND m column_name SHAPE AND c name cola_d SDO_GEOM SDO MAX MBR ORDINATE C SHAPE M DIMINFO 1 a SDO_GEOM SDO_MBR a SDO_GEOM SDO_MIN_MBR_ORDINATE 13 32 Oracle Spatial User s Guide and Reference SDO_GEOM SDO_MBR SDO_GEOM SDO_MBR Format Description Parameters Usage Notes Examples SDO_GEOM SDO_MBR geom IN SDO_GEOMETRY dim IN SDO_DIM_ARRAY RETURN
313. eometry objects and returns context information about any invalid geometries geom_table Spatial geometry table geom_column Geometry object column to be examined result_table Result table to hold the validation results A row is added to result_table for each invalid geometry If there are no invalid geometries one or more depending on the commit_interval value rows with a result of DONE are added commit_interval Number of geometries to validate before Spatial performs an internal commit operation and writes a row with a result of DONE to result_table if no rows for invalid geometries have been written since the last commit operation If commit_interval is not specified no internal commit operations are performed during the validation The commit_interval option is helpful if you want to look at the contents of result_table while the validation is in progress Geometry Subprograms 13 53 SDO_GEOM VALIDATE_LAYER_WITH_CONTEXT Usage Notes This procedure loads the result table with validation results An empty result table result_table parameter must be created before calling this procedure The format of the result table is sdo_rowid ROWID result VARCHAR2 2000 If result_table is not empty you should truncate the table before calling the procedure otherwise the procedure appends rows to the existing data in the table The result table contains one row for each invalid geometry A row is not written if a ge
314. er s Guide and Reference SDO_AGGR_UNION SDO_AGGR_UNION Format Description Parameters Usage Notes Examples SDO_AGGR_UNION AggregateGeometry SDOAGGRTYPE RETURN SDO_GEOMETRY Returns a geometry object that is the topological union OR operation of the specified geometry objects AggregateGeometry An object of type SDOAGGRTYPE see Section 1 10 1 that specifies the geometry column and dimensional array See also the information about the SDO_GEOM SDO_UNION function in Chapter 13 The following example returns the union of the first three geometry objects in the COLA_MARKETS table that is all except cola_d The example uses the definitions and data from Section 2 1 SELECT SDO_AGGR UNION SDOAGGRTYPE c shape 0 005 FROM cola_markets c WHERE c name lt cola_d SDO_AGGR UNION SDOAGGRTYPE C SHAPE 0 005 SDO_GTYPE SDO SRID SDO POINT SDO GEOMETRY 2007 NULL NULL SDO ELEM INFO ARRAY 1 1003 2 11 1003 1 SDO _ORDINATE ARRAY 8 11 6 9 8 7 10 9 8 11 1 7 1 1 5 1 8 1 8 6 5 1 7 1 7 Spatial Aggregate Functions 14 11 SDO_AGGR_UNION See also the more complex SDO_AGGR_UNION example in Section C 4 14 12 Oracle Spatial User s Guide and Reference 15 Coordinate System Transformation Subprograms The MDSYS SDO_CS package contains subprograms for working with coordinate systems You can perform explicit coordinate transformations on a single geometry
315. er has SELECT permission The USER_SDO_INDEX_INFO and ALL_SDO_INDEX_INFO views contain the same columns as shown Table 2 3 except that the USER_SDO_INDEX_INFO view does not contain the SDO_INDEX_OWNER column The columns are listed in their order in the view definition 2 28 Oracle Spatial Users Guide and Reference Spatial Index Related Structures Table 2 3 Columns in the xxx_SDO_INDEX_INFO Views Column Name Data Type Purpose SDO_INDEX_OWNER VARCHAR2 INDEX_NAME VARCHAR2 TABLE_NAME VARCHAR2 COLUMN_NAME VARCHAR2 SDO_INDEX_TYPE VARCHAR2 SDO_INDEX_TABLE VARCHAR2 SDO_INDEX_STATUS VARCHAR2 Owner of the index ALL_SDO_INDEX_INFO views only Name of the index Name of the table containing the column on which this index is built Name of the column on which this index is built Contains QTREE for a quadtree index or RTREE for an R tree index Name of the spatial index table described in Section 2 5 2 Contains DEFERRED if the index status has been set to deferred using the index_status keyword with the ALTER INDEX statement and VALID if the index status is not deferred 2 5 1 2 xxx_SDO_INDEX_METADATA Views The following views contain detailed information about spatial index metadata a USER_SDO_INDEX_METADATA contains index information for all spatial tables owned by the user USER_SDO_INDEX_METADATA is the same as SDO_INDEX_METADATA which was the only metadata view for Oracle Spat
316. ers Maximum number of clusters to obtain allow_outliers TRUE the default causes outlying values isolated instances to be included in the spatial clusters FALSE causes outlying values not to be included in the spatial clusters TRUE accommodates all data and may result in larger clusters FALSE may exclude some data and may result in smaller clusters tablepartition Name of the partition in tablename Spatial Analysis and Mining Subprograms 21 19 SDO_SAM SPATIAL_CLUSTERS Usage Notes The clusters are computed using the spatial R tree index on tablename Examples The following example clusters the locations in cities into at most three clusters and includes outlying values in the clusters SELECT FROM TABLE sdo_sam spatial clusters PROJ_CITIES LOCATION 3 TRUE 21 20 Oracle Spatial User s Guide and Reference SDO_SAM TILED_AGGREGATES SDO_SAM TILED_AGGREGATES Format Description Parameters SDO_SAM TILED_AGGREGATES theme_name IN VARCHAR2 theme_colname IN VARCHAR2 aggr_type_string IN VARCHAR2 aggr_col_string IN VARCHAR2 tiling_level IN NUMBER tiling_domain IN SDO_DIM_ARRAY DEFAULT NULL RETURN SDO_REGAGGRSET Tiles aggregates for a domain For each tile computes the intersecting geometries from the theme table the values in the aggr_col_string column are weighted proportionally to the area of the intersection and aggregated according to aggr_ col _ string theme_name
317. es SRID 8199 for example 1 1 5 1 5 7 1 7 1 1 and 1 00078604 1 00274579 5 00069354 1 00274488 5 0006986 7 00323528 1 00079179 7 00324162 1 00078604 1 00274579 for cola_a Example 6 5 Output of SELECT Statements in Coordinate System Transformation Example SQL gt Return the transformation of cola_c using to_srid 8199 SQL gt Longitude Latitude Arc 1950 SQL gt SELECT c name SDO CS TRANSFORM c shape m diminfo 8199 2 FROM cola markets_cs c user_sdo_geom metadata m 3 WHERE m table name COLA MARKETS CS AND m column_name SHAPE Coordinate Systems Spatial Reference Systems 6 25 Example of Coordinate System Transformation 4 AND c name cola c cola c SDO GEOMETRY 2003 8199 NULL SDO ELEM INFO ARRAY 1 1003 1 SDO ORDINATE ARR AY 3 00074114 3 00291482 6 00067068 3 00291287 6 0006723 5 00307625 4 0007 1961 5 00307838 3 00074114 3 00291482 SQL gt SQL gt Same as preceding but using to srname parameter SQL gt SELECT c name SDO_CS TRANSFORM c shape m diminfo Longitude Latitude Arc 1950 2 FROM cola markets_cs c user_sdo_geom metadata m 3 WHERE m table_name COLA MARKETS_CS AND m column name SHAPE 4 AND c name cola_c NAME cola c SDO GEOMETRY 2003 8199 NULL SDO ELEM INFO ARRAY 1 1003 1 SDO ORDINATE ARR AY 3 00074114 3 00291482 6 00067068 3 00291287 6 0006723 5 00307625 4 0007 1961 5 00307838 3 00074114 3 00291482 S
318. es measure populating is done in an incremental fashion along the segment direction This improves the performance of current and subsequent LRS Operations 7 6 Oracle Spatial User s Guide and Reference Terms and Concepts 7 1 7 Measure Range of a Geometric Segment The start and end measures of a geometric segment define the linear measure range of the geometric segment Any valid LRS measures of a geometric segment must fall within its linear measure range 7 1 8 Projection The projection of a point along a geometric segment is the point on the geometric segment with the minimum distance to the specified point The measure information of the resulting point is also returned in the point geometry 7 1 9 LRS Point LRS points are points with linear measure information along a geometric segment A valid LRS point is a point geometry with measure information All LRS point data must be stored in the SDO_ELEM_INFO_ARRAY and SDO_ ORDINATE_ARRAY and cannot be stored in the SDO_POINT field in the SDO_ GEOMETRY definition of the point 7 1 10 Linear Features Linear features are any spatial objects that can be treated as a logical set of linear segments Examples of linear features are highways in transportation applications and pipelines in utility industry applications The relationship of linear features geometric segments and LRS points is shown in Figure 7 6 where a single linear feature consists of three geometric segments and
319. es a tdt 5 1 5 1 1 Address Representation ascii ca ciocio n ro ciaciicn sirenas siria ie caia E 5 1 5 1 2 Match Mode RRA herons Sill eed La 5 3 5 1 3 Match Codes ci ala 5 4 5 1 4 Error Messages for Output Geocoded Addresses ococicicnnocininnonnoninnncorornonininnarorioninas 5 5 5 2 Data Types for GEOCOdIOS isis lcd ata isis 5 6 5 2 1 SDO GEO ADDR Typiste Verena alinean Ee ciao dies ADE sete oa a 5 6 5 2 2 SDO_ADDR_ARRAY Type oocrncocncononincnnaccononanononcnronanan canon onononcaronanan on coronar coran onaroncnconoros 5 9 5 2 3 SDO_KEYWORDARRAY Type coccconcncncanincnnanononincononancnarnonononcasosar an cra on ononcacasanarcn co canonos 5 9 5 3 Using the Geocoding Capabiliti8S oononnninnnnnnnnncnnnnnncnnnanconononocnnonorororonnnnconororonciccnro a 5 9 Coordinate Systems Spatial Reference Systems 6 1 Terms and CONE imita aia AA aii 6 1 6 1 1 Coordinate System Spatial Reference System coccoconcncoconenenonnnnnonnnnrnrnonenncannnananaroros 6 2 6 1 2 Cartesian Coordinates union lips 6 2 6 1 3 Geodetic Coordinates Geographic Coordinates ococcocininoncononenennnnnnnnnannrornneninnnanonna 6 2 6 1 4 Projected Coordinates mitin le Aaa da 6 2 6 1 5 Toca COMME aid 6 2 6 1 6 Geodetic Ditto a a aa eaaa 6 2 6 1 7 Authalic Sphere conciso eaa cede a Ad ie 6 2 6 1 8 Transformations ts 6 3 6 2 Geodetic Coordinate Support vico tin ie a e EE EE EETA R 6 3 6 2 1 Geodesy and Two Dimensional Geometry s sssesssssssesseesiestsstssee
320. es not already exist create it and insert data into the table 3 Update the USER_SDO_GEOM_METADATA view 4 Create the spatial index For a function based spatial index the number of parameters must not exceed 32 5 Perform queries on the data The rest of this section describes two examples of using function based indexes In both examples a function is created that returns an SDO_GEOMETRY object and a spatial index is created on that function In the first example the input parameters to the function are a standard Oracle data type NUMBER In the second example the input to the function is a user defined object type 9 2 1 Example Function with Standard Types In the following example the input parameters to the function used for the function based index are standard numeric values longitude and latitude Assume that you want to create a function that returns the longitude and latitude of a point and to use that function in a spatial index First create the function as in the following example that creates a function named GET_LONG_LAT_PT Create a function to return a point geometry SDO_GTYPE 2001 with input of 2 numbers longitude and latitude SDO SRID 8307 for Longitude Latitude WGS 84 probably the most widely used coordinate system and the one used for GPS devices Specify DETERMINISTIC for the function 9 4 Oracle Spatial User s Guide and Reference SDO_GEOMETRY Objects in Func
321. escribed in Section 6 4 1 and this value must be inserted into the SRID column of the USER_ SDO_GEOM_METADATA view described in Section 2 4 All geometries in a geometry column must have the same SDO_SRID value For information about coordinate systems see Chapter 6 2 2 3 SDO_POINT The SDO_POINT attribute is defined using the SDO_POINT_TYPE object type which has the attributes X Y and Z all of type NUMBER The SDO_POINT_TYPE definition is shown in Section 2 2 If the SDO_ELEM_INFO and SDO_ORDINATES arrays are both null and the SDO_POINT attribute is non null then the X and Y values are considered to be the coordinates for a point geometry Otherwise the SDO_POINT attribute is ignored by Spatial You should store point geometries in the SDO_POINT attribute for optimal storage and if you have only point geometries in a layer it is strongly recommended that you store the point geometries in the SDO_POINT attribute Section 2 3 5 illustrates a point geometry and provides examples of inserting and querying point geometries Note Do not use the SDO_POINT attribute in defining a linear referencing system LRS point For information about LRS see Chapter 7 2 2 4 SDO_ELEM_INFO The SDO_ELEM_INFO attribute is defined using a varying length array of numbers This attribute lets you know how to interpret the ordinates stored in the SDO_ORDINATES attribute described in Section 2 2 5 Each triplet set of numbers is
322. example uses the definitions and data from Section 2 1 This specific example however does not produce useful output the returned polygon has the same vertices as the input polygon because the input polygon is already a simple convex polygon Return the convex hull of a polygon SELECT c name SDO GEOM SDO CONVEXHULL c shape m diminfo FROM cola_markets c user_sdo geom metadata m WHERE m table_name COLA MARKETS AND m column_name SHAPE AND c name cola_c cola c SDO GEOMETRY 2003 NULL NULL SDO ELEM INFO ARRAY 1 1003 1 SDO ORDINATE ARR AY 6 3 6 5 4 5 3 3 6 3 None 13 20 Oracle Spatial User s Guide and Reference SDO_GEOM SDO_DIFFERENCE SDO_GEOM SDO_DIFFERENCE Format Description Parameters SDO_GEOM SDO_DIFFERENCE geom1 IN SDO_GEOMETRY dim1 IN SDO_DIM_ARRAY geom2 IN SDO_GEOMETRY dim2 IN SDO_DIM_ARRAY RETURN SDO_GEOMETRY SDO_GEOM SDO_DIFFERENCE geom1 IN SDO_GEOMETRY geom2 IN SDO_GEOMETRY tol IN NUMBER RETURN SDO_GEOMETRY geom1 Geometry object dim1 Dimensional information array corresponding to geom1 usually selected from one of the xxx_SDO_GEOM_METADATA views described in Section 2 4 geom2 Geometry object Returns a geometry object that is the topological difference MINUS operation of two geometry objects Geometry Subprograms 13 21 SDO_GEOM SDO_DIFFERENCE Usage Notes Examples dim2 Dimensional information array correspo
323. exes only SDO_FIXED_META RAW If applicable this column contains the metadata portion of the SDO_GROUPCODE or SDO_ CODE for a fixed level index SDO_TABLESPACE VARCHAR2 Same as in the SQL CREATE TABLE statement Tablespace in which to create the SDOINDEX table SDO_INITIAL_EXTENT VARCHAR2 Same as in the SQL CREATE TABLE statement SDO_NEXT_EXTENT VARCHAR2 Same as in the SQL CREATE TABLE statement SDO_PCTINCREASE NUMBER Same as in the SQL CREATE TABLE statement SDO_MIN_EXTENTS NUMBER Same as in the SQL CREATE TABLE statement SDO_MAX_EXTENTS NUMBER Same as in the SQL CREATE TABLE statement SDO_RTREE_ QUALITY NUMBER Quality score for an index See the information about R tree quality in Section 1 7 2 SDO_INDEX_VERSION NUMBER Internal version number of the index SDO_INDEX_GEODETIC VARCHAR2 Contains TRUE if the index is geodetic see Section 4 1 2 and FALSE if the index is not geodetic Spatial Data Types and Metadata 2 31 Unit of Measurement Support Table 2 4 Cont Columns in the xxx_SDO_INDEX_METADATA Views Column Name Data Type Purpose SDO_INDEX_STATUS VARCHAR2 Contains DEFERRED if the index status has been set to deferred using the index_status keyword with the ALTER INDEX statement and VALID if the index status is not deferred 2 5 2 Spatial Index Table Definition For an R tree index a spatial index table each SDO_INDEX_TABLE entry as described in Table 2 4 in Section 2 5 1 contains the columns s
324. f 50 is a valid measure on the Route 1 segment The function returns FALSE because the measure range for that segment is 0 to 27 For example if the route is 27 miles long with mile markers at 1 mile intervals there is no 50 mile marker because the last marker is the 27 mile marker This example uses the definitions from the example in Section 7 7 SELECT SDO LRS VALID MEASURE route_geometry 50 FROM lrs_ routes WHERE route_id 1 SDO_LRS VALID MEASURE ROUTE GEOMETRY 50 Linear Referencing Subprograms 16 109 SDO_LRS VALIDATE_LRS_GEOMETRY SDO_LRS VALIDATE_LRS_GEOMETRY Format Description Parameters Usage Notes Examples SDO_LRS VALIDATE_LRS_GEOMETRY geom_segment IN SDO_GEOMETRY dim_array IN SDO_DIM_ARRAY RETURN VARCHAR2 Checks if an LRS geometry is valid geom_segment Geometric segment to be checked dim_array Dimensional information array corresponding to geom_segment usually selected from one of the xxx_SDO_GEOM_METADATA views described in Section 2 4 This function returns TRUE if geom_segment is valid and one of the following errors if geom_segment is not valid a ORA 13331 invalid LRS segment a ORA 13335 measure information not defined The _3D format of this function SDO_LRS VALIDATE_LRS_GEOMETRY_3D is available For information about _3D formats of LRS functions see Section 7 4 The following example checks if the Route 1 segment is a valid LRS geometry This example uses
325. fies the boundary of each cluster and the geometry _ key value is set to null You can use the SDO_SAM BIN_GEOMETRY function with the returned spatial clusters in the bin table to identify the cluster to which a geometry belongs 8 6 Location Prospecting Location prospecting can be performed by using thematic layers to compute aggregates for a layer and choosing the locations that have the maximum values for computed aggregates 8 6 Oracle Spatial User s Guide and Reference 9 Extending Spatial Indexing Capabilities This chapter shows how to create and use spatial indexes on objects other than a geometry column In other chapters the focus is on indexing and querying spatial data that is stored in a single column of type SDO_GEOMETRY This chapter shows how to a Embed anSDO_GEOMETRY object in a user defined object type and index the geometry attribute of that type see Section 9 1 a Create and use a function based index where the function returns an SDO_ GEOMETRY object see Section 9 2 The techniques in this chapter are intended for experienced and knowledgeable application developers You should be familiar with the Spatial concepts and techniques described in other chapters You should also be familiar with or able to learn about relevant Oracle database features such as user defined data types and function based indexing 9 1 SDO_GEOMETRY Objects in User Defined Type Definitions The SDO_GEOMETRY type can b
326. form SDO_FILTER arg1 arg2 TRUE Spatial Operators 12 13 SDO_FILTER Examples geometry2 can come from a table or be a transient SDO_GEOMETRY object such as a bind variable or SDO_GEOMETRY constructor Ifthegeometry2 column is not spatially indexed the operator indexes the query window in memory and performance is very good Ifthe geometry2 column is spatially indexed with the same SDO_LEVEL value as the geometry1 column the operator reuses the existing index and performance is very good or better Ifthe geometry2 column is spatially indexed with a different SDO_LEVEL value than the geomet ry1 column the operator reindexes geometry2 in the same way as if there were no index on the column originally and then performance is very good a If two or more geometries from geomet ry2 are passed to the operator the ORDERED optimizer hint must be specified and the table in geometry2 must be specified first in the FROM clause If geometryl1 and geomet ry2 are based on different coordinate systems geomet ry2 is temporarily transformed to the coordinate system of geomet ry1 for the operation to be performed as described in Section 6 7 1 In previous releases the SDO_FILTER operator required a third parameter Effective with Oracle Spatial release 10 1 the operator has only two parameters For backward compatibility any keywords for the third parameter that were supported in the previous release will still work however
327. from the road should return 1 SELECT SDO_LRS FIND _OFFSET route geometry SDO GEOMETRY 3301 NULL NULL SDO ELEM INFO ARRAY 1 1 1 SDO ORDINATE ARRAY 9 3 NULL FROM lrs_ routes WHERE route _id 1 SDO_LRS FIND_OFFSET ROUTE GEOMETRY SDO GEOMETRY 3301 NULL NULL SDO ELEM INFO ARR Linear Referencing Subprograms 16 37 SDO_LRS GEOM_SEGMENT_END_MEASURE SDO_LRS GEOM_SEGMENT_END_MEASURE Format Description Parameters Usage Notes Examples SDO_LRS GEOM_SEGMENT_END_MEASURE geom_segment IN SDO_GEOMETRY dim_array IN SDO_DIM_ARRAY RETURN NUMBER Returns the end measure of a geometric segment geom_segment Geometric segment whose end measure is to be returned dim_array Dimensional information array corresponding to geom_segment usually selected from one of the xxx_SDO_GEOM_METADATA views described in Section 2 4 This function returns the end measure of geom_segment An exception is raised if geom_segment has an invalid geometry type or dimensionality The _3D format of this function SDO_LRS GEOM_SEGMENT_END_MEASURE_ 3D is available For information about _3D formats of LRS functions see Section 7 4 The following example returns the end measure of the geometric segment representing Route 1 This example uses the definitions from the example in Section 7 7 SELECT SDO LRS GEOM SEGMENT END MEASURE route geometry FROM lrs_ routes WHERE route_id 1 16 38 Oracle Spatial User s Guid
328. from the tables against the element definitions theGeometry Geometry object theDimInfo Dimensional information array corresponding to theGeomet ry usually selected from one of the xxx_SDO_GEOM_METADATA views described in Section 2 4 tolerance Tolerance value see Section 1 5 5 If the geometry is valid this function returns TRUE If the geometry is not valid this function returns the following Geometry Subprograms 13 47 SDO_GEOM VALIDATE_GEOMETRY_WITH_CONTEXT a An Oracle error message number based on the specific reason the geometry is invalid or FALSE if the geometry fails for some other reason a The context of the error the coordinate edge or ring that causes the geometry to be invalid This function checks for type consistency and geometry consistency For type consistency the function checks for the following a The SDO_GTYPE is valid a The SDO_ETYPE values are consistent with the SDO_GTYPE value For example if the SDO_GTYPE is 2003 there should be at least one element of type POLYGON in the geometry a The SDO_ELEM_INFO_ARRAY has valid triplet values For geometry consistency the function checks for the following as appropriate for the specific geometry type a Polygons have at least four points which includes the point that closes the polygon The last point is the same as the first a Polygons are not self crossing a No two vertices on a line or polygon are the same Polygons a
329. g the query and only the first two dimensions in the returned geometry are to be considered valid and meaningful Spatial Utility Subprograms 19 31 SDO_UTIL SIMPLIFY Examples For example the measure values in a returned LRS geometry will probably not reflect actual measures in that geometry In this case depending on your application needs you might have several options after the simplification operation such as ignoring the new measure values or redefining the new LRS geometry to reset the measure values This function uses the Douglas Peucker algorithm which is explained in several cartography textbooks and reference documents In some explanations the term tolerance is used instead of threshold however this is different from the Oracle Spatial meaning of tolerance The returned geometry can be a polygon line or point depending on the geometry definition and the threshold value The following considerations apply A polygon can simplify to a line or a point and a line can simplify to a point if the threshold value associated with the geometry is sufficiently large For example a thin rectangle will simplify to a line if the distance between the two parallel long sides is less then the threshold value and a line will simplify to a point if the distance between the start and end points is less than the threshold value a Ina polygon with a hole if the exterior ring or the interior ring the hole simplifies to a li
330. g 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 xxi xxii Preface The 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 B for 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 Orac
331. geodetic parameter for the CREATE INDEX statement in Chapter 10 4 1 3 Improving Performance with Bulk Insert Operations If a Spatial index already exists and you need to insert many rows into the spatial geometry table you can improve the performance of the insert operations by Indexing and Querying Spatial Data 4 3 Creating a Spatial Index deferring spatial indexing inserting the rows and synchronizing the index Follow these steps 1 Modify the spatial index to set the index status to deferred For example ALTER INDEX cola_spatial_idx PARAMETERS index status deferred 2 Insert the new rows using the appropriate INSERT statements 3 Synchronize the index specifying the sdo_batch_size keyword with a fairly large value For example ALTER INDEX cola_spatial_idx PARAMETERS index status synchronize sdo_batch_size 500 The best value for the sdo_batch_size keyword is probably from 100 to 1000 See the section about the ALTER INDEX statement in Chapter 10 for more information about the index_status and sdo_batch_size keywords 4 1 4 Constraining Data to a Geometry Type When you create or rebuild a spatial index you can ensure that all geometries that are in the table or that are inserted later are of a specified geometry type To constrain the data to a geometry type in this way use the layer_gtype keyword in the PARAMETERS clause of the CREATE INDEX or ALTER INDEX REBUILD statement and specify a value fr
332. geometry based on a threshold value using the Douglas Peucker algorithm 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 SDO_UTIL APPEND SDO_UTIL APPEND Format Description Parameters Usage Notes SDO_UTIL APPEND geom1 IN SDO_GEOMETRY geom2 IN SDO_GEOMETRY RETURN SDO_GEOMETRY Appends one geometry to another geometry to create a new geometry geom1 Geometry object to which geom2 is to be appended geom2 Geometry object to append to geom1 This function should be used only on geometries that do not have any spatial interaction that is on disjoint objects If the input geometries are not disjoint the resulting geometry might be invalid This function does not perform a union operation or any other computational geometry operation To perform a union operation use the SDO_GEOM SDO_ UNION function which is described in Chapter 13 The APPEND function executes faster than the SDO_GEOM SDO_UNION function The geometry type SDO_GTYPE value of the resulting geometry reflects the types of the input geometries and the append operation For example if the input geometries are two dimensional polygons SDO_GTYPE 2003 the resulting geometry is a two dimensional multipolygon SDO_GTYPE 2007 An exception is raised if geom1 and geom2 are based on different coordinate systems Spatia
333. ght of the R tree SDO_RTREE_NUM_ NUMBER Number of nodes in the R tree NODES SDO_RTREE_ NUMBER Number of dimensions indexed DIMENSIONALITY SDO_RTREE_FANOUT NUMBER Maximum number of children in each R tree node SDO_RTREE_ROOT VARCHAR2 Rowid corresponding to the root node of the R tree in the index table SDO_RTREE_SEQ_ NAME VARCHAR2 Sequence name associated with the R tree SDO_RTREE_PCTFREE NUMBER Minimum percentage of slots in each index tree 2 30 Oracle Spatial Users Guide and Reference node to be left empty when an R tree index is created Spatial Index Related Structures Table 2 4 Cont Columns in the xxx_SDO_INDEX_METADATA Views Column Name Data Type Purpose SDO_LAYER_GTYPE VARCHAR2 Contains DEFAULT if the layer can contain both point and polygon data or a value from the Geometry Type column of Table 2 1 in Section 2 2 1 SDO_LEVEL NUMBER The fixed tiling level at which to tile all objects in the geometry column for a quadtree index SDO_NUMTILES NUMBER Suggested number of tiles per object that should be used to approximate the shape for a quadtree index SDO_MAXLEVEL NUMBER Maximum level for any tile for any object for a quadtree index It will always be greater than the SDO_LEVEL value SDO_COMMIT_INTERVAL NUMBER Number of geometries rows to process during index creation before committing the insertion of spatial index entries into the SDOINDEX table Applies to quadtree ind
334. grams 16 105 SDO_LRS VALID_LRS_PT SDO_LRS VALID_LRS_PT Format Description Parameters Usage Notes Examples SDO_LRS VALID_LRS_PT point IN SDO_GEOMETRY dim_array IN SDO_DIM_ARRAY RETURN VARCHAR2 Checks if an LRS point is valid point Point to be checked for validity dim_array Dimensional information array corresponding to point usually selected from one of the xxx_SDO_GEOM_METADATA views described in Section 2 4 This function returns TRUE if point is valid and FALSE if point is not valid This function checks if point is a point with measure information and it checks for the geometry type and number of dimensions for the point geometry All LRS point data must be stored in the SDO_ELEM_INFO_ARRAY and SDO_ ORDINATE_ARRAY and cannot be stored in the SDO_POINT field in the SDO_ GEOMETRY definition of the point The _3D format of this function GDO_LRS VALID_LRS_PT_3D is available For information about _3D formats of LRS functions see Section 7 4 The following example checks if point 9 3 NULL is a valid LRS point This example uses the definitions from the example in Section 7 7 SELECT SDO LRS VALID LRS PT 16 106 Oracle Spatial User s Guide and Reference SDO_LRS VALID_LRS_PT SDO_GEOMETRY 3301 NULL NULL SDO_ELEM_INFO ARRAY 1 1 1 SDO ORDINATE_ARRAY 9 3 NULL m diminfo FROM Irs WHERE m AND a route_id 1 routes a user sdo geom metadata m table n
335. gth array 1048576 of NUMBER type that stores the coordinate values that make up the boundary of a spatial object This array must always be used in conjunction with the SDO_ELEM_ INFO varying length array The values in the array are ordered by dimension For Spatial Data Types and Metadata 2 13 Geometry Examples example a polygon whose boundary has four two dimensional points is stored as X1 Y1 X2 Y2 X3 Y3 X4 Y4 X1 Y1 If the points are three dimensional then they are stored as X1 Y1 Z1 X2 Y2 Z2 X3 Y3 Z3 X4 Y4 Z4 X1 Y1 Z1 Spatial index creation operators and functions ignore the Z values because this release of the product supports only two dimensional spatial objects The number of dimensions associated with each point is stored as metadata in the xxx_SDO_ GEOM_METADATA views described in Section 2 4 The values in the SDO_ORDINATES array must all be valid and non null There are no special values used to delimit elements in a multielement geometry The start and end points for the sequence describing a specific element are determined by the STARTING_OFFSET values for that element and the next element in the SDO_ ELEM_INFO array as explained previously The offset values start at 1 SDO_ ORDINATES 1 is the first ordinate of the first point of the first element 2 2 6 Usage Considerations You should use the SDO_GTYPE values as shown in Table 2 1 however Spatial does not check or enforce all geometry c
336. h is a circle The example uses the definitions and data from Section 2 1 Arc densification of the circle cola d SELECT c name SDO GEOM SDO_ ARC DENSIFY c shape m diminfo arc_tolerance 0 05 FROM cola_markets c user_sdo geom metadata m WHERE m table_name COLA MARKETS AND m column_name SHAPE AND c name cola_d NAME SDO_GEOM SDO ARC DENSIFY C SHAPE M DIMINFO ARC_TOLERANCE 0 05 SDO_GTYPE SDO_ cola d SDO GEOMETRY 2003 NULL NULL SDO ELEM INFO ARRAY 1 1003 1 SDO ORDINATE ARR AY 8 7 8 76536686 7 15224093 9 41421356 7 58578644 9 84775907 8 23463314 10 9 9 84775907 9 76536686 9 41421356 10 4142136 8 76536686 10 8477591 8 11 7 23463314 10 8477591 6 58578644 10 4142136 6 15224093 9 76536686 6 9 6 15224093 8 23463314 6 58578644 7 58578644 7 23463314 7 15224093 8 7 Related Topics Section 6 2 4 Other Considerations and Requirements with Geodetic Data 13 10 Oracle Spatial User s Guide and Reference SDO_GEOM SDO_AREA SDO_GEOM SDO_AREA Format Description Parameters SDO_GEOM SDO_AREA geom IN SDO_GEOMETRY dim IN SDO_DIM_ARRAY unit IN VARCHAR2 RETURN NUMBER or SDO_GEOM SDO_AREA geom IN SDO_GEOMETRY tol IN NUMBER unit IN VARCHAR2 RETURN NUMBER Returns the area of a two dimensional polygon geom Geometry object dim Dimensional information array corresponding to geom usually selected from one of the xxx_SDO_GEOM_METADATA
337. h returns the percentage value that corresponds to a measure An exception is raised if geom_segment has an invalid geometry type or dimensionality or if percentage is less than 0 or greater than 100 Examples The following example returns the measure that is 50 percent of the measure range of the geometric segment representing Route 1 This example uses the definitions from the example in Section 7 7 The measure range of this segment is 27 and 50 percent of 27 is 13 5 SELECT SDO_LRS PERCENTAGE TO MEASURE a route geometry m diminfo 50 FROM lrs routes a user_sdo_geom_metadata m HERE m table name LRS ROUTES AND m column_name ROUTE GEOMETRY AND a route_id 1 SDO_LRS PERCENTAGE TO MEASURE A ROUTE GEOMETRY M DIMINFO 50 16 80 Oracle Spatial User s Guide and Reference SDO_LRS PROJECT_PT SDO_LRS PROJECT_PT Format Description SDO_LRS PROJECT_PT geom_segment IN SDO_GEOMETRY point IN SDO_GEOMETRY tolerance IN NUMBER offset OUT NUMBER RETURN SDO_GEOMETRY or SDO_LRS PROJECT_PT geom_segment IN SDO_GEOMETRY dim_array IN SDO_DIM_ARRAY point IN SDO_GEOMETRY point_dim_array IN SDO_DIM_ARRAY RETURN SDO_GEOMETRY or SDO_LRS PROJECT_PT geom_segment IN SDO_GEOMETRY dim_array IN SDO_DIM_ARRAY point IN SDO_GEOMETRY point_dim_array IN SDO_DIM_ARRAY offset OUT NUMBER RETURN SDO_GEOMETRY Returns the projection point of a specified point The projection point is on th
338. he geometry fails for some other reason If the function format with tolerance is used the following guidelines apply All geometry objects must be defined using 4 digit SDO_GTYPE values explained in Section 2 2 1 a No checking is done to validate that the geometry is within the coordinate system bounds as stored in the DIMINFO field of the USER_SDO_GEOM_ METADATA view If this check is required for your usage use the function format with theDimInfo Examples The following example validates the geometry of cola_c The example uses the definitions and data from Section 2 1 Is a geometry valid SELECT c name SDO GEOM VALIDATE GEOMETRY c shape 0 005 FROM cola_markets c WHERE c name cola c NAME SDO_GEOM VALIDATE GEOMETRY C SHAPE 0 005 cola_c TRUE Related Topics a SDO_GEOM VALIDATE_GEOMETRY_WITH_CONTEXT a SDO_GEOM VALIDATE_LAYER 13 46 Oracle Spatial Users Guide and Reference SDO_GEOM VALIDATE_GEOMETRY_WITH_CONTEXT SDO_GEOM VALIDATE_GEOMETRY_WITH_CONTEXT Format Description Parameters Usage Notes SDO_GEOM VALIDATE_GEOMETRY_WITH_CONTEXT theGeometry IN SDO_GEOMETRY theDiminfo IN SDO_DIM_ARRAY RETURN VARCHAR2 or SDO_GEOM VALIDATE_GEOMETRY_WITH_CONTEXT theGeometry INSDO_GEOMETRY tolerance IN NUMBER RETURN VARCHAR2 Performs a consistency check for valid geometry types and returns context information if the geometry is invalid The function checks the representation of the geometry
339. hidden associations between proximity to a highway and either the price of a house or the sales volume of a store Property assessment In assessing the value of a house examine the values of similar houses in a neighborhood and derive an estimate based on variations and spatial correlation 8 2 Spatial Binning for Detection of Regional Patterns Spatial binning spatial discretization discretizes the location values into a small number of groups associated with geographical areas The assignment of a location to a group can be done by any of the following methods Reverse geocoding the longitude latitude coordinates to obtain an address that specifies for United States locations the ZIP code city state and country Checking a spatial bin table to determine which bin this specific location belongs in You can then apply ODM mining techniques to the discretized locations to identify interesting regional patterns or association rules For example you might discover that customers in area A prefer regular soda while customers in area B prefer diet soda 8 4 Oracle Spatial User s Guide and Reference Colocation Mining The following functions and procedures documented in Chapter 21 perform operations related to spatial binning a SDO_SAM BIN_ GEOMETRY a SDO_SAM BIN_LAYER 8 3 Materializing Spatial Correlation Spatial correlation or neighborhood influence refers to the phenomenon of the location of a specific object in
340. his section describes several linear referencing operations supported by the Oracle Spatial LRS API 7 5 1 Defining a Geometric Segment There are two ways to create a geometric segment with measure information a Construct a geometric segment and assign measures explicitly Define a geometric segment with specified start and end and or any other measures in an ascending or descending order Measures of shape points with unknown unassigned measures null values in the geometric segment will be automatically populated according to their locations and distance distribution Figure 7 8 shows different ways of defining a geometric segment Figure 7 8 Defining a Geometric Segment 5 10 NULL 35 10 NULL 55 10 NULL Start Point End Point 20 5 NULL a Geometric Segment with No Measures Assigned Start Measure End Measure 5 10 0 35 10 NULL 55 10 100 Start Point End Point 20 5 NULL b Geometric Segment with Start and End Measures 5 10 Q 35 10 61 257 55 10 100 Start Point End Point 20 5 30 628 c Populating Measures of Shape Points in a Geometric Segment An LRS segment must be defined or must already exist before any LRS operations can proceed That is the start end and any other assigned measures must be Linear Referencing System 7 11 LRS Operations present to derive the location from a specified measure The measure information of intermediate shape points will automati
341. hown in Table 2 5 Table 2 5 Columns in an R Tree Spatial Index Data Table Column Name Data Type Purpose NODE_ID NUMBER Unique ID number for this node of the tree NODE_LEVEL NUMBER Level of the node in the tree Leaf nodes nodes whose entries point to data items in the base table are at level 1 their parent nodes are at level 2 and so on INFO BLOB Other information in a node Includes an array of lt child_ mbr child_rowid gt pairs maximum of fanout value or number of children for such pairs in each R tree node where child_rowid is the rowid of a child node or the rowid of a data item from the base table 2 5 3 R Tree Index Sequence Object Each R tree spatial index table has an associated sequence object SDO_RTREE_ SEQ_NAME in the USER_SDO_INDEX_METADATA view described in Table 2 4 in Section 2 5 1 2 The sequence is used to ensure that simultaneous updates can be performed to the index by multiple concurrent users The sequence name is the index table name with the letter S replacing the letter T before the underscore for example the sequence object MDRS_5C01 is associated with the index table MDRT_5C01 2 6 Unit of Measurement Support Geometry functions that involve measurement allow an optional unit parameter to specify the unit of measurement for a specified distance or area if a georeferenced coordinate system SDO_SRID value is associated with the input geometry or 2 32 Oracle Spatial Users Guide a
342. ia will not be included Tolerance values for Spatial functions are typically very small although the best value in each case depends on the kinds of applications that use or will use the data 1 6 Query Model Spatial uses a two tier query model to resolve spatial queries and spatial joins The term is used to indicate that two distinct operations are performed to resolve queries The output of the two combined operations yields the exact result set The two operations are referred to as primary and secondary filter operations a The primary filter permits fast selection of candidate records to pass along to the secondary filter The primary filter compares geometry approximations to reduce computation complexity and is considered a lower cost filter Because 1 10 Oracle Spatial Users Guide and Reference Query Model the primary filter compares geometric approximations it returns a superset of the exact result set The secondary filter applies exact computations to geometries that result from the primary filter The secondary filter yields an accurate answer to a spatial query The secondary filter operation is computationally expensive but it is only applied to the primary filter results not the entire data set Figure 1 2 illustrates the relationship between the primary and secondary filters Figure 1 2 Query Model Primary econdar Filter Filter Sr aa andidate esu Large Input Data Set Set Set As shown in Figure
343. ial release 8 1 5 a ALL_SDO_INDEX_METADATA contains index information for all spatial tables on which the user has SELECT permission Note These views were new for release 8 1 6 If you are upgrading from an earlier release of Spatial see Appendix A The USER_SDO_INDEX_METADATA and ALL_SDO_INDEX_METADATA views contain the same columns as shown Table 2 4 The columns are listed in their order in the view definition Spatial Data Types and Metadata 2 29 Spatial Index Related Structures Table 2 4 Columns in the xxx_SDO_INDEX_METADATA Views Column Name Data Type Purpose SDO_INDEX_OWNER VARCHAR2 Owner of the index SDO_INDEX_TYPE VARCHAR2 Contains QTREE for a quadtree index or RTREE for an R tree index SDO_INDEX_NAME VARCHAR2 Name of the index SDO_INDEX_TABLE VARCHAR2 Name of the spatial index table described in Section 2 5 2 SDO_INDEX_PRIMARY NUMBER Indicates if this is a primary or secondary index 1 primary 2 secondary SDO_INDEX_PARTITION VARCHAR For a partitioned index name of the index partition SDO_PARTITIONED NUMBER Contains 0 if the index is not partitioned or 1 if the index is partitioned SDO_TSNAME VARCHAR2 Schema name of the SDO_INDEX_TABLE SDO_COLUMN_NAME VARCHAR2 Name of the column on which this index is built SDO_INDEX_DIMS NUMBER Number of dimensions of the geometry objects in the column on which this index is built SDO_RTREE_ HEIGHT NUMBER Hei
344. included in the call to SDO_NN specifies the same number used in the call to SDO_NN_ DISTANCE Data type is NUMBER Table 12 4 lists the keywords for the param parameter Spatial Operators 12 23 SDO_NN Returns Usage Notes Table 12 4 Keywords for the SDO_NN Param Parameter Keyword Description sdo_batch_ Specifies the number of rows to be evaluated at a time when the SDO_NN size expression may need to be evaluated multiple times in order to return the sdo_num_res desired number of results that satisfy the WHERE clause Available only when an R tree index is used If you specify sdo_batch_size 0 orif you omit the param parameter completely Spatial calculates a batch size suited to the result set size See the Usage Notes and Examples for more information Data type is NUMBER For example sdo_batch_size 10 If sdo_batch_size is not specified specifies the number of results nearest neighbors to be returned If sdo_batch_size is specified this keyword is ignored instead use the ROWNUM pseudocolumn to limit the number of results See the Usage Notes and Examples for more information Data type is NUMBER Default 1 For example sdo_num_res 5 If the SDO_NN_DISTANCE ancillary operator is included in the call to SDO_NN specifies the unit of measurement a quoted string with unit and an SDO_UNIT value from the MDSYS SDO_DIST_UNITS table See Section 2 6 for more information about unit of measurement
345. ine or multiline two dimensional geometries to create a new geometry Converts values from one angle area or distance unit of measure to another Returns the polygon geometry that approximates and is covered by a specified ellipse Returns the geometry that represents a specified element and optionally a ring of the input geometry Returns the number of elements in the input geometry Returns the number of vertices in the input geometry Returns the coordinates of the vertices of the input geometry Initializes all spatial indexes in a tablespace that was transported to another database Returns a point geometry that is at the specified distance and bearing from the start point Spatial Utility Subprograms 19 1 Table 19 1 Cont Spatial Utility Subprograms Subprogram Description SDO_UTIL POLYGONTOLINE SDO_UTIL PREPARE FOR_TTS SDO_UTIL REMOVE_ DUPLICATE_VERTICES SDO_UTIL REVERSE_ LINESTRING SDO_UTIL SIMPLIFY SDO_UTIL TO_GMLGEOMETRY 19 2 Oracle Spatial Users Guide and Reference Converts all polygon type elements in a geometry to line type elements and sets the SDO_GTYPE value accordingly Prepares a tablespace to be transported to another database so that spatial indexes will be preserved during the transport operation Removes duplicate redundant vertices from a geometry Returns a line string geometry with the vertices of the input geometry in reverse order Simplifies the input
346. int IN SDO_GEOMETRY dim_array IN SDO_DIM_ARRAY RETURN NUMBER Returns the measure of an LRS point point Point whose measure is to be returned dim_array Dimensional information array corresponding to point usually selected from one of the xxx_SDO_GEOM_METADATA views described in Section 2 4 This function returns the measure of an LRS point If point is not valid an invalid LRS point exception is raised Contrast this function with SDO_LRS PROJECT_PT which accepts as input a point that is not necessarily on the geometric segment but which returns a point that is on the geometric segment as opposed to a measure value As the following example shows the SDO_LRS GET_MEASURE function can be used to return the measure of the projected point returned by SDO_LRS PROJECT_PT The _3D format of this function SDO_LRS GET_MEASURE_3D is available For information about _3D formats of LRS functions see Section 7 4 The following example returns the measure of a projected point In this case the point resulting from the projection is 9 units from the start of the segment 16 48 Oracle Spatial Users Guide and Reference SDO_LRS GET_MEASURE SELECT SDO_LRS GET MEASURE SDO_LRS PROJECT_PT a route geometry m diminfo SDO GEOMETRY 3001 NULL NULL SDO_ELEM_INFO ARRAY 1 1 1 SDO ORDINATE ARRAY 9 3 NULL m diminfo FROM lrs_ routes a user _sdo geom_ metadata m WHERE m table name LRS ROUTES AND m column_
347. is a feature of Oracle Database 10 Standard Edition Locator provides core features and services available in Oracle Spatial It provides significant capabilities typically required to support Internet and wireless service based applications and partner based GIS solutions Locator is not designed to be a solution for geographic information system GIS applications requiring complex spatial data management If you need capabilities such as linear referencing spatial functions or coordinate system transformations use Oracle Spatial instead of Locator Like Spatial Locator is not designed to be an end user application but is a set of spatial capabilities for application developers Locator is available with both the Standard and Enterprise Editions of Oracle Database 10g Spatial is a priced option available only with Oracle Database 10 Enterprise Edition Spatial includes all Locator features as well as other features that are not available with Locator In general Locator includes the data types operators and indexing capabilities of Oracle Spatial along with a limited set of the functions and procedures of Spatial The Locator features include the following a An object type SDO_GEOMETRY that describes and supports any type of geometry A spatial indexing capability that lets you create spatial indexes on geometry data Spatial operators described in Chapter 12 that use the spatial index for performing spatial queries
348. is guide also includes many examples in SQL and PL SQL One or more examples are usually provided with the reference information for each function or procedure and several simplified examples are provided that illustrate table and index creation as well as several functions and procedures Inserting indexing and querying spatial data Section 2 1 a Coordinate systems spatial reference systems Section 6 8 a Linear referencing system LRS Section 7 7 1 24 Oracle Spatial Users Guide and Reference 2 Spatial Data Types and Metadata Oracle Spatial consists of a set of object data types type methods and operators functions and procedures that use these types A geometry is stored as an object in a single row in a column of type SDO_GEOMETRY Spatial index creation and maintenance is done using basic DDL CREATE ALTER DROP and DML INSERT UPDATE DELETE statements This chapter starts with a simple example that inserts indexes and queries spatial data You may find it helpful to read this example quickly before you examine the detailed data type and metadata information later in the chapter This chapter contains the following major sections a Section 2 1 Simple Example Inserting Indexing and Querying Spatial Data a Section 2 2 SDO_GEOMETRY Object Type a Section 2 3 Geometry Examples a Section 2 4 Geometry Metadata Views Section 2 5 Spatial Index Related Structures a Section 2 6 Unit
349. is the existing value if any in the measure dimension otherwise the default is 0 16 28 Oracle Spatial Users Guide and Reference SDO_LRS DEFINE_GEOM_SEGMENT Usage Notes Examples end_measure Distance measured from the end point of a geometric segment to the start point of the linear feature The default is the existing value if any in the measure dimension otherwise the default is the cartographic length of the segment An exception is raised if geom_segment has an invalid geometry type or dimensionality or if start_measure or end_measure is out of range All unassigned measures of the geometric segment will be populated automatically To store the resulting geometric segment geom_segment in the database you must execute an UPDATE or INSERT statement as appropriate The _3D format of this procedure SDO_LRS DEFINE_GEOM_SEGMENT_3D is available For information about _3D formats of LRS functions and procedures see Section 7 4 For more information about defining a geometric segment see Section 7 5 1 The following example defines the geometric segment splits it into two segments then concatenates those segments This example uses the definitions from the example in Section 7 7 The definitions of result_geom_1 result_geom_2 and result_geom_3 are displayed in Example 7 3 DECLARE geom_segment SDO GEOMETRY line string SDO_GEOMETRY dim array SDO DIM ARRAY result_geom_1 SDO GEOMETRY result_geom 2 SDO
350. it SDO_GTYPE values are used the geometry s SDO_GTYPE specifies the same dimensionality as specified in the applicable DIMINFO column value from the USER_SDO_GEOM_METADATA view The geometry s SRID value coordinate system is the same as the one specified in the applicable DIMINFO column value from the USER_SDO_GEOM_ METADATA view Examples The following example validates the geometry objects stored in the SHAPE column of the COLA_MARKETS table The example includes the creation of the result table The example uses the definitions and data from Section 2 1 In this case a row with a RESULT value of DONE is written to the result table because all the geometries are valid Is a layer valid First create the result table CREATE TABLE val results mkt_id number result varchar2 10 CALL SDO GEOM VALIDATE LAYER COLA MARKETS SHAPE MKT_ID VAL RESULTS Call completed SELECT from val_results MKT _ID RESULT Related Topics SDO_GEOM VALIDATE_LAYER_WITH_CONTEXT a SDO_GEOM VALIDATE_GEOMETRY 13 52 Oracle Spatial User s Guide and Reference SDO_GEOM VALIDATE_LAYER_WITH_CONTEXT SDO_GEOM VALIDATE_LAYER_WITH_CONTEXT Format Description Parameters SDO_GEOM VALIDATE_LAYER_WITH_CONTEXT geom_table IN VARCHAR2 geom_column IN VARCHAR2 result_table IN VARCHAR2 commit_interval IN NUMBER Examines a geometry column to determine if the stored geometries follow the defined rules for g
351. it does not become a polygon A self crossing line string does not have any implied area Figure 1 1 illustrates the geometric types Figure 1 1 Geometric Types Point Line String Polygon Arc Polygon Compound Polygon Arc Line String E Circle Compound Line String Rectangle go ES Spatial also supports the storage and indexing of three dimensional and four dimensional geometric types where three or four coordinates are used to define each vertex of the object being defined However spatial functions except for LRS functions and MBR related functions can work with only the first two dimensions and all spatial operators except SDO_FILTER are disabled if the spatial index has been created on more than two dimensions O 1 5 Data Model The Spatial data model is a hierarchical structure consisting of elements geometries and layers Layers are composed of geometries which in turn are made up of elements Spatial Concepts 1 5 Data Model 1 5 1 Element An element is the basic building block of a geometry The supported spatial element types are points line strings and polygons For example elements might model star constellations point clusters roads line strings and county boundaries polygons Each coordinate in an element is stored as an X Y pair The exterior ring and the interior ring of a polygon with holes are considered as two distinct elements that together make up a complex polygon Point data consi
352. it of measure into which to convert the input value Must be a value from the SDO_UNIT column of the same table used for from_unit For example to convert decimal degrees to radians specify Radian The value returned by this function might not be correct at an extremely high degree of precision because of the way internal mathematical operations are performed especially if they involve small numbers or irrational numbers such as pi For example converting 1 decimal degree into decimal minutes results in the value 60 0000017 Spatial Utility Subprograms 19 9 SDO_UTIL CONVERT_UNIT Examples The following example converts 1 radian into decimal degrees SQL gt SELECT SDO UTIL CONVERT_UNIT 1 Radian Degree FROM DUAL SDO_UTIL CONVERT_UNIT 1 RADIAN DEGREE 57 2957796 Related Topics None 19 10 Oracle Spatial User s Guide and Reference SDO_UTIL ELLIPSE_POLYGON SDO_UTIL ELLIPSE_POLYGON Format Description Parameters SDO_UTIL ELLIPSE_POLYGON center_longitude IN NUMBER center_latitude IN NUMBER semi_major_axis IN NUMBER semi_minor_axis IN NUMBER azimuth IN NUMBER arc_tolerance IN NUMBER RETURN SDO_GEOMETRY Returns the polygon geometry that approximates and is covered by a specified ellipse center_longitude Center longitude in degrees of the ellipse to be used to create the returned geometry center_latitude Center latitude in degrees of the ellipse to be used to create the re
353. ith a Cartesian geodetic geographical projected or local coordinate system Cartesian coordinates are coordinates that measure the position of a point from a defined origin along axes that are perpendicular in the represented two dimensional or three dimensional space If a coordinate system is not explicitly associated with a geometry a Cartesian coordinate system is assumed Geodetic coordinates sometimes called geographic coordinates are angular coordinates longitude and latitude closely related to spherical polar coordinates and are defined relative to a particular Earth geodetic datum A geodetic datum is a means of representing the figure of the Earth and is the reference for the system of geodetic coordinates a Projected coordinates are planar Cartesian coordinates that result from performing a mathematical mapping from a point on the Earth s surface to a plane There are many such mathematical mappings each used for a particular purpose a Local coordinates are Cartesian coordinates in a non Earth non georeferenced coordinate system Local coordinate systems are often used for CAD applications and local surveys When performing operations on geometries Spatial uses either a Cartesian or curvilinear computational model as appropriate for the coordinate system associated with the spatial data Spatial Concepts 1 7 Data Model For more information about coordinate system support in Spatial including
354. ith geodetic data using the WGS 84 coordinate system this function can be used to return the longitude and latitude coordinates of any point on or offset from the segment An exception is raised if geom_segment has an invalid geometry type or dimensionality or if the location is out of range The _3D format of this function GSDO_LRS LOCATE_PT_3D is available however the offset parameter is not available for SDO_LRS LOCATE_PT_3D For information about _3D formats of LRS functions see Section 7 4 For more information about locating a point on a geometric segment see Section 7 5 8 The following example creates a table for automobile accident data inserts a record for an accident at the point at measure 9 and on that is offset 0 the geometric segment representing Route 1 and displays the data The accident table is deliberately oversimplified This example also uses the route definition from the example in Section 7 7 Create a table for accidents CREATE TABLE accidents accident_id NUMBER PRIMARY KEY route_id NUMBER accident_geometry SDO _ GEOMETRY Insert an accident record DECLARE geom_segment SDO GEOMETRY 16 70 Oracle Spatial User s Guide and Reference SDO_LRS LOCATE_PT BEGIN SELECT SDO_LRS LOCATE PT a route geometry 9 0 into geom segment FROM lrs_ routes a WHERE a route name Routel INSERT INTO accidents VALUES 1 1 geom_segment END SELECT from accidents ACCIDENT
355. jects are all points the centroid of all the objects is returned a Ifthe geometry objects are a mixture of polygons and points specifically if they include at least one polygon and at least one point any points are ignored and the centroid of all the polygons is returned The result is weighted by the area of each polygon in the geometry objects If the geometry objects are a mixture of polygons and points the points are not used in the calculation of the centroid If the geometry objects are all points the points have equal weight See also the information about the SDO_GEOM SDO_CENTROID function in Chapter 13 14 2 Oracle Spatial Users Guide and Reference SDO_AGGR_CENTROID Examples The following example returns the centroid of the geometry objects in the COLA_ MARKETS table The example uses the definitions and data from Section 2 1 SELECT SDO_AGGR CENTROID SDOAGGRTYPE shape 0 005 FROM cola_markets SDO_AGGR CENTROID SDOAGGRTYPE SHAPE 0 005 SDO_GTYPE SDO SRID SDO POINT SDO GEOMETRY 2001 NULL SDO POINT TYPE 5 21295938 5 00744233 NULL NULL NUL L Spatial Aggregate Functions 14 3 SDO_AGGR_CONCAT_LINES SDO_AGGR_CONCAT_LINES Format Description Parameters Usage Notes Examples SDO_AGGR_CONCAT_LINES geom SDO_GEOMETRY RETURN SDO_GEOMETRY Returns a geometry that concatenates the specified line or multiline geometries geom Geometry objects Each input geometry
356. joins Two distinct filtering operations primary and secondary are performed to resolve queries The output of both operations yields the exact result set See also primary filter and secondary filter Glossary 9 Glossary 10 Numerics 0 SRID value used with SDO_CS VIEWPORT_ TRANSFORM function 15 10 type 0 zero element 2 23 10g upgrading spatial data to Oracle Database 10g 17 2 3D formats of LRS functions 7 10 A addresses representing for geocoding 5 1 aggregate functions description 1 19 reference information 14 1 SDO_AGGR_CENTROID 14 2 SDO_AGGR_CONCAT_LINES 14 4 SDO_AGGR_CONVEXHULL 14 6 SDO_AGGR_LRS_CONCAT 14 7 SDO_AGGR_MBR 14 9 SDO_AGGR_UNION 14 11 SDOAGGRTYPE object type 1 19 AGGREGATES _FOR_GEOMETRY function 21 3 AGGREGATES_FOR_LAYER function 21 5 ALL_SDO_GEOM_METADATA view 2 25 ALL_SDO_INDEX_INFO view 2 28 ALL_SDO_INDEX_METADATA view 2 29 ALTER INDEX statement 10 2 REBUILD clause 10 6 RENAME TO clause 10 9 Index angle units 6 12 ANYINTERACT SDO_ANYINTERACT operator 12 3 topological relationship 1 16 APPEND function 19 3 application size hardware requirements 1 23 arc densifying 13 8 not supported with geodetic data 6 6 area 13 11 area units 2 33 authalic sphere 6 2 average minimum bounding rectangle 18 2 AVERAGE _MBR procedure 18 2 bearing point at 19 21 BIN_GEOMETRY function 21 8 BIN_LAYER procedure 21 10 binning spatial 8 4 S
357. l Instead use a geodetic MBR to specify the query window as explained in Section 6 2 3 geom Geometry whose representation is to be transformed from an optimized rectangle to a valid polygon The input geometry must have an SRID value of 0 zero as explained in the Usage Notes to_srid The SRID of the coordinate system to be used for the transformation that is the SRID to be used in the returned geometry to_srid must be either a value in the SRID column of the MDSYS CS_SRS table described in Section 6 4 1 or NULL The geometry passed in must be an optimized rectangle If to_srid is a geodetic SRID a geometry not an optimized rectangle is returned that conforms to the Oracle Spatial requirements for a geodetic geometry for example each polygon element s area must be less than one half the surface area of the Earth Coordinate System Transformation Subprograms 15 9 SDO_CS VIEWPORT_TRANSFORM If to_srid is not a geodetic SRID an optimized rectangle is returned in which the SRID is set to to_srid Visualizer applications that work on geodetic data usually treat the longitude and latitude space as a regular Cartesian coordinate system Fetching the data corresponding to a viewport is usually done with the help of an SDO_FILTER or SDO_GEOM RELATE operation where the viewport with an optimized rectangle representation is sent as the window query Before release 10 1 this optimized rectangle type could not be use
358. l LinearRing gt lt gml innerBoundaryIs gt lt gml innerBoundaryIs gt lt gml LinearRing gt lt g ml coordinates decimal cs ts gt 5 5 5 6 6 6 6 5 5 5 lt gml coordinates gt lt gml LinearRing gt lt gml innerBoundaryIs gt lt gml Polygon gt Creating an XMLTYPE from the GML fragment Also useful for pretty printing the GML output SET LONG 40000 SELECT XMLTYPE SDO_UTIL TO GMLGEOMETRY sdo geometry 2003 262152 null sdo elem info array 1 1003 1 11 2003 1 21 2003 1 sdo ordinate array 10 10 10 20 40 50 10 2 40 5 41 10 10 1 41 1 10 10 10 20 30 30 30 30 30 30 40 10 40 10 40 10 40 10 30 30 30 30 305 30D4 Br 107 65 65 25 5p Sr HD AS GmlGeometry FROM DUAL GMLGEOMETRY lt gml Polygon srsName SD0 262152 xmlns gml http www opengis net gml gt lt gml ou terBoundaryIs gt lt gml LinearRing gt lt gml coordinates decimal cs ts gt 10 1 10 2 40 5 10 2 40 5 41 1 10 1 41 1 10 1 10 2 lt gml coordinates gt lt gml LinearRing gt lt gml outerBoundaryIs gt lt gml innerBoundaryIs gt lt gml LinearRing gt lt gml coordinates decima 1 cs tg gt 30 3 30 3 30 3 40 1 40 1 40 1 40 1 30 3 30 3 30 3 lt gml coor dinates gt lt gml LinearRing gt lt gml innerBoundaryIs gt lt gml innerBoundaryIs gt lt gml LinearR ing gt lt gml coordinates decimal cs ts gt 5 5 5 6 6 6 6 5 5 5 lt gml coordin ates gt lt gml LinearRing gt lt gml innerBoundaryIs g
359. l Utility Subprograms 19 3 SDO_UTIL APPEND Examples Related Topics The following example appends the cola_a and cola_c geometries The example uses the definitions and data from Section 2 1 SELECT SDO_UTIL APPEND c_a shape c_c shape FROM cola_markets c_a cola markets c_c WHERE c_a name cola_a AND c_c name cola c SDO_UTIL APPEND C_A SHAPE C_C SHAPE SDO_GTYPE SDO SRID SDO POINT X Y Z SD SDO GEOMETRY 2007 NULL NULL SDO ELEM INFO ARRAY 1 1003 3 5 1003 1 SDO_ ORDINATE ARRAY 1 1 5 7 3 3 6 3 6 5 4 5 3 3 a SDO_GEOM SDO_UNION in Chapter 13 19 4 Oracle Spatial Users Guide and Reference SDO_UTIL CIRCLE_POLYGON SDO_UTIL CIRCLE_POLYGON Format Description Parameters SDO_UTIL CIRCLE_POLYGON center_longitude IN NUMBER center_latitude IN NUMBER radius IN NUMBER arc_tolerance IN NUMBER RETURN SDO_GEOMETRY Returns the polygon geometry that approximates and is covered by a specified circle center_longitude Center longitude in degrees of the circle to be used to create the returned geometry center_latitude Center latitude in degrees of the circle to be used to create the returned geometry radius Length in meters of the radius of the circle to be used to create the returned geometry arc_tolerance A numeric value to be used to construct the polygon geometry The arc_ tolerance parameter value has the same meaning and usage guidelines as the arc_
360. l information array corresponding to geom2 usually selected from one of the xxx_SDO_GEOM_METADATA views described in Section 2 4 tol Tolerance value see Section 1 5 5 In Figure 13 4 the shaded area represents the polygon returned when SDO_ UNION is used with a square geom1 and another polygon geom2 Figure 13 4 SDO_GEOM SDO_UNION eom1 g geom2 If the function format with tol is used all geometry objects must be defined using 4 digit SDO_GTYPE values explained in Section 2 2 1 If it sufficient to append one geometry to another geometry without performing a topological union operation and if both geometries are disjoint using the SDO_ UTIL APPEND function described in Chapter 19 is faster than using the SDO_ UNION function An exception is raised if geom1 and geom2 are based on different coordinate systems The following example returns a geometry object that is the topological union OR operation of cola_aand cola_c The example uses the definitions and data from Section 2 1 Return the topological intersection of two geometries SELECT SDO_GEOM SDO_UNION c_a shape m diminfo c_c shape m diminfo 13 40 Oracle Spatial User s Guide and Reference SDO_GEOM SDO_UNION Related Topics FROM cola_markets c_a cola markets c_c user sdo geom metadata m WHERE m table name COLA MARKETS AND m column_name SHAPE AND c_a name cola_a AND c_c name cola_c SDO_GEOM SDO_UNION C_A SHAPE M DIMI
361. la_markets c WHERE SDO_ANYINTERACT c shape SDO GEOMETRY 2003 NULL NULL SDO_ ELEM INFO ARRAY 1 1003 3 SDO ORDINATE ARRAY 4 6 8 8 TRUE MKT ID NAME 1 cola a 4 cola d 12 4 Oracle Spatial Users Guide and Reference SDO_CONTAINS SDO_CONTAINS Format Description SDO_CONTAINS geometry1 geometry2 Checks if any geometries in a table have the CONTAINS topological relationship with a specified geometry Equivalent to specifying the SDO_RELATE operator with mask CONTAINS See the section on the SDO_RELATE operator in this chapter for information about the operations performed by this operator and for usage requirements Keywords and Parameters Returns Usage Notes Value Description geometryl Specifies a geometry column in a table The column must be spatially indexed Data type is SDO_GEOMETRY geometry2 Specifies either a geometry from a table or a transient instance of a geometry Specified using a bind variable or SDO_GEOMETRY constructor Data type is SDO_GEOMETRY The expression SDO_CONTAINS geometry1 geometry2 TRUE evaluates to TRUE for object pairs that have the CONTAINS topological relationship and FALSE otherwise See the Usage Notes for the SDO_RELATE operator in this chapter For an explanation of the topological relationships and the nine intersection model used by Spatial see Section 1 8 Spatial Operators 12 5 SDO_CONTAINS Examples The following
362. lane For example on the Earth s surface there are no parallel lines lines are geodesics and all geodesics intersect Thus closed curved surface problems cannot be done accurately with Cartesian geometry Spatial provides accurate results regardless of the coordinate system or the size of the area involved without requiring that the data be projected to a flat surface The results are accurate regardless of where on the Earth s surface the query is focused even in special areas such as the poles Thus you can store coordinates in any datum and projections that you choose and you can perform accurate queries regardless of the coordinate system Coordinate Systems Spatial Reference Systems 6 3 Geodetic Coordinate Support 6 2 2 Choosing a Geodetic or Projected Coordinate System For applications that deal with the Earth s surface the data can be represented using a geodetic coordinate system or a projected plane coordinate system In deciding which approach to take with the data consider any needs related to accuracy and performance a Accuracy For many spatial applications the area is sufficiently small to allow adequate computations on Cartesian coordinates in a local projection For example the New Hampshire State Plane local projection provides adequate accuracy for most spatial applications that use data for that state However Cartesian computations on a plane projection will never give accurate results for a
363. large area such as Canada or Scandinavia For example a query asking if Stockholm Sweden and Helsinki Finland are within a specified distance may return an incorrect result if the specified distance is close to the actual measured distance Computations involving large areas or requiring very precise accuracy must account for the curvature of the Earth s surface Performance Spherical computations use more computing resources than Cartesian computations and take longer to complete In general a Spatial operation using geodetic coordinates will take two to three times longer than the same operation using Cartesian coordinates 6 2 3 Geodetic MBRs To create a query window for certain operations on geodetic data use an MBR minimum bounding rectangle by specifying an SDO_ETYPE value of 1003 or 2003 and an SDO_INTERPRETATION value of 3 as described in Table 2 2 in Section 2 2 4 A geodetic MBR can be used with the following operators SDO_ FILTER SDO_RELATE with the ANYINTERACT mask SDO_ANYINTERACT and SDO_WITHIN_DISTANCE Example 6 1 requests the names of all cola markets that are likely to interact spatially with a geodetic MBR Example 6 1 Using a Geodetic MBR SELECT c name FROM cola markets_cs c WHERE SDO_FILTER c shape SDO_GEOMETRY 6 4 Oracle Spatial User s Guide and Reference Geodetic Coordinate Support 2003 8307 SRID for WGS 84 longitude latitude NULL SDO ELEM INFO ARRAY 1 1003 3 SDO ORDINATE A
364. late SDO_ GEOMETRY objects in a variety of coordinate systems For reference information about coordinate system transformation functions and procedures see Chapter 15 This chapter contains the following major sections Section 6 1 Terms and Concepts Section 6 2 Geodetic Coordinate Support Section 6 3 Local Coordinate Support Section 6 4 Coordinate Systems Data Structures Section 6 5 Creating a User Defined Coordinate System Section 6 6 Coordinate System Transformation Functions Section 6 7 Notes and Restrictions with Coordinate Systems Support Section 6 8 Example of Coordinate System Transformation 6 1 Terms and Concepts This section explains important terms and concepts related to coordinate system support in Oracle Spatial Coordinate Systems Spatial Reference Systems 6 1 Terms and Concepts 6 1 1 Coordinate System Spatial Reference System A coordinate system also called a spatial reference system is a means of assigning coordinates to a location and establishing relationships between sets of such coordinates It enables the interpretation of a set of coordinates as a representation of a position in a real world space 6 1 2 Cartesian Coordinates Cartesian coordinates are coordinates that measure the position of a point from a defined origin along axes that are perpendicular in the represented two dimensional or three dimensional space 6 1 3 Geodetic Coordinates Geographic Coordi
365. latitude number member function GetGeometry SELF in long lat RETURN SDO GEOMETRY DETERMINISTIC create or replace type body long lat as member function GetGeometry self in long lat return SDO GEOMETRY is begin return sdo_geometry 2001 8307 sdo point type longitude latitude NULL NULL NULL end end If the spatial data table does not already exist create the table and add data to it as in the following example that creates a table named TEST_LONG_LAT create table test_long lat 9 6 Oracle Spatial User s Guide and Reference SDO_GEOMETRY Objects in Function Based Indexes location long lat name varchar2 32 insert into test_long lat values long lat 10 10 Placel insert into test_long lat values long lat 20 20 Place2 insert into test_long lat values long lat 30 30 Place3 Update the USER_SDO_GEOM_METADATA view using dot notation to specify the schema name table name and function name and parameter value The following example specifies SCOTT LONG_LAT GetGeometry LOCATION as the COLUMN_NAME explained in Section 2 4 2 in the metadata view insert into user _sdo geom metadata values test_long lat scott long lat GetGeometry location sdo dim array sdo dim element Longitude 180 180 0 005 sdo dim element Latitude 90 90 0 005 8307 Create the spatial index specifying the column name and function name using dot notation For example create inde
366. le 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 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 This preface contains these topics xxiii Audience Audience Documentation Accessibility Organization Technologies Released Separately a Related Documentation a Conventions This guide is intended for anyone who needs to store spatial data in an Oracle database Documentation Accessibility xxiv Our goal is to make Oracle products services and supporting documentation accessible with good usability to the disabled community To that end our documentation includes features that make information available to users of assistive technology This documentation is available in HTML format and contains markup to facilitate access by the disabled community Standards will continue to evolve over time and Oracle is actively engaged with other market leading technology vendors to address technical obstacles so that our documentation can be accessible to all of our customers For additional information visit the Oracle Accessibility Program
367. le Spatial Users Guide and Reference Example of LRS Functions SDO_LRS VALID LRS PT SDO GEOMETRY 3301 NULL NULL SDO ELEM INFO ARRAY SQL gt Locate the point on Routel at measure 9 offset 0 SQL gt SELECT SDO_LRS LOCATE PT route geometry 9 0 2 FROM lrs_ routes WHERE route_id 1 SDO_LRS LOCATE PT ROUTE GEOMETRY 9 0 SDO_GTYPE SDO SRID SDO POINT X Y Z S SDO_GEOMETRY 3301 NULL NULL SDO ELEM INFO ARRAY 1 1 1 SDO ORDINATE ARRAY 9 4 9 Linear Referencing System 7 33 Example of LRS Functions 7 34 Oracle Spatial User s Guide and Reference 8 Spatial Analysis and Mining This chapter describes the Oracle Spatial support for spatial analysis and mining in Oracle Data Mining ODM applications Note To use the features described in this chapter you must understand the main concepts and techniques explained in the Oracle Data Mining documentation For reference information about spatial analysis and mining functions and procedures see Chapter 21 This chapter contains the following major sections a Section 8 1 Spatial Information and Data Mining Applications Section 8 2 Spatial Binning for Detection of Regional Patterns Section 8 3 Materializing Spatial Correlation Section 8 4 Colocation Mining a Section 8 5 Spatial Clustering Section 8 6 Location Prospecting 8 1 Spatial Information and Data Mining Applications ODM allows automatic discovery
368. le in the SCOTT schema The estimate is based on the geometries that are currently in the table SELECT SDO_TUNE ESTIMATE RTREE INDEX SIZE SCOTT COLA MARKETS SHAPE FROM DUAL SDO_TUNE ESTIMATE RTREE INDEX SIZE SCOTT COLA MARKETS SHAPE 18 6 Oracle Spatial Users Guide and Reference SDO_TUNE EXTENT_OF SDO_TUNE EXTENT_OF Format SDO_TUNE EXTENT_OF table_name IN VARCHAR2 column_name IN VARCHAR2 RETURN SDO_GEOMETRY Description Returns the minimum bounding rectangle MBR of all geometries in a layer Note This function is deprecated and will not be supported in future versions of Spatial You are instead encouraged to use the SDO_AGGR_MBR function documented in Chapter 14 to return the MBR of geometries The SDO_TUNE EXTENT_OF function is limited to two dimensional geometries whereas the SDO_AGGR_ MBR function is not Parameters table_name Spatial geometry table column_name Geometry column for which the minimum bounding rectangle is to be returned Usage Notes This deprecated function returns NULL if the data is inconsistent Examples The following example calculates the minimum bounding rectangle for the objects in the SHAPE column of the COLA_MARKETS table SELECT SDO_TUNE EXTENT OF COLA MARKETS SHAPE FROM DUAL Spatial Tuning Subprograms 18 7 SDO_TUNE EXTENT_OF SDO_TUNE EXTENT OF COLA MARKETS SHAPE SDO_GTYPE SDO SRID SDO POINT X Y SDO G
369. lease 8 1 6 format of a 1 digit SDO_GTYPE value is still supported If a 1 digit value is used however Oracle Spatial determines the number of dimensions from the DIMINFO column of the metadata views described in Section 2 4 3 Also if 1 digit SDO_GTYPE values are converted to 4 digit values any SDO_ETYPE values that end in 3 or 5 in the SDO_ELEM_INFO array described in Section 2 2 4 must also be converted The number of dimensions reflects the number of ordinates used to represent each vertex for example X Y for two dimensional objects Points and lines are considered two dimensional objects However see Section 7 2 for dimension information about LRS points In any given layer column all geometries must have the same number of dimensions For example you cannot mix two dimensional and three dimensional data in the same layer The following methods are available for returning the individual ditt components of the SDO_GTYPE for a geometry object GET_DIMS GET_LRS_DIM and GET_ GTYPE These methods are described in Chapter 11 2 2 2 SDO_SRID The SDO_SRID attribute can be used to identify a coordinate system spatial reference system to be associated with the geometry If SDO_SRID is null no 2 8 Oracle Spatial User s Guide and Reference SDO_GEOMETRY Object Type coordinate system is associated with the geometry If SDO_SRID is not null it must contain a value from the SRID column of the MDSYS CS_SRS table d
370. led a spatial reference system is a means of assigning coordinates to a location and establishing relationships between sets of such coordinates It enables the interpretation of a set of coordinates as a representation of a position in a real world space 1 6 Oracle Spatial User s Guide and Reference Data Model Any spatial data has a coordinate system associated with it The coordinate system can be georeferenced related to a specific representation of the Earth or not georeferenced that is Cartesian and not related to a specific representation of the Earth If the coordinate system is georeferenced it has a default unit of measurement such as meters associated with it but you can have Spatial automatically return results in another specified unit such as miles For more information about unit of measurement support see Section 2 6 Before Oracle Spatial release 8 1 6 geometries objects of type SDO_GEOMETRY were stored as strings of coordinates without reference to any specific coordinate system Spatial functions and operators always assumed a coordinate system that had the properties of an orthogonal Cartesian system and sometimes did not provide correct results if Earth based geometries were stored in longitude and latitude coordinates With release 8 1 6 Spatial provided support for many different coordinate systems and for converting data freely between different coordinate systems Spatial data can be associated w
371. lian restaurants to your hotel The query might look like the following SELECT r name FROM restaurants r WHERE SDO_NN r geometry my hotel sdo batch size 10 TRUE AND r cuisine Italian AND ROWNUM lt 2 If the sdo_batch_size keyword is not specified in this example only the two nearest restaurants are returned regardless of their CUISINE value and if the CUISINE value of these two rows is not Italian the query may return no rows The ROWNUM lt 2 clause is necessary to limit the number of results returned to no more than 2 where CUISINE is Italian The sdo_batch_size value can affect the performance of nearest neighbor queries A good general guideline is to specify the number of candidate rows likely to satisfy the WHERE clause Using the preceding example of a query for Italian restaurants if approximately 20 percent of the restaurants nearest to the hotel are Italian and if you want 2 restaurants an sdo_batch_size value of 10 will probably result in the best performance On the other hand if only approximately 5 percent of the restaurants nearest to the hotel are Italian and if you want 2 restaurants an sdo_batch_size value of 40 would be better You can specify sdo_batch_size 0 which causes Spatial to calculate a batch size that is suitable for the result set size However the calculated batch size may not be optimal and the calculation incurs some processing overhead if you can determine a good sdo_batch_size value
372. lity A substantial number of insert and delete operations affecting an R tree index may degrade the quality of the R tree structure which may adversely affect query performance The R tree is a hierarchical tree structure with nodes at different heights of the tree The performance of an R tree index structure for queries is roughly proportional to the area and perimeter of the index nodes of the R tree The area covered at level 0 represents the area occupied by the minimum bounding rectangles of the data geometries the area at level 1 indicates the area covered by leaf level R tree nodes and so on The original ratio of the area at the root topmost level to the area at level 0 can change over time based on updates to the table and if there is a degradation in that ratio that is if it increases significantly rebuilding the index may help the performance of queries If the performance of SDO_FILTER operations has degraded and if there have been a large number of insert update or delete operations affecting geometries the performance degradation may be due to a degradation in the quality of the associated R tree index You can check for degradation of index quality by using the SDO_TUNE QUALITY_DEGRADATION function described in Chapter 18 if the function returns a number greater than 2 consider rebuilding the index Note however that the R tree index quality degradation number may not be significant in terms of overall query perfor
373. lowing are the names in tabular format of the supported projections Alaska Conformal Azimuthal Equidistant Cassini 6 16 Oracle Spatial User s Guide and Reference Albers Conical Equal Area Bonne Cylindrical Equal Area Creating a User Defined Coordinate System Eckert IV Equidistant Conic Gall Geographic Lat Long Hammer Interrupted Goode Homolosine Lambert Azimuthal Equal Area Lambert Conformal Conic Belgium 1972 Miller Cylindrical New Zealand Map Grid Orthographic Polyconic Sinusoidal State Plane Coordinates Swiss Oblique Mercator Transverse Mercator Danish System 34 Jylland Fyn Transverse Mercator Finnish KKJ Universal Transverse Mercator Wagner IV Eckert VI Equirectangular General Vertical Near Side Perspective Gnomonic Hotine Oblique Mercator Interrupted Mollweide Lambert Conformal Conic Mercator Mollweide Oblated Equal Area Polar Stereographic Robinson Space Oblique Mercator Stereographic Transverse Mercator Transverse Mercator Danish System 45 Bornholm Transverse Mercator Sjaelland Van der Grinten Wagner VII 6 5 Creating a User Defined Coordinate System To create a user defined coordinate system add a row to the MDSYS CS_SRS table See Section 6 4 1 for information about this table including the requirements for values in each column To specify the WKTEXT column in the MDSYS CS_SRS table follow the syntax specified in Section 6 4 1 1 See also
374. lt_geom_2 dim_array Insert geometries into table to display later INSERT INTO lrs_ routes VALUES 11 result_geom 1 result_geom 1 i INSERT INTO lrs_ routes VALUES 12 result_geom_2 result_geom_ 2 i INSERT INTO lrs_ routes VALUES 13 result_geom_ 3 result_geom_3 i END 16 10 Oracle Spatial User s Guide and Reference SDO_LRS CONNECTED_GEOM_SEGMENTS SDO_LRS CONNECTED_GEOM_SEGMENTS Format Description Parameters SDO_LRS CONNECTED_GEOM_SEGMENTS geom_segment_1 IN SDO_GEOMETRY geom_segment_2 IN SDO_GEOMETRY tolerance IN NUMBER RETURN VARCHAR2 or SDO_LRS CONNECTED_GEOM_SEGMENTS geom_segment_1 IN SDO_GEOMETRY dim_array_1 IN SDO_DIM_ARRAY geom_segment_2 IN SDO_GEOMETRY dim_array_2 IN SDO_DIM_ARRAY RETURN VARCHAR2 Checks if two geometric segments are spatially connected geom_segment_1 First of two geometric segments to be checked dim_array_1 Dimensional information array corresponding to geom_segment_1 usually selected from one of the xxx_SDO_GEOM_METADATA views described in Section 2 4 geom_segment_2 Second of two geometric segments to be checked Linear Referencing Subprograms 16 11 SDO_LRS CONNECTED_GEOM_SEGMENTS Usage Notes Examples dim_array_2 Dimensional information array corresponding to geom_segment_2 usually selected from one of the xxx_SDO_GEOM_METADATA views described in Section 2 4 tolerance Tolerance value
375. lue 8199 This example uses the definitions from the example in Section 6 8 Return the transformation of cola_c using to_srid 8199 Longitude Latitude Arc 1950 SELECT c name SDO CS TRANSFORM c shape m diminfo 8199 FROM cola_markets_cs c user _sdo geom metadata m WHERE m table name COLA MARKETS CS AND m column_name SHAPE AND c name cola_c Coordinate System Transformation Subprograms 15 3 SDO_CS TRANSFORM SDO_CS TRANSFORM C SHAPE M DIMINFO 8199 SDO_GTYPE SDO SRID SDO POINT X Y Z cola_c SDO GEOMETRY 2003 8199 NULL SDO ELEM INFO ARRAY 1 1003 1 SDO ORDINATE ARR AY 3 00074114 3 00291482 6 00067068 3 00291287 6 0006723 5 00307625 4 0007 1961 5 00307838 3 00074114 3 00291482 Same as preceding but using to_srname parameter SELECT c name SDO CS TRANSFORM c shape m diminfo Longitude Latitude Arc 1950 FROM cola_markets_cs c user_sdo_geom metadata m WHERE m table name COLA MARKETS CS AND m column_name SHAPE AND c name cola_c cola c SDO GEOMETRY 2003 8199 NULL SDO ELEM INFO ARRAY 1 1003 1 SDO ORDINATE ARR AY 3 00074114 3 00291482 6 00067068 3 00291287 6 0006723 5 00307625 4 0007 1961 5 00307838 3 00074114 3 00291482 15 4 Oracle Spatial Users Guide and Reference SDO_CS TRANSFORM_LAYER SDO_CS TRANSFORM_LAYER Format Description Parameters Usage Notes SDO_CS TRANSFORM_LAYER table_in IN VARCHAR2 column_in I
376. lumn Returns the measure of the closest point on a segment to a specified projection point Returns the signed offset shortest distance from a point to a geometric segment Checks if an LRS geometry is valid Table 16 3 lists subprograms related to converting geometric segments Table 16 3 Subprograms for Converting Geometric Segments Subprogram Description SDO_LRS CONVERT_TO_LRS_DIM_ ARRAY SDO_LRS CONVERT_TO_LRS_GEOM SDO_LRS CONVERT_TO_LRS_LAYER SDO_LRS CONVERT_TO_STD_DIM_ ARRAY SDO_LRS CONVERT_TO_STD_GEOM SDO_LRS CONVERT_TO_STD_LAYER Converts a standard dimensional array to an LRS dimensional array by creating a measure dimension Converts a standard SDO_GEOMETRY line string to an LRS geometric segment by adding measure information Converts all geometry objects in a column of type SDO_GEOMETRY from standard line string geometries without measure information to LRS geometric segments with measure information and updates the metadata Converts an LRS dimensional array to a standard dimensional array by removing the measure dimension Converts an LRS geometric segment to a standard SDO_GEOMETRY line string by removing measure information Converts all geometry objects in a column of type SDO_GEOMETRY from LRS geometric segments with measure information to standard line string geometries without measure information and updates the metadata For more information abou
377. ly indexed Data type is SDO_GEOMETRY geometry2 Specifies either a geometry from a table or a transient instance of a geometry Specified using a bind variable or SDO_GEOMETRY constructor Data type is SDO_GEOMETRY The expression SDO_ON geometry1 geometry2 TRUE evaluates to TRUE for object pairs that have the ON topological relationship and FALSE otherwise See the Usage Notes for the SDO_RELATE operator in this chapter For an explanation of the topological relationships and the nine intersection model used by Spatial see Section 1 8 The following example finds geometries that have the ON relationship with a query window here a rectangle with lower left upper right coordinates 4 6 8 8 The Spatial Operators 12 31 SDO_ON example uses the definitions and data described in Section 2 1 and illustrated in Figure 2 1 This example returns no rows because there are no line string geometries in the SHAPE column SELECT c mkt_id c name FROM cola_markets c WHERE SDO ON c shape SDO GEOMETRY 2003 NULL NULL SDO ELEM INFO ARRAY 1 1003 3 SDO ORDINATE ARRAY 4 6 8 8 TRUE no rows selected 12 32 Oracle Spatial User s Guide and Reference SDO_OVERLAPBDYDISJOINT SDO_OVERLAPBDYDISJOINT Format Description SDO_OVERLAPBDYDISJOINT geometry1 geometry2 Checks if any geometries in a table have the OVERLAPBDYDISJOINT topological relationship with a specified geometry Equivalent
378. m2 IN SDO_GEOMETRY tol IN NUMBER units IN VARCHAR2 RETURN VARCHAR2 Description Determines if two spatial objects are within some specified distance from each other Parameters geom1 Geometry object 13 56 Oracle Spatial User s Guide and Reference SDO_GEOM WITHIN_DISTANCE Usage Notes dim1 Dimensional information array corresponding to geom1 usually selected from one of the xxx_SDO_GEOM_METADATA views described in Section 2 4 dist Distance value geom2 Geometry object dim2 Dimensional information array corresponding to geom2 usually selected from one of the xxx_SDO_GEOM_METADATA views described in Section 2 4 tol Tolerance value see Section 1 5 5 units Unit of measurement a quoted string with unit and an SDO_UNIT value from the MDSYS SDO_AREA_UNITS table for example unit KM See Section 2 6 for more information about unit of measurement specification If this parameter is not specified the unit of measurement associated with the data is assumed For geodetic data the default unit of measurement is meters For better performance use the SDO_WITHIN_DISTANCE operator described in Chapter 12 instead of the SDO_GEOM WITHIN_DISTANCE function For more information about performance considerations with operators and functions see Section 1 9 This function returns TRUE for object pairs that are within the specified distance and FALSE otherwise The distance between two extende
379. mance due to Oracle caching strategies and other significant Oracle capabilities such as table pinning which can essentially remove I O overhead from R tree index queries To rebuild an R tree index use the ALTER INDEX REBUILD statement which is described in Chapter 10 1 8 Spatial Relationships and Filtering Spatial uses secondary filters to determine the spatial relationship between entities in the database The spatial relationship is based on geometry locations The most common spatial relationships are based on topology and distance For example the boundary of an area consists of a set of curves that separates the area from the rest of the coordinate space The interior of an area consists of all points in the area that are not on its boundary Given this two areas are said to be adjacent if they share part of a boundary but do not share any points in their interior The distance between two spatial objects is the minimum distance between any points in them Two objects are said to be within a given distance of one another if their distance is less than the given distance 1 14 Oracle Spatial Users Guide and Reference Spatial Relationships and Filtering To determine spatial relationships Spatial has several secondary filter methods The SDO_RELATE operator evaluates topological criteria a TheSDO_WITHIN_DISTANCE operator determines if two spatial objects are within a specified distance of each other a The SDO_NN opera
380. me in most cases when the spatial geometry table already exists you do not plan to add substantially more geometries to it Spatial Tuning Subprograms 18 5 SDO_TUNE ESTIMATE_RTREE_INDEX_SIZE Examples before creating the index and you plan to use the default R tree indexing parameters a Use the format with integer parameters number_of_geoms db_block_ size sdo_rtr _pctfree num dimensions is_geodetic in any of the following cases the spatial geometry table does not exist the spatial geometry table exists but you plan to add substantially more geometries to it before creating the index the num_dimensions value is not 2 for non geodetic data or 3 for geodetic data and a nondefault value will be specified using the sdo _ indx_dims parameter in the CREATE INDEX statement or the data is geodetic but you plan to specify geodetic false in the CREATE INDEX statement see Section 4 1 2 The following example estimates the maximum number of megabytes needed for a spatial index table for an index given the following information number_of_ geoms 1000000 one million db block size 2048 sdo_rtr_pctfree 10 num_dimensions 2 is geodetic 0 SELECT SDO TUNE ESTIMATE RTREE INDEX SIZE 1000000 2048 10 2 0 FROM DUAL SDO_TUNE ESTIMATE RTREE INDEX SIZE 1000000 2048 10 2 0 The following example estimates the maximum number of megabytes needed for a spatial index table for an index on the SHAPE column in the COLA_MARKETS tab
381. me European countries the settlement can be an area within a large city in which case the large city is the municipality Municipality The administrative area above settlement Municipality is not used for United States addresses In European countries where cities contain settlements the municipality is the city Region The administrative area above municipality if applicable or above settlement if municipality does not apply In the United States the region is the state in some other countries the region is the province Postal code Postal code optional if administrative area information is provided In the United States the postal code is the 5 digit ZIP code Postal add on code String appended to the postal code In the United States the postal add on code is typically the last four numbers of a 9 digit ZIP code specified in 5 4 format Country The country name or ISO country code Formatted addresses are specified using the SDO_GEO_ADDR data type which is described in Section 5 2 1 An unformatted address is described using lines with information in the postal address format for the relevant country The address lines must contain information essential for geocoding and they might also contain information that is not needed for geocoding something that is common in unprocessed postal addresses An unformatted address is stored as an array of strings For example an address might consist of the following strings 22
382. meters geom_table Spatial geometry table geom_column Geometry object column to be examined pkey_column The primary key column This must be a single numeric NUMBER data type column 13 50 Oracle Spatial Users Guide and Reference SDO_GEOM VALIDATE_LAYER Usage Notes result_table Result table to hold the validation results A row is added to result_table for each invalid geometry If there are no invalid geometries one or more depending on the commit_interval value rows with a result of DONE are added commit_interval Number of geometries to validate before Spatial performs an internal commit operation and writes a row with a result of DONE to result_table if no rows for invalid geometries have been written since the last commit operation If commit _interval is not specified no internal commit operations are performed during the validation The commit_interval option is helpful if you want to look at the contents of result_table while the validation is in progress If the primary key is indexed you can look at the last PREY_COLUMN value to see approximately how much of the validation is completed This deprecated procedure loads the result table with validation results An empty result table result_table parameter must be created before calling this procedure The format of the result table is pkey_column NUMBER result VARCHAR2 10 If result_table is not empty you should truncate the table before calling
383. model Chapter 10 Chapter 13 Chapter 14 Chapter 7 concepts and usage and Chapter 16 reference Chapter 15 Chapter 18 Chapter 19 Chapter 21 Chapter 5 concepts and usage and Chapter 20 reference Oracle Spatial GeoRaster Oracle Spatial Topology and Network Data Models Oracle Spatial Topology and Network Data Models Although Locator is available on both the Standard and Enterprise Editions of Oracle Database 10g some Locator features requires database features that are not available or are limited on the Standard Edition Some of those Locator features and their availability are listed in Table B 3 Oracle Locator B 3 Table B 3 Feature Availability with Standard and Enterprise Editions Feature Standard Enterprise Edition Availability Parallel spatial index Supported with Enterprise Edition only builds Multimaster replication of Supported with Enterprise Edition only Single SDO_GEOMETRY objects master materialized view replication for SDO_GEOMETRY objects is supported with both Standard Edition and Enterprise Edition See Oracle Database Advanced Replication for more information Partitioned spatial indexes Requires the Partitioning Option with Enterprise Edition Not supported with Standard Edition B 4 Oracle Spatial Users Guide and Reference C Complex Spatial Queries Examples This appendix provides examples with explanations of queries that are more complex than the ex
384. mple 6 3 creates a user defined geodetic coordinate system The first four columns are not the WKT information but specify other fields in the MSDYD CS_ SRS table The WKT information starts with GEOGCS This example includes an ellipsoid SPHEROID definition in which the semi major axis and inverse flattening parameters are slightly changed from the WGS 84 coordinate system as well as a different datum definition Because the shift_x and shift_y parameter values are specified all the shift rotation and scaling values must be specified There is no projection information included for a geodetic coordinate system Example 6 3 Creating a User Defined Geodetic Coordinate System INSERT INTO mdsys cs_srs VALUES Longitude Latitude WGS 90 1008307 1008307 Oracle GEOGCS Longitude Latitude WGS 90 DATUM WGS 90 SPHEROID WGS 90 6378137 032499 298 257236 100 100 0 0 0 0 0 PRIMEM Greenwich 0 000000 UNIT Decimal Degree 0 01745329251994330 NULL Coordinate Systems Spatial Reference Systems 6 19 Coordinate System Transformation Functions 6 6 Coordinate System Transformation Functions The current release of Oracle Spatial includes the following functions and procedures for data transformation using coordinate systems SDO_CS TRANSFORM function Transforms a geometry representation using a coordinate system specified by SRID or name a SDO_CS TRANSFORM_LAYER procedure Transfor
385. mple 6 4 in Section 6 8 specifies these extents with a 10 meter tolerance value in each dimension for a geodetic data layer INSERT INTO USER _SDO_GEOM METADATA VALUES cola_markets cs shape SDO DIM ARRAY SDO_DIM ELEMENT Longitude 180 180 10 10 meters tolerance SDO_DIM ELEMENT Latitude 90 90 10 10 meters tolerance 8307 SRID for Longitude Latitude WGS 84 coordinate system i See Section 6 7 for additional notes and restrictions relating to geodetic data 6 3 Local Coordinate Support Spatial provides a level of support for local coordinate systems Local coordinate systems are often used in CAD systems and they can also be used in local surveys where the relationship between the surveyed site and the rest of the world is not important Several local coordinate systems are predefined and included with Spatial in the MDSYS CS_SRS table described in Section 6 4 1 These supplied local coordinate systems whose names start with Non Earth define non Earth Cartesian coordinate systems based on different units of measurement Meter Millimeter Inch and so on In the current release you can use these local coordinate systems only to convert coordinates in a local coordinate system from one unit of measurement to another for example inches to millimeters by transforming a geometry or a layer of geometries Coordinate Systems Spatial Reference Systems 6 7 Coordinate Systems Data
386. mples The SDO_WITHIN_DISTANCE operator identifies the set of spatial objects that are within some specified distance of a given object You can indicate that the distance is approximate or exact If you specify querytype FILTER the distance is approximate because only a primary filter operation is performed otherwise the distance is exact because both primary and secondary filtering operations are performed Example C 1 finds all cities within 15 miles of the interstate highway 1170 Example C 1 Finding All Cities Within a Distance of a Highway SELECT ORDERED c city FROM geod_interstates i geod_cities c WHERE i highway 1170 AND sdo_within distance c location i geom distance 15 unit mile TRUE Example C 1 finds all cities within 15 miles distance 15 unit mile of the specified highway i highway 1170 and by default the result is exact because the querytype parameter was not used to limit the query to a primary filter operation In the WHERE clause of this example a i highway refers to the HIGHWAY column of the INTERSTATES table and 1170 is a value from the HIGHWAY column a c location specifies the search column geomet ry1 the LOCATION column of the GEOD_CITIES table i geom specifies the query window aGeom the spatial geometry in the GEOM column of the GEOD_INTERSTATES table in the row whose HIGHWAY column contains the value 1170 C 2 Oracle Spatial User s Guide and Reference SDO
387. ms Spatial Reference Systems a Chapter 7 Linear Referencing System Chapter 8 Spatial Analysis and Mining Chapter 9 Extending Spatial Indexing Capabilities 1 Spatial Concepts Oracle Spatial is an integrated set of functions and procedures that enables spatial data to be stored accessed and analyzed quickly and efficiently in an Oracle database Spatial data represents the essential location characteristics of real or conceptual objects as those objects relate to the real or conceptual space in which they exist This chapter contains the following major sections Section 1 1 What Is Oracle Spatial Section 1 2 Object Relational Model Section 1 3 Introduction to Spatial Data Section 1 4 Geometry Types Section 1 5 Data Model Section 1 6 Query Model Section 1 7 Indexing of Spatial Data Section 1 8 Spatial Relationships and Filtering Section 1 9 Spatial Operators Procedures and Functions Section 1 10 Spatial Aggregate Functions Section 1 11 Spatial Java Interface Section 1 12 Geocoding Section 1 13 MDDATA Schema Section 1 14 Performance and Tuning Information Section 1 15 Spatial Release Version Number Spatial Concepts 1 1 What Is Oracle Spatial Section 1 16 Spatial Application Hardware Requirement Considerations a Section 1 17 Spatial Error Messages Section 1 18 Spatial Examples 1 1 What Is Oracle Spatial Oracle Spatial
388. ms an entire layer of geometries that is all geometries in a specified column in a table a SDO_CS VALIDATE_WKT function Validates the well known text WKT description associated with a specified SRID a SDO_CS VIEWPORT_TRANSFORM function Transforms an optimized rectangle into a valid polygon for use with Spatial operators and functions Reference information about these functions and procedures is in Chapter 15 Support for additional functions and procedures is planned for future releases of Oracle Spatial 6 7 Notes and Restrictions with Coordinate Systems Support The following notes and restrictions apply to coordinate systems support in the current release of Spatial If you have geodetic data see also Section 6 2 for considerations guidelines and additional restrictions 6 7 1 Different Coordinate Systems for Geometries with Operators and Functions For Spatial operators described in Chapter 12 that take two geometries as input parameters if the geometries are based on different coordinate systems the query window the second geometry is transformed to the coordinate system of the first geometry before the operation is performed This transformation is a temporary internal operation performed by Spatial it does not affect any stored query window geometry For SDO_GEOM package geometry functions described in Chapter 13 that take two geometries as input parameters both geometries must be based on the same coordin
389. must be a two dimensional line or multiline geometry that is the SDO_GTYPE value must be 2002 or 2006 This function is not supported for LRS geometries To perform an aggregate concatenation of LRS geometric segments use the SDO_AGGR_LRS_CONCAT spatial aggregate function The input geometries must be line strings whose vertices are connected by straight line segments Circular arcs and compound line strings are not supported The topological relationship between the geometries in each pair of geometries to be concatenated must be DISJOINT or TOUCH and if the relationship is TOUCH the geometries must intersect only at two end points You can use the SDO_UTIL CONCAT_LINES function described in Chapter 19 to concatenate two line or multiline geometries An exception is raised if any input geometries are not line or multiline geometries or if not all input geometries are based on the same coordinate system The following example inserts two line string geometries in the COLA_MARKETS table and then returns the aggregate concatenation of these geometries The example uses the data definitions from Section 2 1 14 4 Oracle Spatial Users Guide and Reference SDO_AGGR_CONCAT_LINES First insert two line geometries INSERT INTO cola_markets VALUES 1001 line 1 SDO GEOMETRY 2002 NULL NULL SDO_ELEM_ INFO ARRAY 1 2 1 SDO ORDINATE ARRAY 1 1 5 1 INSERT INTO cola markets VALUES 1002 line 2 SDO GEOMETRY 2002 NULL N
390. must be exactly the same point as the first to close the polygon regardless of the tolerance value For example for a 4 sided polygon specify 5 points with point 5 the same as point 1 Polygon made up of a connected sequence of circular arcs that closes on itself The end point of the last arc is the same as the start point of the first arc Each circular arc is described using three coordinates the arc s start point any point on the arc and the arc s end point The coordinates for a point designating the end of one arc and the start of the next arc are not repeated For example five coordinates are used to describe a polygon made up of two connected circular arcs Points 1 2 and 3 define the first arc and points 3 4 and 5 define the second arc The coordinates for points 1 and 5 must be the same tolerance is not considered and point 3 is not repeated 2 12 Oracle Spatial Users Guide and Reference SDO_GEOMETRY Object Type Table 2 2 Cont Values and Semantics in SDO_ELEM_INFO ETYPE INTERPRETATION Meaning SDO_ SDO_ 1003 or 3 2003 1003 0r 4 2003 4 n gt 1 10050r n gt 1 2005 Rectangle type sometimes called optimized rectangle A bounding rectangle such that only two points the lower left and the upper right are required to describe it The rectangle type can be used with geodetic or non geodetic data However with geodetic data use this type only to create a query window not for storing object
391. n about the ROWID data type see Oracle Database SQL Reference GEOMETRY SDO_GEOMETRY Geometry object with coordinate values in the specified to_srid parameter coordinate system The following example transforms the geometries in the shape column in the COLA_MARKETS_CS table to a representation that uses SRID value 8199 The transformed geometries are stored in the newly created table named COLA_ MARKETS_CS_8199 This example uses the definitions from the example in Section 6 8 Transform the entire SHAPE layer and put results in the table named cola markets cs 8199 which the procedure will create CALL SDO_CS TRANSFORM_LAYER COLA MARKETS CS SHAPE COLA MARKETS CS 8199 8199 Example 6 5 in Section 6 8 includes a display of the geometry object coordinates in both tables COLA_MARKETS_CS and COLA_MARKETS_CS_8199 15 6 Oracle Spatial Users Guide and Reference SDO_CS VALIDATE_WKT SDO_CS VALIDATE_WKT Format Description Parameters Usage Notes Examples SDO_CS VALIDATE_WKT srid IN NUMBER RETURN VARCHAR2 Validates the well known text WKT description associated with a specified SRID srid The SRID of the coordinate system whose well known text WKT description is to be validated An entry for the specified value must exist in the MDSYS CS_SRS table described in Section 6 4 1 This function returns the string TRUE if the WKT description is valid If the WKT description is invalid thi
392. n be treated as a logical set of linear segments local coordinates Cartesian coordinates in a non Earth non georeferenced coordinate system longitude East west position of a point on the Earth defined as the angle between the plane of a reference meridian and the plane of a meridian passing through an arbitrary point Glossary 5 Glossary 6 measure The linear distance in the LRS measure dimension to a point measured from the start point for increasing values or end point for decreasing values of the geometric segment measure range The measure values at the start and end of a geometric segment minimum bounding rectangle MBR A single rectangle that minimally encloses a geometry or a collection of geometries multipolygon A polygon collection geometry in which rings must be grouped by polygon and the first ring of each polygon must be the exterior ring offset The perpendicular distance between a point along a geometric segment and the geometric segment Offsets are positive if the points are on the left side along the segment direction and are negative if they are on the right side Points are on a geometric segment if their offsets to the segment are zero polygon A class of spatial objects having a nonzero area and perimeter and representing a closed boundary region of uniform characteristics primary filter The operation that permits fast selection of candidate records to pass along to the sec
393. n the geometric segment for which to return the previous shape point point Point for which to return the previous shape point If point is not on geom_ segment the point on the geometric segment closest to the specified point is computed and the closest shape point before that point is returned dim_array Dimensional information array corresponding to geom_segment usually selected from one of the xxx_SDO_GEOM_METADATA views described in Section 2 4 If measure or point identifies the start point of the geometric segment a null value is returned An exception is raised if measure is not a valid value for geom_segment or if point is not a valid LRS point Contrast this function with SDO_LRS GET_NEXT_SHAPE_PT which returns the next shape point on a geometric segment after a specified measure value or LRS point The _3D format of this function SDO_LRS GET_PREV_SHAPE_PT_3D is available For information about _3D formats of LRS functions see Section 7 4 The following example returns the closest shape point to measure 14 and before measure 14 on the geometric segment representing Route 1 This example uses the definitions from the example in Section 7 7 SELECT SDO_LRS GET PREV SHAPE PT a route geometry 14 FROM lrs_ routes a WHERE a route id 1 SDO_LRS GET PREV SHAPE PT A ROUTE GEOMETRY 14 SDO_GTYPE SDO SRID SDO POINT X SDO GEOMETRY 3301 NULL NULL SDO ELEM INFO ARRAY 1 1 1 SDO ORDINATE ARRAY
394. nal 3D formats of LRS functions 7 10 TILED_AGGREGATES function 21 21 TILED_BINS function 21 24 TO_81X procedure use TO_ CURRENT instead 17 1 TO_CURRENT procedure 17 2 TO_GMLGEOMETRY function 19 35 tolerance 1 8 with LRS functions 7 20 TOUCH SDO_TOUCH operator 12 44 topological relationship 1 16 transactional insertion of spatial data 3 4 TRANSFORM function 15 2 TRANSFORM_LAYER procedure 15 5 table for transformed layer 15 6 transformation 6 3 TRANSLATE_MEASURE function 16 102 transportable tablespaces initializing spatial indexes 19 20 preparing for when using spatial indexes 19 25 tuning and performance information 1 22 for spatial operators 1 18 tuning subprograms 18 1 two tier query model 1 10 type zero 0 element 2 23 U unformatted addresses 5 2 union 13 39 unit of measurement MDSYS tables 2 32 UNIT_NAME column in SDO_ANGLE_UNITS table 6 12 in SDO_AREA_UNITS table 2 34 in SDO_DIST_UNITS table 2 33 upgrading instructions and issues A 1 Index 12 LRS data A 1 to current Spatial release 17 2 USER_SDO_GEOM_METADATA view 2 25 USER_SDO_INDEX_INFO view 2 28 USER_SDO_INDEX_METADATA view 2 29 user defined coordinate system 6 17 user defined data types embedding SDO_GEOMETRY objects in 9 1 9 6 UTFS character set NLS_LENGTH_SEMANTICS setting for spatial queries 4 9 utility subprograms 19 1 V VALID_GEOM_SEGMENT function 16 104 VALID_LRS_PT function 16 106 VALID_MEASURE
395. name ROUTE_GEOMETRY AND a route_ id 1 SDO_LRS GET MEASURE SDO_LRS PROJECT_PT A ROUTE GEOMETRY M DIMINFO SDO_GEOM Linear Referencing Subprograms 16 49 SDO_LRS GET_NEXT_SHAPE_PT SDO_LRS GET_NEXT_SHAPE_PT Format SDO_LRS GET_NEXT_SHAPE_PT geom_segment IN SDO_GEOMETRY measure IN NUMBER RETURN SDO_GEOMETRY or SDO_LRS GET_NEXT_SHAPE_PT geom_segment IN SDO_GEOMETRY dim_array IN SDO_DIM_ARRAY measure IN NUMBER RETURN SDO_GEOMETRY or SDO_LRS GET_NEXT_SHAPE_PT geom_segment IN SDO_GEOMETRY point IN SDO_GEOMETRY RETURN SDO_GEOMETRY or SDO_LRS GET_NEXT_SHAPE_PT geom_segment IN SDO_GEOMETRY dim_array IN SDO_DIM_ARRAY point IN SDO_GEOMETRY RETURN SDO_GEOMETRY Description Returns the next shape point on a geometric segment after a specified measure value or LRS point 16 50 Oracle Spatial Users Guide and Reference SDO_LRS GET_NEXT_SHAPE_PT Parameters Usage Notes Examples geom_segment Geometric segment measure Measure value on the geometric segment for which to return the next shape point point Point for which to return the next shape point If point is not on geom_segment the point on the geometric segment closest to the specified point is computed and the next shape point after that point is returned dim_array Dimensional information array corresponding to geom_segment usually selected from one of the xxx_SDO_GEOM_METADATA views described in Section 2 4
396. nananonononananononenoso 7 13 7 5 5 Concatenating Geometric Segments cccoconononcorncnononrnrornnnnnnononananananonannnnnonononarnrnnononcnoos 7 13 7 5 6 Scaling a Geometric Segment 0 cece se cessssessesesesesesesescsesssesesescseseseecscsssnseseeceees 7 15 7 5 7 Offsetting a Geometric Segment occcicicicononicnnnnnanononananananononononanonononononanononononananonononoso 7 16 7 5 8 Locating a Point on a Geometric Segle tenocococonononnnnncnnnnnnnnanannnonononnnnnononononcnnnnncncnoos 7 17 7 5 9 Projecting a Point onto a Geometric Segment ss sssessesterrssstsstsserreeresstsstseeseesteses 7 18 7 5 10 Converting LRS Geometries 0 ccccccccsecsceesesesseseecssnessseesesessesesesenssececssseseneeeseeseneeeses 7 19 7 6 Tolerance Values with LRS Functions cooococononcononononncnnccononnnonnconnnononnnonnonnconncnn non non ano ono 7 20 7 7 Example of ERS Functions ccococociononnononcnnononinnnnnnnonanancnnnononananononononanonononanananonononanananononenoso 7 21 Spatial Analysis and Mining 8 1 Spatial Information and Data Mining Applications cee ceeseeeeeeeecsnees 8 1 8 2 Spatial Binning for Detection of Regional Patterns cccccc ccc ee eeeeeeneeeneenees 8 4 8 3 Materializing Spatial Correlation c ccccccecese cesses cscseseeecscsseeseececesessnesesesesesenesecenens 8 5 8 4 Colocation MINING renerne pens tous E T E ando dios it 8 5 8 5 Spatial Cl ster g niinn r eiaa AEA EEA AR ARE Sai 8 6 8 6 Location Prospecting ss iss husun
397. nates Geodetic coordinates sometimes called geographic coordinates are angular coordinates longitude and latitude closely related to spherical polar coordinates and are defined relative to a particular Earth geodetic datum described in Section 6 1 6 For more information about geodetic coordinate system support see Section 6 2 6 1 4 Projected Coordinates Projected coordinates are planar Cartesian coordinates that result from performing a mathematical mapping from a point on the Earth s surface to a plane There are many such mathematical mappings each used for a particular purpose 6 1 5 Local Coordinates Local coordinates are Cartesian coordinates in a non Earth non georeferenced coordinate system Section 6 3 describes local coordinate system support in Spatial 6 1 6 Geodetic Datum A geodetic datum is a means of representing the figure of the Earth usually as an oblate ellipsoid of revolution that approximates the surface of the Earth locally or globally and is the reference for the system of geodetic coordinates 6 1 7 Authalic Sphere An authalic sphere is a sphere that has the same surface area as a particular oblate ellipsoid of revolution representing the figure of the Earth 6 2 Oracle Spatial User s Guide and Reference Geodetic Coordinate Support 6 1 8 Transformation Transformation is the conversion of coordinates from one coordinate system to another coordinate system If the coordinate syst
398. ncnnnnnnnonnncnonnnninnnnncinnncnns 2 12 Columns in the xxx_SDO_INDEX_INFO VieWS coccccoocccononccnnnnnncnnnnaninnnnanannnccnannncnnacens 2 29 Columns in the xxx_SDO_INDEX_METADATA VieWS cccccccnncnionnnconnnncnonacinananinanacess 2 30 Columns in an R Tree Spatial Index Data Table ooooonicicononionnnoninnnennnereraraarononss 2 32 Columns in the SDO_DIST_UNITS Table ocooccnnnnccinonccnoncnaninnncnannnonononcnnnnnncnnananinnnnnns 2 33 Columns in the SDO_AREA_UNITS Table ooocconnncccnoncccnonnnicinnnncinonaninancnonncccnnnncninanoss 2 34 Attributes for Formal Address Representation ococenoncnconononenennrnnnnenncnnnncnrrnrarnnnnnnnrnnnnnos 5 1 Match Modes for Geocoding OperatiOMS oocniconcnoononenenncncannnnnannrarannenonananonnnrorarnrnananaran nano 5 3 Match Codes for Geocoding Operati0MS oocencnoncncnnonenennnacannnnnannrannnnnnananonnnnn ra rarnnnonanan arcanos 5 4 Geocoded Address Error Message Interpretation ooccoconinonononncnnenanrnnnrnrnrancnnararonnos 5 5 SDO_GEO_ADDR Type Attributes cocociininnonnnnnonncananinonononananonononononononononcncnononcnconannoncnnoos 5 6 MDSYS CS SRS Tabl sia is ct ta adler hei haan dies 6 9 MDSYS SDO_ANGLE_UNITS Table ccccccccccccccssesseseesecssesesscssecseeecsecsecseeseesscseesseass 6 12 MDSYS SDO DATUMS Table sonst a a Es 6 13 MDSYS SDO_ELLIPSOIDS Table 0 cccccccccscsecssescsscssesseseesecsseseescesecsececssesaeceeseesecseeaeeaes 6 15 MDSYS SDO_PROJECTIONS Table oooonononinni
399. nd Reference Unit of Measurement Support geometries The unit parameter is not valid for geometries with a null SDO_SRID value that is an orthogonal Cartesian system For information about support for coordinate systems see Chapter 6 The default unit of measure is the one associated with the georeferenced coordinate system The unit of measure for most coordinate systems is the meter and in these cases the default unit for distances is meter and the default unit for areas is square meter By using the unit parameter however you can have Spatial automatically convert and return results that are more meaningful to application users for example displaying the distance to a restaurant in miles The unit parameter must be enclosed in single quotation marks and contain the string unit and a valid SDO_UNIT value from the MDSYS SDO_DIST_UNITS or MDSYS SDO_AREA_UNITS table For example unit KM in the following example using data and definitions from Example 6 4 in Section 6 8 specifies kilometers as the unit of measurement SELECT c name SDO GEOM SDO LENGTH c shape m diminfo unit KM FROM cola_markets_cs c user_sdo geom metadata m WHERE m table name COLA MARKETS CS AND m column_name SHAPE Spatial uses the information in the MDSYS SDO_DIST_UNITS and MDSYS SDO_ AREA_UNITS tables to determine which unit names are valid and what ratios to use in comparing or converting between different units The MDSYS SDO_DIST_UNITS
400. nd must not be a spatial column Only range partitioning is supported on the underlying table Hash and composite partitioning are not currently supported for partitioned spatial indexes To create a partitioned spatial index you must specify the LOCAL keyword For example CREATE INDEX counties idx ON counties geometry INDEXTYPE IS MDSYS SPATIAL INDEX LOCAL In this example the default values are used for the number and placement of index partitions namely Index partitioning is based on the underlying table partitioning For each table partition a corresponding index partition is created a Each index partition is placed in the default tablespace If you do specify parameters for individual partitions the following considerations apply a The storage characteristics for each partition can be the same or different for each partition If they are different it may enable parallel I O if the tablespaces are on different disks and may improve performance a The sdo_indx_dims value must be the same for all partitions a The layer_gtype parameter value see Section 4 1 4 used for each partition may be different To override the default partitioning values use a CREATE INDEX statement with the following general format CREATE INDEX lt indexname gt ON lt table gt lt column gt INDEXTYPE IS MDSYS SPATIAL INDEX PARAMETERS lt spatial params gt lt storage params gt LOCAL PARTITION lt index partition
401. ndary of one object is on the boundary of the other object and the second object covers the first object This relationship occurs for example when a line is on the boundary of a polygon ANYINTERACT The objects are non disjoint Figure 1 6 illustrates these topological relationships 1 16 Oracle Spatial Users Guide and Reference Spatial Relationships and Filtering Figure 1 6 Topological Relationships A CONTAINSB A COVERS B A TOUCH B B INSIDE A B COVEREDBY A B TOUCH A A OVERLAPBDYINTERSECT B A OVERLAPBDYDISJOINT B B OVERLAPBDYINTERSECT A B OVERLAPBDYDISJOINT A A EQUAL B A DISJOINT B BONA B EQUAL A B DISJOINT A A COVERS B 2 polygons with identical coordinates The SDO_WITHIN_DISTANCE operator determines if two spatial objects A and B are within a specified distance of one another This operator first constructs a distance buffer D around the reference object B It then checks that A and D are non disjoint The distance buffer of an object consists of all points within the given distance from that object Figure 1 7 shows the distance buffers for a point a line and a polygon Figure 1 7 Distance Buffers for Points Lines and Polygons wm ee es Seem eee ee In the point line and polygon geometries shown in Figure 1 7 The dashed lines represent distance buffers Notice how the buffer is rounded near the corners of the objects Spatial Concepts 1 17 Spatial Operators Procedures and Functi
402. nding to geom2 usually selected from one of the xxx_SDO_GEOM_METADATA views described in Section 2 4 tol Tolerance value see Section 1 5 5 In Figure 13 2 the shaded area represents the polygon returned when SDO_ DIFFERENCE is used with a square geom1 and another polygon geom2 Figure 13 2 SDO_GEOM SDO_DIFFERENCE geom1 If the function format with tol is used all geometry objects must be defined using 4 digit SDO_GTYPE values explained in Section 2 2 1 An exception is raised if geom1 and geom2 are based on different coordinate systems The following example returns a geometry object that is the topological difference MINUS operation of cola_aand cola_c The example uses the definitions and data from Section 2 1 Return the topological difference of two geometries SELECT SDO_GEOM SDO_DIFFERENCE c_a shape m diminfo c_c shape m diminfo FROM cola_markets c_a cola_markets c_c user sdo geom metadata m WHERE m table name COLA MARKETS AND m column_name SHAPE AND c_a name cola_a AND c_c name cola_c SDO_GEOM SDO DIFFERENCE C_A SHAPE M DIMINFO C_C SHAPE M DIMINFO SDO_GTYPE SDO_ 13 22 Oracle Spatial User s Guide and Reference SDO_GEOM SDO_DIFFERENCE Related Topics SDO GEOMETRY 2003 NULL NULL SDO ELEM INFO ARRAY 1 1003 1 SDO ORDINATE ARR AV A D dy Sy de Sy Bp arar 4 5 Sy Sy Sr OT Ly 7 Note that in the returned polygon the SDO_ORDINATE_ARRAY starts and ends at the sam
403. ndition that includes the operator should be an expression of the form SDO WITHIN DISTANCE argl arg2 distance lt some_dist_val gt TRUE The geometry column must have a spatial index built on it If the data is geodetic the spatial index must be an R tree index SDO_WITHIN_DISTANCE is not supported for spatial joins See Section 4 2 1 3 for a discussion on how to perform a spatial join within distance operation The following example selects the GID values from the POLYGONS table where the GEOMETRY column object is within 10 distance units of the geometry stored in the aGeom variable SELECT A GID Spatial Operators 12 47 SDO_WITHIN_DISTANCE Related Topics FROM POLYGONS A WHERE SDO WITHIN DISTANCE A Geometry aGeom distance 10 TRUE The following example selects the GID values from the POLYGONS table where the GEOMETRY column object is within 10 distance units of the specified rectangle having the lower left coordinates x1 y1 and the upper right coordinates x2 y2 SELECT A GID FROM POLYGONS A WHERE SDO WITHIN DISTANCE A Geometry sdo geometry 2003 NULL NULL sdo elem_info array 1 1003 3 sdo ordinate array x1 y1 x2 y2 distance 10 TRUE The following example selects the GID values from the POLYGONS table where the GID value in the QUERY_POINTS table is 1 and a POLYGONS GEOMETRY object is within 10 distance units of the QUERY_POINTS GEOMETRY object SELECT A GID FROM POLYGON
404. ne or a point the interior ring disappears from is not included in the resulting geometry a Topological characteristics of the input geometry might not be maintained after simplification For a collection geometry individual elements that did not overlap before simplification might now overlap If overlapping of elements occurs in a multipolygon the geometry is invalid because Open GIS Consortium rules state that polygon elements may not overlap in a multipolygon Under certain conditions single polygon geometries might also become invalid The following example simplifies the road shown in Figure 7 20 in Section 7 7 Because the threshold value 6 is fairly large given the input geometry the resulting LRS line string has only three points the start and end points and 12 4 12 The measure values in the returned geometry are not meaningful because this function considers only two dimensions SELECT SDO_UTIL SIMPLIFY SDO_GEOMETRY 3302 line string 3 dimensions X Y M 3rd is linear ref dimension NULL 19 32 Oracle Spatial User s Guide and Reference SDO_UTIL SIMPLIFY NULL SDO ELEM INFO ARRAY 1 2 1 one line string straight segments SDO ORDINATE ARRAY 2 20 Starting point Exitl 0 is measure from start 2 4 2 Exit2 2 is measure from start 8 4 8 Exit3 8 is measure from start 12 4 12 Exit4 12 is measure from start 12 10 NULL Not an exit measure automatically calculated and
405. nfo 8199 FROM cola_markets_cs c user_sdo_geom metadata m WHERE m table name COLA MARKETS CS AND m column_name SHAPE AND c name cola_c Same as preceding but using to_srname parameter 6 24 Oracle Spatial Users Guide and Reference Example of Coordinate System Transformation SELECT c name SDO_CS TRANSFORM c shape m diminfo Longitude Latitude Arc 1950 FROM cola_markets_cs c user_sdo_geom metadata m WHERE m table name COLA MARKETS CS AND m column_name SHAPE AND c name cola_c Transform the entire SHAPE layer and put results in the table named cola_markets_cs_8199 which the procedure will create CALL SDO_CS TRANSFORM LAYER COLA MARKETS CS SHAPE COLA MARKETS CS __ 8199 8199 Select all from the old existing table SELECT from cola markets cs Select all from the new layer transformed table SELECT from cola_markets_cs_ 8199 Show metadata for the new layer transformed table DESCRIBE cola markets cs 8199 Use a geodetic MBR with SDO FILTER SELECT c name FROM cola_markets _cs c WHERE SDO FILTER c shape SDO_GEOMETRY 2003 8307 SRID for WGS 84 longitude latitude NULL SDO ELEM INFO ARRAY 1 1003 3 SDO ORDINATE ARRAY 6 5 10 10 TRUE Example 6 5 shows the output of the SELECT statements in Example 6 4 Notice the slight differences between the coordinates in the original geometries SRID 8307 and the transformed coordinat
406. nformation about coordinate systems and Chapter 15 for reference information about coordinate system transformation subprograms MBRs Supported with Geodetic Data XXXIV 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 a SDO_GEOM SDO_MBR SDO_GEOM SDO_MIN_MBR_ORDINATE and SDO_GEOM SDO_MAX_MBR_ORDINATE described in Chapter 13 a 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 New 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
407. nformation about projecting a point onto a geometric segment see Section 7 5 9 16 82 Oracle Spatial User s Guide and Reference SDO_LRS PROJECT_PT Examples The following example returns the point 9 4 9 on the geometric segment representing Route 1 that is closest to the specified point 9 3 NULL This example uses the definitions from the example in Section 7 7 Point 9 3 NULL is off the road should return 9 4 9 SELECT SDO_LRS PROJECT PT route geometry SDO GEOMETRY 3301 NULL NULL SDO_ELEM_INFO ARRAY 1 1 1 SDO ORDINATE ARRAY 9 3 NULL FROM lrs_ routes WHERE route_id 1 SDO_LRS PROJECT PT ROUTE GEOMETRY SDO GEOMETRY 3301 NULL NULL SDO EL SDO GEOMETRY 3301 NULL NULL SDO ELEM INFO ARRAY 1 1 1 SDO ORDINATE ARRAY 9 4 9 Linear Referencing Subprograms 16 83 SDO_LRS REDEFINE_GEOM_SEGMENT SDO_LRS REDEFINE_GEOM_SEGMENT Format SDO_LRS REDEFINE_GEOM_SEGMENT geom_segment IN OUT SDO_GEOMETRY start_measure IN NUMBER end_measure IN NUMBER or SDO_LRS REDEFINE_GEOM_SEGMENT geom_segment IN OUT SDO_GEOMETRY dim_array IN SDO_DIM_ARRAY start_measure IN NUMBER end_measure IN NUMBER Description Populates the measures of all shape points based on the start and end measures of a geometric segment overriding any previously assigned measures between the start point and end point Parameters geom_segment Cartographic representation of a linear feature dim_arra
408. nformatted addresses are described in Section 5 1 1 The SDO_KEYWORDARRAY type is defined as follows CREATE TYPE sdo_keywordarray AS VARRAY 10000 OF VARCHAR2 9000 5 3 Using the Geocoding Capabilities To use the Oracle Spatial geocoding capabilities you must use data provided by a geocoding vendor and the data must be in the format supported by the Oracle Spatial geocoding feature For information about getting and loading this data go to the Spatial page of the Oracle Technology Network OTN http otn oracle com products spatial Find the link for geocoding and follow the instructions Geocoding Address Data 5 9 Using the Geocoding Capabilities To geocode an address using the geocoding data use the SDO_GCDR PL SQL package subprograms which are documented in Chapter 20 a TheSDO_GCDR GEOCODE function geocodes an unformatted address to return an SDO_GEO_ADDR object a TheSDO_GCDR GEOCODE_AS_GEOMETRY function geocodes an unformatted address to return an SDO_GEOMETRY object a TheSDO_GCDR GEOCODE_ALL function geocodes all addresses associated with an unformatted address and returns the result as an SDO_ADDR_ARRAY object an array of address objects 5 10 Oracle Spatial User s Guide and Reference 6 Coordinate Systems Spatial Reference Systems This chapter describes in greater detail the Oracle Spatial coordinate system support which was introduced in Section 1 5 4 You can store and manipu
409. ng spatial data to A 1 Oracle Locator See Locator OVERLAPBDYDISJOINT SDO_OVERLAPBDYDISJOINT operator 12 33 topological relationship 1 16 OVERLAPBDYINTERSECT SDO_OVERLAPBDYINTERSECT operator 12 35 topological relationship 1 16 OVERLAPS SDO_OVERLAPS operator 12 37 P parallel execution for index creation and rebuilding 10 3 10 7 10 12 partitioned spatial index 4 5 exchanging partitions 4 7 PERCENTAGE _TO_MEASURE function 16 79 performance and tuning information 1 22 for Spatial operators 1 18 PL SQL and SQL examples 1 24 point data 1 6 illustration and examples of point only geometry 2 21 locating on geometric segment 7 17 LRS 7 7 on surface of polygon 13 37 projection of onto geometric segment 7 7 7 18 shape 7 3 POINT_AT_BEARING function 19 21 polygon areaof 13 11 boundary of 1 15 buffer 13 13 centroid 13 17 compound 2 13 exterior and interior rings 2 10 2 16 2 17 point on surface 13 37 self crossing not supported 1 5 Index 7 polygon collection 2 17 polygon data 1 6 POLYGONTOLINE function 19 23 populating measure 7 5 PREPARE_FOR_TTS procedure 19 25 primary filter 1 10 4 11 4 12 primitive types 1 4 problems in current release 6 20 geodetic data 6 6 PROJECT_PT function 16 81 projected coordinates 1 7 6 2 projection 7 7 map 6 16 point onto geometric segment 7 18 PROJECT_PT function 16 81 Q quadtree indexes deprecated feature of Spatial 1 12 q
410. ng_lat_pt longitude latitude indextype is mdsys spatial index Perform queries on the data In the following example the two queries accomplish the same thing however the first query does not use a user defined function instead using a constructor to specify the point whereas the second query uses the function to specify the point Extending Spatial Indexing Capabilities 9 5 SDO_GEOMETRY Objects in Function Based Indexes First query call sdo filter with an SDO GEOMETRY constructor select name from LONG LAT TABLE a where sdo filter get_long_lat_pt a longitude a latitude sdo_geometry 2001 8307 sdo point _type 10 10 NULL NULL NULL TRUE Second query call sdo filter with the function that returns an sdo_geometry select name from LONG LAT TABLE a where sdo filter get_long_lat_pt a longitude a latitude get_long lat pt 10 10 TRUE 9 2 2 Example Function with a User Defined Object Type In the following example the input parameter to the function used for the function based index is an object of a user defined type that includes the longitude and latitude Assume that you want to create a function that returns the longitude and latitude of a point and to create a spatial index on that function First create the user defined data type as in the following example that creates an object type named LONG_ LAT and its member function GetGeometry create type long lat as object longitude number
411. nit of measurement associated with the arc_tolerance value For example arc_tolerance 0 05 unit km The arc_tolerance keyword specifies for each arc in the geometry the maximum length of the perpendicular line between the surface of the arc and the straight line between the start and end points of the arc Figure 13 1 shows a line whose length is the arc_tolerance value for the arc between points A and B Figure 13 1 Arc Tolerance arc_tolerance B The arc_tolerance keyword value must be greater than or equal to the tolerance value associated with the geometry As you increase the arc_tolerance keyword value the resulting polygon has fewer sides and a smaller area as you decrease the arc_tolerance keyword value the resulting polygon has more sides and a larger area but never larger than the original geometry If the unit keyword is specified the value must be an SDO_UNIT value from the MDSYS SDO_DIST_UNITS table for example unit KM If the unit keyword is not specified the unit of measurement associated with the geometry is used See Section 2 6 for more information about unit of measurement specification If the function format with tol is used all geometry objects must be defined using 4 digit SDO_GTYPE values explained in Section 2 2 1 Geometry Subprograms 13 9 SDO_GEOM SDO_ARC_DENSIFY Examples The following example returns the geometry that results from the arc densification of cola_d whic
412. nnnocinnnnononanannnonononananonononanononononononanonononanananonenos xxxvii NewSchema MDDATA aaa de lo dll elena A a cities xxxviii Complex Query Examples srie ieee e e aaraa r eaaa a T EEEE ieSe eii xxxviii Part Conceptual and Usage Information Spatial Concepts 1 1 What Is Oracle Spatial liinda joto iia ia a bic a 1 2 1 2 Obj ct Relational Modelist esio eee iea titi 1 2 1 3 Introduction to Spatial Data ooinnnncncnnnnnnoninnnnninononcncnanononcnconanannrorocononncnrocononannon rn coronan 1 3 1 4 Geometry AAA TO 1 4 1 5 Data Modelo A ica 1 5 1 5 1 Element aia rada tibadss 1 6 1 5 2 OOO Void ici a a Ab AR Da atadas ci 1 6 1 5 3 EN AAA I E A Riis EE E EEEE 1 6 1 5 4 Coordinate Systems morra a e Ep Toe eE OS E A EEE E A dando ciao 1 6 1 5 5 Tolerance in ida ld aa arae a E a ia 1 8 1 5 5 1 Tolerance in the Geometry Metadata for a Lay OT oooniicicononinnoninnnononiciraronononoso 1 8 1 5 5 2 Tolerance as an Input Parameter coocococicncininononcnnoninnnnnonananananononon anar anonorananononenoso 1 10 1 6 Query Modelado tiaie desteettadedertsttedls 1 10 1 7 Indexing of Spatial Data coco cee cesss Sess esse aeae e aan eb ds 1 12 1 7 1 R Tree Index cono lit lt ia base ia E dt id 1 12 1 7 2 R Tree Quality issenensis a iuei niisiis 1 14 1 8 Spatial Relationships and Filtering ooconocicnononnoninnnnnnnoncnnoninnononcnnonannnononan arco onononananononanoso 1 14 es Ko 10 10 1 11 12 13 14 15 16 17 18 A b b o
413. ns 180 180 90 90 1 8307 ORDER BY id SDO GEOMETRY 2003 8307 NULL SDO ELEM INFO ARRAY 1 1003 3 SDO ORDINATE ARR AY 180 90 0 0 1 SDO GEOMETRY 2003 8307 NULL SDO ELEM INFO ARRAY 1 1003 3 SDO ORDINATE ARR AY 180 0 0 90 2 SDO GEOMETRY 2003 8307 NULL SDO ELEM INFO ARRAY 1 1003 3 SDO ORDINATE ARR AY 0 90 180 0 3 SDO GEOMETRY 2003 8307 NULL SDO ELEM INFO ARRAY 1 1003 3 SDO ORDINATE ARR AY 0 0 180 90 4 rows selected Spatial Analysis and Mining Subprograms 21 25 SDO_SAM TILED_BINS 21 26 Oracle Spatial Users Guide and Reference Part III Supplementary 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 III contains the following Appendix A Installation Compatibility and Upgrade Appendix B Oracle Locator Appendix C Complex Spatial Queries Examples Glossary A Installation Compatibility and Upgrade If you are upgrading to Oracle Database 10g Oracle Spatial is automatically upgraded as part of the operation For information about the upgrade procedure see Oracle Database Upgrade Guide If you have LRS data in release 8 1 5 8 1 6 or 8 1 7 format see Section A 1 A 1 Upgrading
414. nsionality if m_pos is less than 3 or greater than 4 or if start_measure or end_measure is out of range The _3D format of this function SDO_LRS CONVERT_TO_LRS_GEOM_3D is available however the m_pos parameter is not available for SDO_LRS CONVERT_ TO_LRS_GEOM_3D For information about _3D formats of LRS functions see Section 7 4 For more information about conversion functions see Section 7 5 10 The following example converts the geometric segment representing Route 1 to LRS format This example uses the definitions from the example in Section 7 7 SELECT SDO_LRS CONVERT_TO LRS GEOM a route geometry m diminfo FROM lrs_ routes a user_sdo_geom_metadata m Linear Referencing Subprograms 16 17 SDO_LRS CONVERT_TO_LRS_GEOM WHERE m table name LRS ROUTES AND m column_name ROUTE GEOMETRY AND a route_id 1 SDO_LRS CONVERT TO LRS GEOM A ROUTE GEOMETRY M DIMINFO SDO_GTYPE SDO SRID SDO SDO GEOMETRY 3002 NULL NULL SDO ELEM INFO ARRAY 1 2 1 SDO ORDINATE ARRAY 2 2 0 2 4 2 8 4 8 12 4 12 12 10 NULL 8 10 22 5 14 27 16 18 Oracle Spatial User s Guide and Reference SDO_LRS CONVERT_TO_LRS_LAYER SDO_LRS CONVERT_TO_LRS_LAYER Format Description SDO_LRS CONVERT_TO_LRS_LAYER table_name IN VARCHAR2 column_name IN VARCHAR2 lower_bound IN NUMBER upper_bound IN NUMBER tolerance IN NUMBER RETURN VARCHAR2 or SDO_LRS CONVERT_TO_LRS_LAYER table_name IN VARCHAR2
415. nt ets 4 1 4 1 1 Creating R Tree Indexes its it ives ia de a taa 4 1 4 1 2 Indexing Geodetic Data iia 4 3 4 1 3 Improving Performance with Bulk Insert Operations coocncicinnninnnnnnnnnnnicconennanincnnos 4 3 4 1 4 Constraining Data to a Geometry Type cococicoccncconconnonocnnanarinnnnarorennnncnanarannonararanirannnnes 4 4 4 1 5 Creating a Cross Schema Index ccccccsseseccsescsesesescscsesesesescseseseecscsssnsesescsesssnseecsees 4 5 4 1 6 Using Partitioned Spatial Indexes oncnconinnninicnnonicnoncncnonconenoriononcnnononcononinno rin conicnans 4 5 4 1 7 Exchanging Partitions Including Indexes onnncncnnnonnnincninnnnononnnnonconororonninno ronca nicnanos 4 7 4 1 8 Export and Import Considerations with Spatial Indexes and Data ccce 4 8 4 2 Querying Spatial Data cionado titan dicas raar aaee laa lo acelera Det 4 9 4 2 1 PADUA A AA vests 4 9 4 2 1 1 Primary Filter Operator mn aii 4 11 4 2 1 2 Primary and Secondary Filter Operator ococococicicinonicanannonaninononananononononananonononoos 4 12 4 2 1 3 Within Distance Operator nviiiiimcnnin indias 4 14 4 2 1 4 Nearest Neighbor Operator scicc iccscsicesessscesssissevesavesssevesaueccussenoneavboversnsssnsseeeeeote 4 15 4 2 1 5 Spatial Functions ssatina e db weaned 4 16 4 2 2 Spatial AAA TAO 4 16 4 2 3 Cross Schema Operator Invocation cococonoionononnennononiononanacinananonanonan cn cnononananonononoso 4 17 Geocoding Address Data 5 1 Concepts tor Geocoding ste cet
416. nt instance of a geometry Specified using a bind variable or SDO_GEOMETRY constructor Data type is SDO_GEOMETRY The expression SDO_OVERLAPS geometry1 geometry2 TRUE evaluates to TRUE for object pairs that have the OVERLAPBDYDISJOINT or OVERLAPBDYINTERSECT topological relationship and FALSE otherwise See the Usage Notes for the SDO_RELATE operator in this chapter For an explanation of the topological relationships and the nine intersection model used by Spatial see Section 1 8 Spatial Operators 12 37 SDO_OVERLAPS Examples The following example finds geometries that overlap a query window here a rectangle with lower left upper right coordinates 4 6 8 8 The example uses the definitions and data described in Section 2 1 and illustrated in Figure 2 1 In this example three of the geometries in the SHAPE column overlap the query window geometry SELECT c mkt_id c name FROM cola_markets c WHERE SDO_OVERLAPS c shape SDO GEOMETRY 2003 NULL NULL SDO_ELEM_ INFO ARRAY 1 1003 3 SDO ORDINATE ARRAY 4 6 8 8 TRUE MKT ID NAME 2 cola_b 1 cola a 4 cola d 12 38 Oracle Spatial User s Guide and Reference SDO_RELATE SDO_RELATE Format SDO_RELATE geometry1 geometry2 param Description Uses the spatial index to identify either the spatial objects that have a particular spatial interaction with a given object such as an area of interest or pairs of spatial objects that hav
417. nterval Number of bin insert operations to perform before Spatial performs an internal commit operation If commit_interval is not specified a commit is performed after every 20 insert operations This procedure computes the most intersecting tile for each geometry in a specified layer using the bins in bin_tablename The bin ID value for each geometry is added in bin_id_colname The following example assigns each GEOMETRY column location and corresponding row in the POLY_4PT_TEMP data mining table to a spatial bin and performs an internal commit operation after each bin table insertion CALL SDO SAM BIN LAYER POLY 4PT TEMP GEOMETRY BINTBL GEOMETRY BIN_ ID 1 Spatial Analysis and Mining Subprograms 21 11 SDO_SAM COLOCATED_REFERENCE_FEATURES SDO_SAM COLOCATED_REFERENCE_FEATURES Format Description Parameters SDO_SAM COLOCATED_REFERENCE_FEATURES theme_tablename IN VARCHAR2 theme_colname IN VARCHAR2 theme_predicate IN VARCHAR2 tablename IN VARCHARZ2 colname IN VARCHARZ2 ref_predicate IN VARCHAR2 dst_spec IN VARCHAR2 result_tablename IN VARCHAR2 commit_interval IN NUMBER DEFAULT 100 Performs a partial predicate based join of tables and materializes the join results into a table theme_tablename Name of the table with which to join tablename theme_colname Name of the geometry column in theme_tablename theme_predicate Qualifying WHERE clause predicate to be applied to theme_ta
418. ntion on ranges will work distance Number of meters from start_ point and along the initial bearing direction to the computed destination point Must be less than one half the circumference of the Earth The input point geometry must be based on a geodetic coordinate system If it is based on a non geodetic coordinate system this function returns a null value To convert decimal degrees to radians or nonmetric distances to meters you can use the SDO_UTIL CONVERT_UNIT function Spatial Utility Subprograms 19 21 SDO_UTIL POINT_AT_BEARING Examples The following example returns the point 100 kilometers at a bearing of 1 radian from the point with the longitude and latitude coordinates 72 43 SELECT SDO_UTIL POINT AT BEARING SDO GEOMETRY 2001 8307 SDO_ POINT TYPE 72 43 NULL NULL NULL 1 1 radian 57 296 degrees clockwise from North 100000 100 kilometers FROM DUAL SDO_UTIL POINT AT BEARING SDO GEOMETRY 2001 8307 SDO POINT TYPE 72 43 NULL NUL SDO GEOMETRY 2001 8307 NULL SDO ELEM INFO ARRAY 1 1 1 SDO ORDINATE ARRAY 70 957053 43 4811935 Related Topics a SDO_UTIL CONVERT_UNIT 19 22 Oracle Spatial User s Guide and Reference SDO_UTIL POLYGONTOLINE SDO_UTIL POLYGONTOLINE Format Description Parameters Usage Notes Examples SDO_UTIL POLYGONTOLINE geometry IN SDO_GEOMETRY RETURN SDO_GEOMETRY Converts all polygon type elements in a geometry to line ty
419. number of geometries 4 Point geometries o 0 Curvestring geometries 0 0 Polygon geometries 4 100 Complex geometries o 0 18 10 Oracle Spatial User s Guide and Reference SDO_TUNE QUALITY_DEGRADATION SDO_TUNE QUALITY_DEGRADATION Format Description Parameters Usage Notes SDO_TUNE QUALITY_DEGRADATION schemaname IN VARCHAR2 indexname IN VARCHAR2 RETURN NUMBER Returns the quality degradation for an index or the average quality degradation for all index tables for an index schemaname Name of the schema that contains the index specified in indexname indexname Name of the spatial R tree index The quality degradation is a number indicating approximately how much longer it will take to execute the I O operations of the index portion of any given query with the current index compared to executing the I O operations of the index portion of the same query when the index was created or most recently rebuilt For example if the I O operations of the index portion of a typical query will probably take twice as much time as when the index was created or rebuilt the quality degradation is 2 The exact degradation in overall query time is impossible to predict however a substantial quality degradation 2 or 3 or higher can affect query performance significantly for large databases such as those with millions of rows Index names are available through the xxx_SDO_INDEX_INFO and xxx_SDO_ INDEX_METAD
420. o which Clay Street extends SELECT SDO_GCDR GEOCODE ALL SCOTT SDO_KEYWORDARRAY Clay St San Francisco CA US DEFAULT FROM DUAL SDO_GCDR GEOCODE ALL SCOTT SDO_KEYWORDARRAY CLAYST SANFRANCISCO CA US SDO_ADDR ARRAY SDO GEO ADDR 1 SDO KEYWORDARRAY NULL CLAY ST NULL NULL SAN FRANCISCO NULL CA US 94108 NULL 94108 NULL 978 CLAY ST F F NULL NULL L 0 23600689 nul ENUT B281CP 1 DEFAULT 122 40904 37 79385 SDO GEO ADDR 1 SDO KEYWORDARRAY NULL CLAY ST NULL NULL SAN FRANCISCO NULL CA US 94115 NULL 94115 NULL 27 98 CLAY ST F F NULL NULL L 0 23600709 nul fENUT B281CP 1 DEFAULT 122 43909 37 79007 SDO GEO ADDR 1 SDO KEYWORDARRAY NULL CLAY ST NULL NULL SAN FRANCISCO NULL CA US 94118 NULL 9411 8 NULL 3698 CLAY ST F F NULL NULL L 0 23600718 nul HENUT B281CP 1 DEFAULT 122 45372 37 78822 SDO GEO ADDR 1 SDO KEYWORD ARRAY NULL CLAY ST NULL NULL SAN FRANCISCO NULL CA US 94109 NULL 94109 NULL 1698 CLAY ST F F NULL NULL L 0 23 600700 nul RENUT B281CP 1 DEFAULT 122 42093 37 79236 Geocoding Subprograms 20 5 SDO_GCDR GEOCODE_AS_GEOMETRY SDO_GCDR GEOCODE_AS GEOMETRY Format Description Parameters Usage Notes Examples SDO_GCDR GEOCODE_AS_GEOMETRY username IN
421. ococoisondanranco contenida iia 12 33 SDO OVERLAPBDYINTERSECT Prerana daci n codicia iii baratos 12 35 SDO OVERLADS A A A AE a 12 37 SDOGRELA TE EE E AEI EE TEE EE ao 12 39 SDO TOU Hindi a e E A A E EEC 12 44 SDO WITHIN DISTANCE Escorial do dd Aid A 12 46 13 Geometry Subprograms SDO GEOM RELATE marameng niaior a ES ed Es 13 4 SDPO GEOM SDO AR DENSITY oreren eae an eaer AAA E K AR O N EGEA 13 8 SDOLGEOM SPO AREA cui A E E EE AE E KEE 13 11 SDO_ GEOM SDO BUFFER cocina a a e a id 13 13 SDO GEOM 5DO CENTROID cintia tia aia 13 17 SDO GEOM SDO CONVEXHULE rriei E E TEE 13 19 SDO GEOM SDO DIFFERENCE enne a i a A 13 21 SDO GEOM SPO DIS TANG Eceso rot erar r E A S ANS 13 24 SDO_GEOM SDO_INTERSECTION iin rie erT nE N E GS 13 26 SDO_ GEOM SDOALENGT initial a a a E ide 13 29 SDO_GEOM SDO_MAX_MBR_ORDINATE cococcnincnnoninnninnnncnnnnnnnononnoncnnononnnnonnncnnnnos 13 31 SDO GEOM SDO MBR iii elia ti iaa A A AAA E AAA 13 33 SDO_GEOM SDO_MIN_MBR_ORDINATE cconicnninnnnoninnoncnnninnnonononcnnononnnncnnononnncnninos 13 35 SDO_GEOM SDO_POINTONSURFACE serier ene taerae EA EEE riS 13 37 SDOiAGEOM SDOLZUNION Wisse sect eens ia e eien E E EREN E 13 39 SHO GE OM SIO KOR race es SS AA 13 42 SDO_GEOM VALIDATE_GEOMETRY sscssssssssssesssssssesssessesssscssssssessesssesssesseseessseeses 13 45 SDO_GEOM VALIDATE_GEOMETRY_WITH_CONTEXT ssesscsssesssesssesseessesseesse 13 47 SIO BOM ALIA TE SAY oc factories AAA A Rn aes 13 50 SDO_
422. oconcnonnnccncnnnncnnnnannrnrannncnnanannnnos 4 13 5 1 Geocoding Returning Address Object and Specific Attributes onoconcocoonenennnnnnnnnonrnos 5 8 6 1 Using a Geodeta MBR votarlas 6 4 6 2 Creating a User Defined Projected Coordinate System ccccccccseesteteeseseeteteseeens 6 19 6 3 Creating a User Defined Geodetic Coordinate System moococononincononnnnnnnncnnrrnrarnnennnnnass 6 19 6 4 Simplified Example of Coordinate System Transformation cccc cece eee 6 22 6 5 Output of SELECT Statements in Coordinate System Transformation Example 6 25 7 1 Including LRS Measure Dimension in Spatial Metadata cococnenionmmmmn 7 8 7 2 Simplified Example Highway coin ia a iii 7 23 7 3 Simplified Example Output of SELECT Statements cee cece nesses 7 28 C 1 Finding All Cities Within a Distance of a Highway cococicicinicicicinnonnnninconononinnincnnincnnnnnans C 2 C 2 Finding All Highways Within a Distance of a City eee secrete cnc arananacnononns C 3 C 3 Finding the Cities Nearest to a High Way coccocioniioninonnnnnnnncnanonanonononocononac ano no nono nrrnconananinns C 4 C 4 Finding the Cities Above a Specified Population Nearest to a Highway uccnioono C 5 C 5 Performing Aggregate Union of All Counties in Texas oncncininnonininnaninnnnnnanananacnanincnnos C 6 xvi List of Figures PO PO PO PO MP NDND A AH AH AH A de a NANODABKRWNHANDOAHKRWN KET TEDT aAa N 7 6 7 7 7 8 7 9 7 10 7 11 7 12
423. of 2007 might contain three elements polygons ring Number of the subelement ring within element 1 for the first subelement 2 for the second subelement and so on This parameter is valid only for specifying a subelement of a polygon with one or more holes or of a point cluster a Fora polygon with holes its first subelement is its exterior ring its second subelement is its first interior ring its third subelement is its second interior ring and so on For example in the polygon with a hole shown in Figure 2 3 in Section 2 3 2 the exterior ring is subelement 1 and the interior ring the hole is subelement 2 Spatial Utility Subprograms 19 13 SDO_UTIL EXTRACT Usage Notes Examples a For a point cluster its first subelement is the first point in the point cluster its second subelement is the second point in the point cluster and so on The default is 0 which causes the entire element to be extracted This function is useful for extracting a specific element or subelement from a complex geometry For example if you have identified a geometry as invalid by using the SDO_GEOM VALIDATE_GEOMETRY_WITH_CONTEXT function or the SDO_GEOM VALIDATE_LAYER_WITH_CONTEXT procedure both of which are documented in Chapter 13 you can use the EXTRACT function to extract the invalid geometry in order to examine it For a polygon with one or more holes the returned geometry representing an extracted interior ring is reoriente
424. of Coordinate System Transformation cccccccceccsesesesseneteesceeesesesssneeiens 6 21 Linear Referencing System 7 1 Terms nd CONCEP tS en ienee bras El levee scene eras ci ious a a 7 2 7 1 1 Geometric Segments LRS Segment concnnicncnnnnnonincnonononcncncnonononononconoro nono cnorarnrncnnos 7 2 7 1 2 A seis ses shes ida O EA 7 3 7 1 3 Direction of a Geometric Segment occ ec cee eee eee cece ronca nino non nono nnane ronca ricino 7 3 7 1 4 Measure Linear Messi io 7 4 7 1 5 Osea ca A io 7 4 7 1 6 Measure Populatid variadas 7 5 7 1 7 Measure Range of a Geometric Segment cccocononnonononaninononononananononononanononononananonononanono 7 7 7 1 8 Projection AAA A A A eran Eria 7 7 7 1 9 INS EEEE dad tees E pods ceca Sep tue Seale E ces lot ac tee ese seevessead AON 7 7 7 1 10 Linear Features ini anita 7 7 7 2 ERS Data Model sic ssh0ccs te enti ad as IS 7 8 7 3 Tnid xinig Of LRS Data sssi lit ida dd ia ai ais 7 9 7 4 3D Formats of LRS FUNC ONS sc ii tt e ii daba 7 10 7 5 HAIR O TETONAS 7 11 7 5 1 Defining a Geometric Segment occococincnononennnnananannnononononanononononononononononononon cono narnnnnoos 7 11 7 5 2 Redefining a Geometric Segle t cocociciconononinnonnnnonnononanancncnonononannncnononanononononananononenoso 7 12 7 5 3 Clipping a Geometric Segment ccicocociccnononennonanannnanonononananononononanononononanononononananonononoos 7 12 7 5 4 Splitting a Geometric Segment ocococociononnononcnnononinnnnnonananononononananononono
425. of the segment resulting from the concatenation is the same as in the two original segments Measure assignments for the clipping splitting and concatenating operations in Figure 7 10 are shown in Figure 7 11 Measure information and segment direction are preserved in a consistent manner The assignment is done automatically when the operations have completed Figure 7 11 Measure Assignment in Geometric Segment Operations MoO MER M M hs l M 0 l l a M 100 M 100 Segment 1 50 l l dio E Segment 100 q M 70 a Segment Splitting b Segment Clipping Second Segment Measure M 0 M 0 Shifted By 20 te a Segment 1 M 3 Segment 2 M 80 M 100 Continuous Measures for Segment Concatenation c Segment Concatenation The direction of the geometric segment resulting from concatenation is always the direction of the first segment geom_segment1 in the call to the SDO_ LRS CONCATENATE_GEOM_SEGMENTS function as shown in Figure 7 12 7 14 Oracle Spatial Users Guide and Reference LRS Operations Figure 7 12 Segment Direction with Concatenation Directions of Segments Concatenate Direction of Resulting Segment Always Same as First Segment m A m ee EO Ia OO os gt ne q q A eee eS geom_segmenti geom_segment2 In addition to explicitly concatenating two connected segments using the SDO_ LRS CONCATENATE_GEOM_SEGMENTS function you can perform aggregate concatenation that
426. often referred to as Spatial provides a SQL schema and functions that facilitate the storage retrieval update and query of collections of spatial features in an Oracle database Spatial consists of the following components a A schema MDSYS that prescribes the storage syntax and semantics of supported geometric data types A spatial indexing mechanism a A set of operators and functions for performing area of interest queries spatial join queries and other spatial analysis operations Administrative utilities The spatial component of a spatial feature is the geometric representation of its shape in some coordinate space This is referred to as its geometry Caution Do not modify any packages tables or other objects under the MDSYS schema The only exception is if you need to create a user defined coordinate system as explained in Section 6 5 1 2 Object Relational Model 1 2 Spatial supports the object relational model for representing geometries The object relational model uses a table with a single column of SDO_GEOMETRY and a single row per geometry instance The object relational model corresponds to a SOL with Geometry Types implementation of spatial feature tables in the Open GIS ODBC SQL specification for geospatial features 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
427. om the Geometry Type column of Table 2 1 in Section 2 2 1 For example to constrain spatial data in a layer to polygons CREATE INDEX cola_spatial_idx ON cola_markets shape INDEXTYPE IS MDSYS SPATIAL INDEX PARAMETERS layer_gtype POLYGON The geometry types in Table 2 1 are considered as a hierarchy when data is checked The MULTI forms include the regular form also For example specifying layer_gtype MULTIPOINT allows the layer to include both POINT and MULTIPOINT geometries a COLLECTION allows the layer to include all types of geometries 4 4 Oracle Spatial User s Guide and Reference Creating a Spatial Index 4 1 5 Creating a Cross Schema Index You can create a spatial index on a table that is not in your schema Assume that user B wants to create a spatial index on column GEOMETRY in table T1 under user A s schema User B must perform the following steps 1 Connect as user A or have user A connect and execute the following statement GRANT select index on T1 to B Connect as user B and execute a statement such as the following CREATE INDEX t1 spatial idx on A T1 geometry INDEXTYPE IS mdsys spatial index 4 1 6 Using Partitioned Spatial Indexes You can create a partitioned spatial index on a partitioned table This section describes usage considerations specific to Oracle Spatial For a detailed explanation of partitioned tables and partitioned indexes see Oracle Database Administrator s G
428. ome Spatial data types are described in locations other than this section a Section 5 2 describes data types for geocoding Oracle Spatial GeoRaster describes data types for Oracle Spatial GeoRaster 2 6 Oracle Spatial User s Guide and Reference SDO_GEOMETRY Object Type a Oracle Spatial Topology and Network Data Models describes data types for the Oracle Spatial topology data model and network data model 2 2 1 SDO_GTYPE The SDO_GTYPE attribute indicates the type of the geometry Valid geometry types correspond to those specified in the Geometry Object Model for the OGIS Simple Features for SQL specification with the exception of Surfaces The numeric values differ from those given in the OGIS specification but there is a direct correspondence between the names and semantics where applicable The SDO_GTYPE value is 4 digits in the format dltt where a didentifies the number of dimensions 2 3 or 4 a identifies the linear referencing measure dimension for a three dimensional linear referencing system LRS geometry that is which dimension 3 or 4 contains the measure value For a non LRS geometry or to accept the Spatial default of the last dimension as the measure for an LRS geometry specify 0 For information about the linear referencing system LRS see Chapter 7 tt identifies the geometry type 00 through 07 with 08 through 99 reserved for future use Table 2 1 shows the valid SDO_GTYPE values The Geometry
429. ometries include any polygons that are so narrow at any point that the distance between facing sides is less than the proposed tolerance value Be sure that the tolerance value is less than the shortest distance between any two sides in any polygon Moreover if you encounter invalid geometry errors with inserted or updated geometries and if the geometries are in fact valid consider increasing the precision of the tolerance value for example changing 0 00005 to 0 000005 1 5 5 2 Tolerance as an Input Parameter Many Spatial functions accept a tolerance parameter which if specified overrides the default tolerance value for the layer explained in Section 1 5 5 1 If the distance between two points is less than or equal to the tolerance value Spatial considers the two points to be a single point Thus tolerance is usually a reflection of how accurate or precise users perceive their spatial data to be For example assume that you want to know which restaurants are within 5 kilometers of your house Assume also that Maria s Pizzeria is 5 1 kilometers from your house If the spatial data has a geodetic coordinate system and if you ask Find all restaurants within 5 kilometers and use a tolerance of 100 or greater such as 500 Maria s Pizzeria will be included because 5 1 kilometers 5100 meters is within 100 meters of 5 kilometers 5000 meters However if you specify a tolerance less than 100 such as 50 Maria s Pizzer
430. ometry Specified using a bind variable or SDO_GEOMETRY constructor Data type is SDO_GEOMETRY Returns The expression SDO_INSIDE geometry1 geometry2 TRUE evaluates to TRUE for object pairs that have the INSIDE topological relationship and FALSE otherwise Usage Notes See the Usage Notes for the SDO_RELATE operator in this chapter For an explanation of the topological relationships and the nine intersection model used by Spatial see Section 1 8 Spatial Operators 12 17 SDO_INSIDE Examples The following example finds geometries that have the INSIDE relationship with a query window here a rectangle with lower left upper right coordinates 5 6 12 12 The example uses the definitions and data described in Section 2 1 and illustrated in Figure 2 1 In this example only cola_d the circle is inside the query window geometry SELECT c mkt_id c name FROM cola markets c WHERE SDO_INSIDE c shape SDO GEOMETRY 2003 NULL NULL SDO_ ELEM INFO ARRAY 1 1003 3 SDO_ORDINATE ARRAY 5 6 12 12 TRUE MKT ID NAME 4 colad 12 18 Oracle Spatial User s Guide and Reference SDO_JOIN SDO_JOIN Format SDO_JOIN table_name1 column_namel table_name2 column_name2 params preserve_join_order RETURN SDO_ROWIDSET Description Performs a spatial join based on one or more topological relationships Keywords and Parameters Value Description table_namel column_namel table_n
431. ometry 9 0 FROM lrs_ routes WHERE route_id 1 Example 7 3 shows the output of the SELECT statements in Example 7 2 Example 7 3 Simplified Example Output of SELECT Statements SQL gt First display the data in the LRS table SQL gt SELECT route_id route_name route geometry FROM lrs routes ROUTE ID ROUTE NAME 1 Routel SDO GEOMETRY 3302 NULL NULL SDO ELEM INFO ARRAY 1 2 1 SDO ORDINATE ARRAY 2 2 0 2 4 2 8 4 8 12 4 12 12 10 18 8 10 22 5 14 27 11 result_geom_1 SDO GEOMETRY 3302 NULL NULL SDO ELEM INFO ARRAY 1 2 1 SDO ORDINATE ARRAY 2 2 0 2 4 2 5 4 5 12 result_geom_2 ROUTE ID ROUTE NAME SDO GEOMETRY 3302 NULL NULL SDO ELEM INFO ARRAY 1 2 1 SDO ORDINATE ARRAY 5 4 5 8 4 8 12 4 12 12 10 18 8 10 22 5 14 27 13 result_geom_ 3 SDO GEOMETRY 3302 NULL NULL SDO ELEM INFO ARRAY 1 2 1 SDO ORDINATE ARRAY 2 2r Oy 2 44 2 By 4 5 By 4 8 12 4 12 12 10 18 8 10 22 5 14 27 7 28 Oracle Spatial Users Guide and Reference Example of LRS Functions SQL gt Are result_geom_1 and result_geom2 connected SQL gt SELECT SDO_LRS CONNECTED GEOM SEGMENTS a route_ geometry 2 b route geometry 0 005 3 FROM lrs_ routes a lrs routes b 4 WHERE a route_id 11 AND b route_id 12 SDO_LRS CONNECTED GEOM SEGMENTS A ROUTE GEOMETRY B ROUTE GEOMETRY 0 005 SQL gt Is the Routel segment valid SQL gt SELECT SDO LRS VALID GEOM
432. ometry If you use 4 digit SDO_ETYPE values you must use 4 digit SDO_GTYPE values SDO_ETYPE values 4 1005 and 2005 are considered compound elements They contain at least one header triplet with a series of triplet values that belong to the compound element For SDO_ETYPE values 1005 and 2005 the first digit indicates exterior 1 or interior 2 1005 exterior polygon ring must be specified in counterclockwise order 2005 interior polygon ring must be specified in clockwise order Note The use of 5 as an SDO_ETYPE value for polygon ring elements in a single geometry is discouraged You should specify 5 only if you do not know if the compound polygon is exterior or interior and you should then upgrade the table or layer to the current format using the SDO_MIGRATE TO_CURRENT procedure described in Chapter 17 You cannot mix 1 digit and 4 digit SDO_ETYPE values in a single geometry If you use 4 digit SDO_ETYPE values you must use 4 digit SDO_GTYPE values 2 10 Oracle Spatial Users Guide and Reference SDO_GEOMETRY Object Type The elements of a compound element are contiguous The last point of a subelement in a compound element is the first point of the next subelement The point is not repeated a SDO_INTERPRETATION Means one of two things depending on whether or not SDO_ETYPE is a compound element If SDO_ETYPE is a compound element 4 1005 or 2005 this field specifies how many subsequent t
433. ometry is valid except as follows Ifcommit_interval is not specified or if the commit_interval value is greater than the number of geometries in the layer and no invalid geometries are found a single row with a RESULT value of DONE is written a If commit_interval is specified and if no invalid geometries are found between an internal commit and the previous internal commit or start of validation for the first internal commit a single row with the primary key of the last geometry validated and a RESULT value of DONE is written If there have been no invalid geometries since the last internal commit operation this row replaces the previous row that had a result of DONE In each row for an invalid geometry the SDO_ROWID column contains the ROWID value of the row containing the invalid geometry and the RESULT column contains an Oracle error message number and the context of the error the coordinate edge or ring that causes the geometry to be invalid You can then look up the error message for more information about the cause of the failure This procedure performs the following checks on each geometry in the layer geom_column All type consistency and geometry consistency checks that are performed by the SDO_GEOM VALIDATE_GEOMETRY_WITH_CONTEXT function see the Usage Notes for that function a If 4 digit SDO_GTYPE values are used the geometry s SDO_GTYPE specifies the same dimensionality as specified in the applicable D
434. on off the road such as a building Guard rail or fence alongside a road SDO_LRS OFFSET_GEOM_SEGMENT function Example 7 2 does the following a Creates a table to hold the segment Inserts the definition of the highway into the table a Inserts the necessary metadata into the USER_SDO_GEOM_METADATA view Uses PL SQL and SQL statements to define the segment and perform Operations on it Example 7 3 includes the output of the SELECT statements in Example 7 2 Example 7 2 Simplified Example Highway Create a table for routes highways CREATE TABLE lrs_ routes route id NUMBER PRIMARY KEY route name VARCHAR2 32 route geometry SDO GEOMETRY Populate table with just one route for this example INSERT INTO lrs_ routes VALUES 1 Routel SDO_GEOMETRY 3302 line string 3 dimensions X Y M NULL NULL SDO ELEM INFO ARRAY 1 2 1 one line string straight segments SDO ORDINATE ARRAY 2 2 0 Start point Exitl 0 is measure from start Linear Referencing System 7 23 Example of LRS Functions 2 452 Exit2 2 is measure from start 8 4 8 Exit3 8 is measure from start 12 4 12 Exit4 12 is measure from start 12 10 NULL Not an exit measure automatically calculated and filled 8 10 22 Exit5 22 is measure from start 5 14 27 End point Exit6 27 is measure from start i Update the Spatial metadata INSERT INTO USER _SDO_GEOM METADATA VALUES
435. on and m denotes the measure with each measure value underlined in Figure 7 1 7 2 Oracle Spatial User s Guide and Reference Terms and Concepts Figure 7 1 Geometric Segment Line Segments End Point 55 20 60 950 Start Point 5 10 Q 30 10 26 991 50 15 53 879 4 OY i Y 15 5 11 180 40 5 38 171 z Sw Y TE O e o ee ee Segment Direction 7 1 2 Shape Points Shape points are points that are specified when an LRS segment is constructed and that are assigned measure information In Oracle Spatial a line segment is represented by its start and end points and an arc is represented by three points start middle and end points of the arc You must specify these points as shape points but you can also specify other points as shape points if you need measure information stored for these points for example an exit in the middle of a straight part of the highway Thus shape points can serve one or both of the following purposes to indicate the direction of the segment for example a turn or curve and to identify a point of interest for which measure information is to be stored Shape points might not directly relate to mileposts or reference posts in LRS they are used as internal reference points The measure information of shape points is automatically populated when you define the LRS segment using the SDO_ LRS DEFINE_GEOM_SEGMENT procedure which is described in Chap
436. ondary filter The primary filter compares geometry approximations to reduce computation complexity and is considered a lower cost filter Because the primary filter compares geometric approximations it returns a superset of the exact result set See also secondary filter and two tier query model projected coordinates Planar Cartesian coordinates that result from performing a mathematical mapping from a point on the Earth s surface to a plane There are many such mathematical mappings each used for a particular purpose projection The point on the LRS geometric segment with the minimum distance to the specified point proximity A measure of distance between objects query A set of conditions or questions that form the basis for the retrieval of information from a database query window Area within which the retrieval of spatial information and related attributes is performed RDBMS See Relational Database Management System RDBMS recursion A process function or routine that executes continuously until a specified condition is met region An extent or area of multidimensional space Relational Database Management System RDBMS A computer program designed to store and retrieve shared data In a relational system data is stored in tables consisting of one or more rows each containing the same set of columns Oracle Database is an object relational database management system Other types of database systems are
437. ons The geometry on the right is a polygon with a hole the large rectangle is the exterior polygon ring and the small rectangle is the interior polygon ring the hole The dashed line outside the large rectangle is the buffer for the exterior ring and the dashed line inside the small rectangle is the buffer for the interior ring The SDO_NN operator returns a specified number of objects from a geometry column that are closest to a specified geometry for example the five closest restaurants to a city park In determining how close two geometry objects are the shortest possible distance between any two points on the surface of each object is used 1 9 Spatial Operators Procedures and Functions The Spatial PL SQL application programming interface API includes several operators and many procedures and functions Spatial operators such as SDO_FILTER and SDO_RELATE provide optimum performance because they use the spatial index Spatial operators require that the geometry column in the first parameter have a spatial index defined on it Spatial operators must be used in the WHERE clause of a query The first parameter of any operator specifies the geometry column to be searched and the second parameter specifies a query window If the query window does not have the same coordinate system as the geometry column Spatial performs an implicit coordinate system transformation For detailed information about the spatial operators se
438. onsistency constraints Spatial does check the following a For SDO_GTYPE values 4001 and 4005 any subelement not of SDO_ETYPE 1 is ignored a For SDO_GTYPE values 4002 and 4006 any subelement not of SDO_ETYPE 2 or 4 is ignored a For SDO_GTYPE values 4003 and 4007 any subelement not of SDO_ETYPE 3 or 5 is ignored This includes SDO_ETYPE variants 1003 2003 1005 and 2005 which are explained in Section 2 2 4 The SDO_GEOM VALIDATE_GEOMETRY_WITH_CONTEXT function can be used to evaluate the consistency of a single geometry object or of all geometry objects in a specified feature table 2 3 Geometry Examples This section contains examples of several geometry types 2 3 1 Rectangle Figure 2 2 illustrates the rectangle that represents cola_a in the example in Section 2 1 2 14 Oracle Spatial Users Guide and Reference Geometry Examples Figure 2 2 Rectangle 1 7 5 7 1 1 5 1 In the SDO_GEOMETRY definition of the geometry illustrated in Figure 2 2 a SDO_GTYPE 2003 The 2 indicates two dimensional and the 3 indicates a polygon a SDO_SRID NULL a SDO_POINT NULL SDO_ELEM_INFO 1 1003 3 The final 3 in 1 1003 3 indicates that this is a rectangle Because it is a rectangle only two ordinates are specified in SDO_ ORDINATES lower left and upper right a SDO_ORDINATES 1 1 5 7 These identify the lower left and upper right ordinates of the rectangle Example 2 2 shows a SQL st
439. opulation and the distance in miles for each city ordered by distance in miles Example C 4 Finding the Cities Above a Specified Population Nearest to a Highway SELECT ORDERED NO_INDEX c pop90 idx c city pop90 sdo nn distance 1 distance_in miles FROM geod_interstates i geod_cities c WHERE i highway 1170 AND sdo_nn c location i geom sdo batch _size 10 unit mile 1 TRUE AND c pop90 gt 300000 AND rownum lt 6 ORDER BY distance_in miles In Example C 4 because the ORDERED optimizer hint is used it is important to have an index on the GEOD_INTERSTATES HIGHWAY column In this example the hint forces the query to locate highway 1170 before it tries to find nearest neighbor geometries To ensure correct results disable all nonspatial indexes on columns that come from the same table as the SDO_NN search column geomet ry1 In this example the NO_INDEX c pop90_idx optimizer hint disables the nonspatial index on the POP90 column In the WHERE clause of this example a sdo batch _size 10 causes geometries to be returned continually in distance order in batches of 10 geometries to be checked to see if they satisfy the other conditions in the WHERE clause Complex Spatial Queries Examples C 5 SDO_AGGR_UNION Example c pop90 gt 300000 restricts the results to rows where the POP90 column value is greater than 300000 rownum lt 6 limits the number of results returned to five In Exampl
440. or events to locations or portions of a linear feature It has been widely used in transportation applications such as for highways railroads and transit routes and utilities applications such as for gas and oil pipelines The major advantage of linear referencing is its capability of locating attributes and events along a linear feature with only one parameter usually known as measure instead of two such as longitude latitude or x y in Cartesian space Sections of a linear feature can be referenced and created dynamically by indicating the start and end locations along the feature without explicitly storing them The linear referencing system LRS application programming interface API in Oracle Spatial provides server side LRS capabilities at the cartographic level The linear measure information is directly integrated into the Oracle Spatial geometry structure The Oracle Spatial LRS API provides support for dynamic segmentation and it serves as a groundwork for third party or middle tier application development for virtually any linear referencing methods and models in any coordinate systems For an example of LRS see Section 7 7 However you may want to read the rest of this chapter first to understand the concepts that the example illustrates For reference information about LRS functions and procedures see Chapter 16 If you have LRS data from a previous release of Spatial see Section A 1 for information about upgrading LRS
441. or binning discretizing data into regions such as categorizing data into northern southern eastern and western regions for materializing the influence of neighborhood such as number of customers within a two mile radius of each store and for identifying colocated data items such as video rental stores and pizza restaurants To perform spatial data mining you materialize spatial predicates and relationships for a set of spatial data using thematic layers Each layer contains data about a specific kind of spatial data that is having a specific theme for example parks and recreation areas or demographic income data The spatial materialization could be performed as a preprocessing step before the application of data mining techniques or it could be performed as an intermediate step in spatial mining as shown in Figure 8 1 8 2 Oracle Spatial User s Guide and Reference Spatial Information and Data Mining Applications Figure 8 1 Spatial Mining and Oracle Data Mining Spatial Mining ODM Spatial engine Original data Spatial Mining Spatial thematic Functions data layers Materialized data spatial binning proximity colocation materialization ODM engine Mining results Notes on Figure 8 1 The original data which included spatial and nonspatial data is processed to produce materialized data Spatial data in the original data is processed by spatial mining functions to produce materialized data
442. orted The following is a list of the supported subset Specifies the tablespace in which the index data table is created Same as TABLESPACE in the STORAGE clause of a CREATE TABLE statement Is the same as INITIAL in the STORAGE clause of a CREATE TABLE statement Is the same as NEXT in the STORAGE clause of a CREATE TABLE statement Is the same as MINEXTENTS in the STORAGE clause of a CREATE TABLE statement Is the same as MAXEXTENTS in the STORAGE clause of a CREATE TABLE statement Is the same as PCTINCREASE in the STORAGE clause of a CREATE TABLE statement Controls whether serial execution NOPARALLEL or parallel PARALLEL execution is used for the rebuilding of the index and for subsequent queries and DML operations that use the index For parallel execution you can specify an integer value of degree of parallelism See the Usage Notes for the CREATE INDEX statement for guidelines and restrictions that apply to the use of the PARALLEL keyword Default NOPARALLEL If PARALLEL is specified without an integer value the Oracle database calculates the optimum degree of parallelism Prerequisites You must have EXECUTE privileges on the index type and its implementation type The spatial index to be altered is not marked in progress SQL Statements for Indexing Spatial Data 10 7 ALTER INDEX REBUILD Usage Notes Examples Related Topics An ALTER INDEX REBUILD rebuild_params statement rebuil
443. ot be defined as an interior polygon ring within the interior polygon ring of the lake In a multipolygon polygon collection rings must be grouped by polygon and the first ring of each polygon must be the exterior ring For example consider a polygon collection that contains two polygons A and B Spatial Data Types and Metadata 2 17 Geometry Examples a Polygon A one interior hole exterior ring AO interior ring A1 a Polygon B two interior holes exterior ring BO interior ring B1 interior ring B2 The elements in SDO_ELEM_INFO and SDO_ORDINATES must be in one of the following orders depending on whether you specify Polygon A or Polygon B first a AO A1 BO B1 B2 a BO B1 B2 AO Al 2 3 3 Compound Line String Figure 2 4 illustrates a crescent shaped object represented as a compound line string made up of one straight line segment and one circular arc Four points are required to represent this shape points 10 10 and 10 14 describe the straight line segment and points 10 14 6 10 and 14 10 describe the circular arc Figure 2 4 Compound Line String 10 14 0 1234 5 6 7 8 9 10 1112 1314 15 In the SDO_GEOMETRY definition of the geometry illustrated in Figure 2 4 2 18 Oracle Spatial Users Guide and Reference Geometry Examples a SDO_GTYPE 2002 The first 2 indicates two dimensional and the second 2 indicates one or more line segments a SDO_SRID NULL a SDO_POINT NULL
444. ot supported if spatial index is defined on the table 4 9 deferred index updates 10 2 DEFINE_GEOM_SEGMENT procedure 16 28 defining geometric segment 7 11 densification of arcs 13 8 difference 13 21 dimension in SDO_GTYPE 2 7 2 8 GET_DIMS method 11 2 GET_LRS_DIM method 11 4 DIMINFO in USER_SDO_GEOM_ METADATA 2 27 direction of geometric segment 7 3 concatenation result 7 14 discretization binning spatial 8 4 See also bins DISJOINT topological relationship 1 16 disk storage requirements for spatial applications 1 23 distance SDO_NN_DISTANCE ancillary operator 12 29 WITHIN_DISTANCE function 13 56 distance units 2 33 Douglas Peucker algorithm for geometry simplification 19 31 DROP INDEX statement 10 15 duplicate vertices removing 19 27 dynamic query window 4 10 DYNAMIC_SEGMENT function 16 31 E editing geometric segments subprograms for 16 1 ELEM_INFO SDO_ELEM_INFO attribute 2 9 elements 1 6 extracting from a geometry 19 13 returning number of elements in a geometry 19 16 returning number of vertices in a geometry 19 17 ellipse creating polygon approximating 19 11 ELLIPSE_POLYGON function 19 11 ellipsoids 6 15 embedded SDO_GEOMETRY object in user defined type 9 1 EQUAL SDO_EQUAL operator 12 11 topological relationship 1 16 error messages geocoding 5 5 Spatial 1 23 ESTIMATE_RTREE_INDEX_SIZE function 18 4 ETYPE SDO_ETYPE value 2 10 2 11 examples C 1 23
445. oted string containing a distance value and optionally a unit value See the Usage Notes for an explanation of the format and meaning For each geometry in tablename this function identifies the geometries in the theme_name table finds their intersection ratio multiplies the specified aggregate using this intersection ratio and aggregates it for each geometry in tablename Specifically for all rows of the theme_name table it returns the value from the following function aggr type string aggr_col string proportional area of intersection geometry theme_name theme_colname This function returns an object of type SDO_REGAGGRSET The SDO_ REGAGGRSET object type is defined as TABLE OF SDO_REGAGGR The SDO_REGAGGR object type is defined as Name Null Type REGION ID VARCHAR2 24 GEOMETRY MDSYS SDO_ GEOMETRY AGGREGATE VALUE NUMBER The theme_colname column must have a spatial index defined on it For best performance insert simplified geometries into this column The dst_spec parameter if specified is a quoted string that must contain the distance keyword and that may contain the unit keyword to identify the unit of measurement associated with the distance value For example distance 2 unit km If the unit keyword is specified the value must be an SDO_UNIT value from the MDSYS SDO_DIST_UNITS table for example unit KM If the unit keyword is not specified the unit of measurement associated with the geometry is used
446. ous shape point on a geometric segment before a specified measure value or LRS point Returns the measure value of the previous shape point on a geometric segment before a specified measure value or LRS point Checks if an LRS segment is defined correctly Checks if the measure values along an LRS segment are decreasing that is descending in numerical value Checks if the measure values along an LRS segment are increasing that is ascending in numerical value Checks if a specified measure value is a shape point on a geometric segment Returns the measure range of a geometric segment that is the difference between the start measure and end measure Returns the percentage 0 to 100 that a specified measure is of the measure range of a geometric segment Returns the measure value of a specified percentage 0 to 100 of the measure range of a geometric segment Returns the point located at a specified distance from the start of a geometric segment Returns the projection point of a specified point The projection point is on the geometric segment Linear Referencing Subprograms 16 3 Table 16 2 Cont Subprograms for Querying and Validating Geometric Segments Subprogram Description SDO_LRS FIND_LRS_DIM_POS SDO_LRS FIND_MEASURE SDO_LRS FIND_OFFSET SDO_LRS VALIDATE_LRS_GEOMETRY Returns the position of the measure dimension within the SDO_DIM_ARRAY structure for a specified SDO_GEOMETRY co
447. outel 16 100 Oracle Spatial User s Guide and Reference SDO_LRS SPLIT_GEOM_SEGMENT Split Routel into two segments SDO_LRS SPLIT_GEOM SEGMENT line string dim_array 5 result_geom_1 result_geom_2 Concatenate the segments that were just split result_geom_3 SDO_LRS CONCATENATE_GEOM SEGMENTS result_geom_1 dim _ array result_geom_2 dim_array Insert geometries into table to display later INSERT INTO lrs_ routes VALUES 11 result_geom 1 result_geom_1 i INSERT INTO lrs_ routes VALUES 12 result_geom_2 result_geom_2 i INSERT INTO lrs_ routes VALUES 13 result_geom 3 result_geom_3 i END Linear Referencing Subprograms 16 101 SDO_LRS TRANSLATE_MEASURE SDO_LRS TRANSLATE_MEASURE Format SDO_LRS TRANSLATE_MEASURE geom_segment IN SDO_GEOMETRY translate_m IN NUMBER RETURN SDO_GEOMETRY or SDO_LRS TRANSLATE_MEASURE geom_segment IN SDO_GEOMETRY dim_array IN SDO_DIM_ARRAY translate_m IN NUMBER RETURN SDO_GEOMETRY Description Returns a new geometric segment by translating the original geometric segment that is shifting the start and end measures by a specified value Parameters geom_segment Cartographic representation of a linear feature dim_array Dimensional information array corresponding to geom_segment usually selected from one of the xxx_SDO_GEOM_METADATA views described in Section 2 4 translate_m Distance measured from the st
448. ow instead of specifying the window parameters in the query itself Example 4 2 Primary Filter with a Transient Instance of the Query Window SELECT A Feature_ID FROM TARGET A WHERE sdo filter A shape theWindow TRUE Example 4 3 assumes the query window was inserted into a table called WINDOWS with an ID of WINS_1 Example 4 3 Primary Filter with a Stored Query Window SELECT A Feature_ID FROM TARGET A WINDOWS B WHERE B ID WINS 1 AND sdo filter A shape B shape TRUE If the B SHAPE column is not spatially indexed the SDO_FILTER operator indexes the query window in memory and performance is very good If the B SHAPE column is spatially indexed with the same SDO_LEVEL value as the A SHAPE column the SDO_FILTER operator reuses the existing index and performance is very good or better If the B SHAPE column is spatially indexed with a different SDO_LEVEL value than the A SHAPE column the SDO_FILTER operator reindexes B SHAPE in the same way as if there were no index on the column originally and then performance is very good 4 2 1 2 Primary and Secondary Filter Operator The SDO_RELATE operator described in Chapter 12 performs both the primary and secondary filter stages when processing a query The secondary filter ensures that only candidate objects that actually interact are selected This operator can be used only if a spatial index has been created on two dimensions of data The syntax of the SDO_RELATE opera
449. patial User s Guide and Reference information is provided In the United States the postal code is the 5 digit ZIP code Data Types for Geocoding Table 5 5 Cont SDO_GEO_ADDR Type Attributes Attribute Data Type Description PostalAddOnCode VARCHAR2 20 String appended to the postal code In the United States the postal add on code is typically the last four numbers of a 9 digit ZIP code specified in 5 4 format FullPostalCode VARCHAR2 20 Full postal code including the postal code and postal add on code POBox VARCHAR2 100 Post Office box number HouseNumber VARCHAR2 100 House or building number Example 123 in 123 MAIN ST BaseName VARCHAR2 200 Base name of the street Example MAIN in 123 MAIN ST StreetType VARCHAR2 20 Type of the street Example ST in 123 MAIN ST StreetTypeBefore VARCHAR2 1 Not used StreetTypeAttached VARCHAR2 1 Not used StreetPrefix VARCHAR2 20 Prefix for the street Example S in 123 S MAIN ST StreetSuffix VARCHAR2 20 Suffix for the street Example NE in 123 MAIN ST NE Side VARCHAR2 1 Side of the street L for left or R for right that the house is on when you are traveling from lower to higher numbered addresses Percent NUMBER Number from 0 to 1 multiply by 100 to get a percentage value indicating how far along the street you are when traveling from lower to higher numbered addresses EdgeID NUMBER Edge ID of the road segment ErrorMessage VARCHAR2 20 Error message
450. patial geometry table db_block_size Database block size in bytes sdo_rtr_pctfree Minimum percentage of slots in each index tree node to be left empty when the index is created Slots that are left empty can be filled later when new data is inserted into the table The value can range from 0 to 50 The default value 10 is best for most applications however a value of 0 is recommended if no updates will be performed to the geometry column num_dimensions Number of dimensions to be indexed The default value is 2 If you plan to specify the sdo_indx_dims parameter in the CREATE INDEX statement the num_ dimensions value should match the sdo_indx_dims value is_geodetic A value indicating whether or not the spatial index will be a geodetic index 1 for a geodetic index or 0 the default for a non geodetic index Section 4 1 2 explains geodetic indexes The function returns the estimated maximum number of megabytes needed for the spatial index table described in Section 2 5 2 for an R tree spatial index to be created The value returned is the maximum number of megabytes needed after index creation During index creation approximately three times this value of megabytes will be needed in the tablespace to ensure that there is enough space for temporary tables while the index is being created This function has two formats a Use the format with character string parameters schemaname tabname colname and optionally partna
451. pe elements and sets the SDO_GTYPE value accordingly geometry Geometry to convert The order of the vertices of each resulting line type element is the same as in the associated polygon type element and the start and end points of each line type segment are the same point If the input geometry is a line it is returned The following example converts the input polygon geometry which is the same geometry as cola_b see Figure 2 1 and Example 2 1 in Section 2 1 to a line string geometry In the returned geometry the SDO_GTYPE value 2002 indicates a two dimensional LINE geometry and the SDO_ETYPE value 2 and SDO_ INTERPRETATION value 1 in the SDO_ELEM_INFO array indicate a line string whose vertices are connected by straight line segments SELECT SDO_UTIL POLYGONTOLINE SDO_GEOMETRY 2003 two dimensional polygon NULL NULL SDO ELEM INFO ARRAY 1 1003 1 one polygon exterior polygon ring Spatial Utility Subprograms 19 23 SDO_UTIL POLYGONTOLINE SDO ORDINATE ARRAY 5 1 8 1 8 6 5 7 5 1 FROM DUAL SDO_UTIL POLYGONTOLINE SDO_GEOMETRY 2003 TWO DIMENSIONALPOLYGONNULL NULL SDO_E SDO GEOMETRY 2002 NULL NULL SDO ELEM INFO ARRAY 1 2 1 SDO ORDINATE ARRAY 551 8 1 876 5 75 552 Related Topics None 19 24 Oracle Spatial User s Guide and Reference SDO_UTIL PREPARE_FOR_TTS SDO_UTIL PREPARE_FOR_TTS Format Description Parameters Usage Notes Examples SDO_
452. plete 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 XXV Xxvi Chapter 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 Il 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
453. present a construction zone This example uses the definitions from the example in Section 7 7 SELECT SDO LRS DYNAMIC SEGMENT route geometry 5 10 FROM lrs_ routes WHERE route id 1 SDO_LRS DYNAMIC SEGMENT ROUTE GEOMETRY 5 10 SDO_GTYPE SDO_SRID SDO POINT X Y SDO_GEOMETRY 3302 NULL NULL SDO ELEM INFO ARRAY 1 2 1 SDO ORDINATE ARRAY 5 4 5 8 4 8 10 4 10 16 32 Oracle Spatial User s Guide and Reference SDO_LRS FIND_LRS_DIM_POS SDO_LRS FIND_LRS_DIM_POS Format Description Parameters Usage Notes Examples SDO_LRS FIND_LRS_DIM_POS table_name IN VARCHAR2 column_name IN VARCHAR2 RETURN INTEGER Returns the position of the measure dimension within the SDO_DIM_ARRAY structure for a specified SDO_GEOMETRY column table_name Table containing the column with the SDO_GEOMETRY objects column_name Column in table_name containing the SDO_GEOMETRY objects None The following example returns the position of the measure dimension within the SDO_DIM_ARRAY structure for geometries in the ROUTE_GEOMETRY column of the LRS_ROUTES table This example uses the definitions from the example in Section 7 7 SELECT SDO_LRS FIND_LRS DIM POS LRS ROUTES ROUTE GEOMETRY FROM DUAL SDO_LRS FIND_LRS DIM _POS LRS ROUTES ROUTE GEOMETRY Linear Referencing Subprograms 16 33 SDO_LRS FIND_MEASURE SDO_LRS FIND_MEASURE Format Description Parameters SDO_LRS FIND_MEASU
454. programs 13 1 Table 13 1 Cont Geometry Subprograms Subprogram Description SDO_GEOM SDO_CENTROID SDO_GEOM SDO_CONVEXHULL SDO_GEOM SDO_DIFFERENCE SDO_GEOM SDO_DISTANCE SDO_GEOM SDO_INTERSECTION SDO_GEOM SDO_LENGTH SDO_GEOM SDO_MAX_MBR_ ORDINATE SDO_GEOM SDO_MBR SDO_GEOM SDO_MIN_MBR_ ORDINATE SDO_GEOM SDO_POINTONSURFACE SDO_GEOM SDO_UNION SDO_GEOM SDO_XOR SDO_GEOM VALIDATE_GEOMETRY_ WITH_CONTEXT SDO_GEOM VALIDATE_LAYER_ WITH_CONTEXT SDO_GEOM WITHIN_DISTANCE Returns the centroid of a polygon Returns a polygon type object that represents the convex hull of a geometry object Returns a geometry object that is the topological difference MINUS operation of two geometry objects Computes the distance between two geometry objects Returns a geometry object that is the topological intersection AND operation of two geometry objects Computes the length or perimeter of a geometry Returns the maximum value for the specified ordinate dimension of the minimum bounding rectangle of a geometry object Returns the minimum bounding rectangle of a geometry Returns the minimum value for the specified ordinate dimension of the minimum bounding rectangle of a geometry object Returns a point that is guaranteed to be on the surface of a polygon Returns a geometry object that is the topological union OR operation of two geometry objects Returns a geometry object that is
455. ral objects in Figure 4 1 Each object is labeled with its geometry name geom_1 for the line string geom_2 for the four sided polygon geom_3 for the triangular polygon and geom_4 for the ellipse and the MBR around each object is represented by a dashed line Indexing and Querying Spatial Data 4 9 Querying Spatial Data Figure 4 1 Geometries with MBRs mim mt ee A typical spatial query is to request all objects that lie within a query window that is a defined fence or window A dynamic query window refers to a rectangular area that is not defined in the database but that must be defined before it is used Figure 4 2 shows the same geometries as in Figure 4 1 but adds a query window represented by the heavy dotted line box Figure 4 2 Layer with a Query Window a a fe ee ee a 4 10 Oracle Spatial Users Guide and Reference Querying Spatial Data In Figure 4 2 the query window covers parts of geometries geom_1 and geom_2 as well as part of the MBR for geom_3 but none of the actual geom_3 geometry The query window does not cover any part of the geom_4 geometry or its query window 4 2 1 1 Primary Filter Operator The SDO_FILTER operator described in Chapter 12 implements the primary filter portion of the two step process involved in the Oracle Spatial query processing model The primary filter uses the index data to determine only if a set of candidate object pairs may interact Specifically the primary
456. re adjacent to one another This matrix yields the following bit mask generated in row major form 101001111 Figure 1 5 The Nine Intersection Model B b i e b 1 0 1 A i 0 0 1 e 1 1 A TOUCH B 9 Intersection Matrix Spatial Concepts 1 15 Spatial Relationships and Filtering Some of the topological relationships identified in the seminal work by Professor Max Egenhofer University of Maine Orono and colleagues have names associated with them Spatial uses the following names DISJOINT The boundaries and interiors do not intersect TOUCH The boundaries intersect but the interiors do not intersect OVERLAPBDYDISJOINT The interior of one object intersects the boundary and interior of the other object but the two boundaries do not intersect This relationship occurs for example when a line originates outside a polygon and ends inside that polygon OVERLAPBDYINTERSECT The boundaries and interiors of the two objects intersect EQUAL The two objects have the same boundary and interior CONTAINS The interior and boundary of one object is completely contained in the interior of the other object COVERS The interior of one object is completely contained in the interior or the boundary of the other object and their boundaries intersect INSIDE The opposite of CONTAINS A INSIDE B implies BCONTAINS A COVEREDBY The opposite of COVERS A COVEREDBY B implies B COVERS A ON The interior and bou
457. re information and updates the metadata in the USER_SDO_GEOM_METADATA view table_name Table containing the column with the SDO_GEOMETRY objects column_name Column in table_name containing the SDO_GEOMETRY objects This function returns TRUE if the conversion was successful or if the layer already is a standard layer that is contains geometries without measure information and the function returns an exception if the conversion was not successful If a spatial index already exists on column_name you must delete drop the index before converting the layer and create a new index after converting the layer For information about deleting and creating indexes see the DROP INDEX and CREATE INDEX statements in Chapter 10 The _3D format of this function SDO_LRS CONVERT_TO_STD_LAYER_3D is available For information about _3D formats of LRS functions see Section 7 4 For more information about conversion functions see Section 7 5 10 16 26 Oracle Spatial Users Guide and Reference SDO_LRS CONVERT_TO_STD_LAYER Examples The following example converts the geometric segments in the ROUTE_ GEOMETRY column of the LRS_ROUTES table to standard format This example uses the definitions from the example in Section 7 7 The SELECT statement shows that dimensional information has been removed that is no SDO_DIM_ ELEMENT M NULL NULL NULL is included in the definition BEGIN IF SDO _LRS CONVERT TO STD LAYER LRS ROUTES
458. re nearest to a specified point 10 7 and it finds the distance between each object and the point The example uses the definitions and data from Section 2 1 SELECT INDEX c cola spatial _idx c mkt_id c name SDO NN DISTANCE 1 dist FROM cola_markets c WHERE SDO NN c shape sdo_geometry 2001 NULL sdo point type 10 7 NULL NULL NULL sdo num res 2 1 TRUE ORDER BY dist MKT ID NAME DIST 4 colad 828427125 2 cola b 2 23606798 Note the following about this example a lisused as the number parameter for SDO_NN_DISTANCE and 1 is also specified as the last parameter to SDO_NN after sdo_num_res 2 a The column alias dist holds the distance between the object and the point For geodetic data the distance unit is meters for non geodetic data the distance unit is the unit associated with the data a SDO_NN 12 30 Oracle Spatial Users Guide and Reference SDO_ON SDO_ON Format Description SDO_ON geometry1 geometry2 Checks if any geometries in a table have the ON topological relationship with a specified geometry Equivalent to specifying the SDO_RELATE operator with mask ON See the section on the SDO_RELATE operator in this chapter for information about the operations performed by this operator and for usage requirements Keywords and Parameters Returns Usage Notes Examples Value Description geometryl Specifies a geometry column in a table The column must be spatial
459. re oriented correctly Exterior ring boundaries must be oriented counterclockwise and interior ring boundaries must be oriented clockwise a An interior polygon ring touches the exterior polygon ring at no more than one point a Iftwo or more interior polygon rings are in an exterior polygon ring the interior polygon rings touch at no more than one point Line strings have at least two points a SDO_ETYPE 1 digit and 4 digit values are not mixed that is both used in defining polygon ring elements a Points on an arc are not colinear that is are not on a straight line and are not the same point Geometries are within the specified bounds of the applicable DIMINFO column value from the USER_SDO_GEOM_METADATA view a LRS geometries see Chapter 7 have three or four dimensions and a valid measure dimension position 3 or 4 depending on the number of dimensions 13 48 Oracle Spatial Users Guide and Reference SDO_GEOM VALIDATE_GEOMETRY_WITH_CONTEXT Examples Related Topics In checking for geometry consistency the function considers the geometry s tolerance value in determining if lines touch or if points are the same If the function format with tolerance is used the following guidelines apply All geometry objects must be defined using 4 digit SDO_GTYPE values explained in Section 2 2 1 a No checking is done to validate that the geometry is within the coordinate system bounds as stored in the DIMI
460. rea is computed based on the proportion of the circle s area within different counties assuming uniform distribution of population within the counties SELECT sdo_sam aggregates for geometry GEOD COUNTIES GEOM sum totpop SDO GEOMETRY 2001 8307 SDO_ POINT TYPE 73 943849 40 6698 NULL NULL NULL distance 3 unit mile FROM DUAL a 21 4 Oracle Spatial Users Guide and Reference SDO_SAM AGGREGATES_FOR_LAYER SDO_SAM AGGREGATES_FOR_LAYER Format Description Parameters SDO_SAM AGGREGATES_FOR_LAYER theme_name IN VARCHAR2 theme_colname IN VARCHAR2 aggr_type_string IN VARCHAR2 aggr_col_string IN VARCHAR2 tablename IN VARCHAR2 colname IN VARCHAR2 dst_spec IN VARCHAR2 DEFAULT NULL RETURN SDO_REGAGGRSET Computes thematic aggregates for a layer of geometries theme_name Name of the theme table theme_colname Name of the geometry column in theme_name aggr_type_string Any Oracle SQL aggregate function that accepts one or more numeric values and computes a numeric value such as SUM MIN MAX or AVG aggr_col_string Name of a column in theme_name on which to compute aggregate values as explained in the Usage Notes An example might be a POPULATION column tablename Name of the data mining table Spatial Analysis and Mining Subprograms 21 5 SDO_SAM AGGREGATES_FOR_LAYER Usage Notes colname Name of the column in tablename that holds the geometries dst_spec A qu
461. redator and prey species could be colocated in animal habitats and high sales pizza restaurants could be colocated with high sales video stores You can use a reference feature approach using one feature as a reference and the other features as thematic Spatial Analysis and Mining 8 5 Spatial Clustering attributes and materializing all neighbors for the reference feature or a buffer based approach materializing all items that are within all windows of a specified size a Colocation with thematic layers Given several data layers this approach identifies colocation across the layers For example given a lakes layer and a vegetation layer lakes could be colocated with areas of high vegetation You materialize the data add categorical and numerical spatial relationships to the data mining table and apply the ODM Association Rule mechanisms The following functions and procedures documented in Chapter 21 perform operations related to colocation mining a SDO_SAM COLOCATED_REFERENCE_ FEATURES a SDO_SAM BIN_GEOMETRY 8 5 Spatial Clustering Spatial clustering returns cluster geometries for a layer of data An example of spatial clustering is the clustering of crime location data The SDO_SAM SPATIAL_CLUSTERS function documented in Chapter 21 performs spatial clustering This function requires a spatial R tree index on the geometry column of the layer and it returns a set of SDO_REGION objects where the geometry column speci
462. regate function to aggregate employee salaries by department SELECT SUM salary dept FROM employees GROUP BY dept Oracle Spatial aggregate functions aggregate the results of SOL queries involving geometry objects Spatial aggregate functions return a geometry object of type SDO_ GEOMETRY For example the following statement returns the minimum bounding rectangle of all geometries in a table using the definitions and data from Section 2 1 SELECT SDO_AGGR_MBR shape FROM cola_markets The following example returns the union of all geometries except cola_d SELECT SDO_AGGR_UNION SDOAGGRTYPE c shape 0 005 FROM cola_markets c WHERE c name lt cola d All geometries used with spatial aggregate functions must be defined using 4 digit SDO_GTYPE values that is must be in the format used by Oracle Spatial release 8 1 6 or higher For information about SDO_GTYPE values see Section 2 2 1 For reference information about the spatial aggregate functions and examples of their use see Chapter 14 1 10 1 SDOAGGRTYPE Object Type Many spatial aggregate functions accept an input parameter of type SDOAGGRTYPE Oracle Spatial defines the object type SDOAGGRTYPE as CREATE TYPE sdoaggrtype AS OBJECT geometry SDO GEOMETRY Spatial Concepts 1 19 Spatial Java Interface tolerance NUMBER Note Do not use SDOAGGRTYPE as the data type for a column in a table Use this type only in calls to spatial aggregate functions
463. resulting geometry is set to null a Ifan LRS point is converted to a standard point the information in the SDO_ ELEM_INFO and SDO_ORDINATES attributes described in Section 2 2 4 and Section 2 2 5 in the input geometry is used to set the SDO_POINT attribute information in the resulting geometry and the SDO_ELEM_INFO and SDO_ ORDINATES attributes in the resulting geometry are set to null The conversion functions are listed in Table 16 3 in Chapter 16 See also the reference information in Chapter 16 about each conversion function 7 6 Tolerance Values with LRS Functions Many LRS functions require that you specify a tolerance value or one or more dimensional arrays Thus you can control whether to specify a single tolerance value for all non measure dimensions or to use the tolerance associated with each non measure dimension in the dimensional array or arrays The tolerance is applied only to the geometry portion of the data not to the measure dimension The 7 20 Oracle Spatial User s Guide and Reference Example of LRS Functions tolerance value for geodetic data is in meters and for non geodetic data it is in the unit of measurement associated with the data For a detailed discussion of tolerance see Section 1 5 5 Be sure that the tolerance value used is appropriate to the data and your purpose If the results of LRS functions seem imprecise or incorrect you may need to specify a smaller tolerance value For clip opera
464. ria such as intersection and containment A spatial index is needed to a Find objects within an indexed data space that interact with a given point or area of interest window query Find pairs of objects from within two indexed data spaces that interact spatially with each other spatial join A spatial index is considered a logical index The entries in the spatial index are dependent on the location of the geometries in a coordinate space but the index values are in a different domain Index entries may be ordered using a linearly ordered domain and the coordinates for a geometry may be pairs of integer floating point or double precision numbers Oracle Spatial lets you use R tree indexing the default or quadtree indexing or both However the use of quadtree indexes is discouraged and you are strongly encouraged to use R tree indexing Significant performance improvements have been made to spatial R tree indexing for this release Quadtree indexing is a deprecated feature of Spatial 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 Testing of spatial indexes with many workloads and operators is ongoing and results and recommendations will be documented as they become available The following sections explain the concepts and options associated with R tree indexing 1 7
465. ries and DML operations that use the index For parallel execution you can specify an integer value of degree of parallelism See the Usage Notes for more information about parallel index creation Default NOPARALLEL If PARALLEL is specified without an integer value the Oracle database calculates the optimum degree of parallelism All current SQL CREATE INDEX prerequisites apply a You must have EXECUTE privilege on the index type and its implementation type The USER_SDO_GEOM_METADATA view must contain an entry with the dimensions and coordinate boundary information for the table column to be spatially indexed For information about spatial indexes see Section 1 7 Before you create a spatial index be sure that the rollback segment size and the SORT_AREA_ SIZE parameter value are adequate as described in Section 4 1 1 If an R tree index is used on linear referencing system LRS data and if the LRS data has four dimensions three plus the M dimension the sdo_indx_dims parameter must be used and must specify 3 the number of dimensions minus one to avoid the default sdo_indx_dims value of 2 which would index only the X and Y dimensions For example if the dimensions are X Y Z and M specify sdo_ indx_dims 3 to index the X Y and Z dimensions but not the measure M dimension The LRS data model including the measure dimension is explained in Section 7 2 A partitioned spatial index can be created on a pa
466. riplet values are part of the element If the SDO_ETYPE is not a compound element 1 2 1003 or 2003 the interpretation attribute determines how the sequence of ordinates for this element is interpreted For example a line string or polygon boundary may be made up of a sequence of connected straight line segments or circular arcs Descriptions of valid SDO_ETYPE and SDO_INTERPRETATION value pairs are given in Table 2 2 If a geometry consists of more than one element then the last ordinate for an element is always one less than the starting offset for the next element The last element in the geometry is described by the ordinates from its starting offset to the end of the SDO_ORDINATES varying length array For compound elements SDO_ETYPE values 4 1005 or 2005 a set of n triplets one for each subelement is used to describe the element It is important to remember that subelements of a compound element are contiguous The last point of a subelement is the first point of the next subelement For subelements 1 through n 1 the end point of one subelement is the same as the starting point of the next subelement The starting point for subelements 2 n 2 is the same as the end point of subelement 1 n 1 The last ordinate of subelement n is either the starting offset minus 1 of the next element in the geometry or the last ordinate in the SDO_ ORDINATES varying length array The current size of a varying length array can be determined
467. rmat SDO_LRS DYNAMIC_SEGMENT geom_segment IN SDO_GEOMETRY start_measure IN NUMBER end_measure IN NUMBER tolerance IN NUMBER RETURN SDO_GEOMETRY or SDO_LRS DYNAMIC_SEGMENT geom_segment IN SDO_GEOMETRY dim_array IN SDO_DIM_ARRAY start_measure IN NUMBER end_measure IN NUMBER RETURN SDO_GEOMETRY Description Returns the geometry object resulting from a clip operation on a geometric segment Note SDO_LRS CLIP_GEOM_SEGMENT and SDO_ LRS DYNAMIC_SEGMENT are synonyms both functions have the same parameters behavior and return value Parameters geom_segment Cartographic representation of a linear feature Linear Referencing Subprograms 16 31 SDO_LRS DYNAMIC_SEGMENT Usage Notes Examples dim_array Dimensional information array corresponding to geom_segment usually selected from one of the xxx_SDO_GEOM_METADATA views described in Section 2 4 start_measure Start measure of the geometric segment end_measure End measure of the geometric segment tolerance Tolerance value see Section 1 5 5 and Section 7 6 An exception is raised if geom_segment start_measure or end_measure is invalid The direction and measures of the resulting geometric segment are preserved For more information about clipping a geometric segment see Section 7 5 3 The following example clips the geometric segment representing Route 1 returning the segment from measures 5 through 10 This segment might re
468. road segments or land parcels Complex natural features such as coastlines seismic fault lines rivers and land types can require significant storage space if they are stored at a high precision Query complexity The CPU requirements for simple mapping queries such as Select all features in this rectangle are lower than for more complex queries such as Find all seismic fault lines that cross this coastline 1 17 Spatial Error Messages Spatial error message numbers are in the range of 13000 to 13499 The messages are documented in Oracle Database Error Messages 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 1 18 Spatial Examples Oracle Spatial provides examples that you can use to reinforce your learning and to create models for coding certain operations Several examples are provided in the following directory SORACLE HOME md demos examples The following files in that directory are helpful for applications that use the Oracle Call Interface OCI Spatial Concepts 1 23 Spatial Examples a readgeom c and readgeom h a writegeom c and writegeom h Th
469. route_id 1 What is the end measure of Routel SELECT SDO LRS GEOM SEGMENT END MEASURE route geometry FROM lrs_ routes WHERE route_id 1 What is the start point of Routel SELECT SDO_LRS GEOM SEGMENT START PT route_geometry FROM lrs_ routes WHERE route_id 1 What is the end point of Routel SELECT SDO_LRS GEOM SEGMENT END PT route_geometry FROM lrs_ routes WHERE route_id 1 Translate shift measure values 10 First display the original segment then translate SELECT a route_geometry FROM lrs routes a WHERE a route_id 1 SELECT SDO_LRS TRANSLATE MEASURE a route_geometry m diminfo 10 FROM lrs_ routes a user_sdo_geom_metadata m WHERE m table name AND a route_id 1 Redefine geometric segment to convert miles to kilometers DECLARE geom_segment SDO GEOMETRY dim array SDO_ DIM ARRAY 7 26 Oracle Spatial Users Guide and Reference LRS ROUTES AND m column_name ROUTE GEOMETRY Example of LRS Functions BEGIN SELECT a route geometry into geom segment FROM lrs routes a WHERE a route_ name Routel SELECT m diminfo into dim_array from user _sdo_geom metadata m WHERE m table name LRS ROUTES AND m column_name ROUTE GEOMETRY Convert mile measures to kilometers 27 1 609 43 443 SDO_LRS REDEFINE GEOM SEGMENT geom_segment dim_array 0 Zero starting measure LRS segment starts at start of route 43 443 End of LRS segment 27 miles 4
470. rted only for line string and multiline string geometries The 3D formats should be used only when the geometry object has four dimensions and the fourth dimension is the measure for example X Y Z and M and only when you want the function to consider the first three dimensions for example X Y and Z If the standard format of a function that is without the _3D is used ona geometry with four dimensions the function considers only the first two dimensions for example X and Y For example the following format considers the X Y and Z dimensions of the specified GEOM object in performing the clip operation SELECT SDO_LRS CLIP_GEOM SEGMENT 3D a geom m diminfo 5 10 FROM routes r user_sdo geom metadata m WHERE m table_name ROUTES AND m column name GEOM AND r route_id 1 However the following format considers only the X and Y dimensions and ignores the Z dimension of the specified GEOM object in performing the clip operation SELECT SDO LRS CLIP GEOM SEGMENT a geom m diminfo 5 10 FROM routes r user_sdo geom metadata m WHERE m table_name ROUTES AND m column name GEOM AND r route_id 1 The parameters for the standard and 3D formats of any function are the same and the Usage Notes apply to both formats The 3D formats are not supported with the following Geodetic data Polygons arcs or circles 7 10 Oracle Spatial Users Guide and Reference LRS Operations 7 5 LRS Operations T
471. rtitioned table See Section 4 1 6 for more information about partitioned spatial indexes including benefits and restrictions A spatial index cannot be created on an index organized table You can specify the PARALLEL keyword to cause the index creation to be parallelized For example 10 12 Oracle Spatial Users Guide and Reference CREATE INDEX CREATE INDEX cola_spatial_idx ON cola_markets shape INDEXTYPE IS MDSYS SPATIAL INDEX PARALLEL For information about using the PARALLEL keyword see the description of the parallel clause in the section on the CREATE INDEX statement in Oracle Database SQL Reference In addition the following notes apply to the use of the PARALLEL keyword for creating or rebuilding using the ALTER INDEX REBUILD statement spatial indexes The PARALLEL clause is not supported for adding an index table with the ALTER INDEX statement however it is supported for rebuilding such an index table with the ALTER INDEX REBUILD statement One useful scenario is to add a small second index table and later rebuild the index table specifying the desired parameters and using parallel execution See the parallel execution example for the ALTER INDEX REBUILD statement The performance cost and benefits from parallel execution for creating or rebuilding an index depend on a system s resources and load If the system s CPUs or disk controllers are already heavily loaded you should not specify the PARALLEL keyword
472. s function returns a string in the format FALSE lt position number gt where lt position number gt is the number of the character position in the WKT description where the first error occurs The WKT description is checked to see if it satisfies the requirements described in Section 6 4 1 1 The following example validates the WKT description of the coordinate system associated with SRID 81989000 The results show that the cause of the invalidity or the first cause of the invalidity starts at character position 181 in the WKT description SRID 81989000 is not associated with any established coordinate system Rather it is for a deliberately invalid coordinate system that was inserted into a test version of the MDSYS CS_SRS table and it is not included in the MDSYS CS_SRS table that is shipped with Oracle Spatial SELECT SDO_CS VALIDATE WKT 81989000 FROM DUAL Coordinate System Transformation Subprograms 15 7 SDO_CS VALIDATE_WKT SDO_CS VALIDATE WKT 81989000 FALSE 181 15 8 Oracle Spatial Users Guide and Reference SDO_CS VIEWPORT_TRANSFORM SDO_CS VIEWPORT_TRANSFORM Format Description Parameters Usage Notes SDO_CS VIEWPORT_TRANSFORM geom IN SDO_GEOMETRY to_srid IN NUMBER RETURN SDO_GEOMETRY Transforms an optimized rectangle into a valid polygon for use with Spatial operators and functions Note This function is deprecated and will not be supported in future releases of Spatia
473. s in the database For detailed information about using this type with geodetic data including examples see Section 6 2 3 Circle type Described by three distinct non colinear points all on the circumference of the circle Compound line string with some vertices connected by straight line segments and some by circular arcs The value n in the Interpretation column specifies the number of contiguous subelements that make up the line string The next n triplets in the SDO_ELEM_INFO array describe each of these subelements The subelements can only be of SDO_ETYPE 2 The last point of a subelement is the first point of the next subelement and must not be repeated See Section 2 3 3 and Figure 2 4 for an example of a geometry using this type Compound polygon with some vertices connected by straight line segments and some by circular arcs The value n in the Interpretation column specifies the number of contiguous subelements that make up the polygon The next n triplets in the SDO_ELEM_INFO array describe each of these subelements The subelements can only be of SDO_ETYPE 2 The end point of a subelement is the start point of the next subelement and it must not be repeated The start and end points of the polygon must be exactly the same point tolerance is ignored See Section 2 3 4 and Figure 2 5 for an example of a geometry using this type 2 2 5 SDO_ORDINATES The SDO_ORDINATES attribute is defined using a varying len
474. s of an imaginary grid The spacing of the nodes is constant in both the horizontal and vertical directions hole A subelement of a polygon that negates a section of its interior For example consider a polygon representing a map of buildable land with an inner polygon a hole representing where a lake is located homogeneous Spatial data of one feature type such as points lines or regions hyperspatial data In mathematics any space having more than the three standard X Y and Z dimensions Sometimes referred to as multidimensional data index A database object that is used for fast and efficient access to stored information inside A geometric relationship where one object is surrounded by a larger object and the inner object does not touch the boundary of the outer The smaller object is inside the larger See also contain key A field in a database used to obtain access to stored information keyword Synonym for reserved word latitude North south position of a point on the Earth defined as the angle between the normal to the Earth s surface at that point and the plane of the equator layer A collection of geometries having the same attribute set and stored in a geometry column line A geometric object represented by a series of points or inferred as existing between two coordinate points line string One or more pairs of points that define a line segment linear feature Any spatial object that ca
475. s set to FAILED If the CREATE INDEX statement fails because of an invalid geometry the ROWID of the failed geometry is returned in an error message along with the reason for the failure If the CREATE INDEX statement fails for any reason then the DROP INDEX statement must be used to clean up the partially built index and associated metadata If DROP INDEX does not work add the FORCE parameter and try again The following example creates a spatial R tree index named COLA_SPATIAL_IDX CREATE INDEX cola_spatial_idx ON cola_markets shape INDEXTYPE IS MDSYS SPATIAL INDEX ALTER INDEX a DROP INDEX 10 14 Oracle Spatial Users Guide and Reference DROP INDEX DROP INDEX Syntax DROP INDEX schema index FORCE Purpose Deletes a spatial index Keywords and Parameters Value Description FORCE Causes the spatial index to be deleted from the system tables even if the index is marked in progress or some other error condition occurs Prerequisites You must have EXECUTE privileges on the index type and its implementation type Usage Notes Use DROP INDEX indexname FORCE to clean up after a failure in the CREATE INDEX statement Examples The following example deletes a spatial index named OLDINDEX and forces the deletion to be performed even if the index is marked in process or an error occurs DROP INDEX oldindex FORCE Related Topics a CREATE INDEX SQL Statements for Indexing Spatial Data 10 15 DR
476. sage Notes The function returns a null value if geom1 is not a polygon multipolygon point or point cluster If geom1 is a point the function returns the point the input geometry If the function format with tol is used all geometry objects must be defined using 4 digit SDO_GTYPE values explained in Section 2 2 1 With geodetic data this function is supported by approximations as explained in Section 6 7 3 Depending on the shape and complexity of the input geometry the returned point might not be on the surface of the input geometry Examples The following example returns a geometry object that is the centroid of cola_c The example uses the definitions and data from Section 2 1 Return the centroid of a geometry SELECT c name SDO GEOM SDO CENTROID c shape m diminfo FROM cola_markets c user _sdo geom metadata m WHERE m table name COLA MARKETS AND m column_name SHAPE AND c name cola c cola c SDO GEOMETRY 2001 NULL NULL SDO ELEM INFO ARRAY 1 1 1 SDO ORDINATE ARRAY 4 73333333 3 93333333 Related Topics None 13 18 Oracle Spatial Users Guide and Reference SDO_GEOM SDO_CONVEXHULL SDO_GEOM SDO_CONVEXHULL Format Description Parameters Usage Notes SDO_GEOM SDO_CONVEXHULL geom1 IN SDO_GEOMETRY dim1 IN SDO_DIM_ARRAY RETURN SDO_GEOMETRY or SDO_GEOM SDO_CONVEXHULL geom1 IN SDO_GEOMETRY tol IN NUMBER RETURN SDO_GEOMETRY Returns a polygon type obj
477. sary area An extent or region of dimensional space attribute Descriptive information characterizing a geographical feature such as a point line or area attribute data Nondimensional data that provides additional descriptive information about multidimensional data for example a class or feature such as a bridge or a road authalic sphere A sphere that has the same surface area as a particular oblate ellipsoid of revolution representing the figure of the Earth batch geocoding An operation that simultaneously geocodes many records from one table See also geocoding boundary 1 The lower or upper extent of the range of a dimension expressed by a numeric value 2 The line representing the outline of a polygon Cartesian coordinate system A coordinate system in which the location of a point in n dimensional space is defined by distances from the point to the reference plane Distances are measured Glossary 1 Glossary 2 parallel to the planes intersecting a given reference plane See also coordinate system contain A geometric relationship where one object encompasses another and the inner object does not touch any boundaries of the outer The outer object contains the inner object See also inside convex hull A simple convex polygon that completely encloses the associated geometry object coordinate A set of values uniquely defining a point in an n dimensional coordinate system coordinate system
478. see Section 1 5 5 and Section 7 6 This function returns TRUE if the geometric segments are spatially connected and FALSE if the geometric segments are not spatially connected An exception is raised if geom_segment_1 or geom_segment_2 has an invalid geometry type or dimensionality or if geom_segment_1 and geom_segment_2 are based on different coordinate systems The _3D format of this function GSDO_LRS CONNECTED_GEOM_SEGMENTS__ 3D is available For information about _3D formats of LRS functions see Section 7 4 The following example checks if two geometric segments results of a previous split operation are spatially connected Are result_geom_1 and result_geom2 connected SELECT SDO LRS CONNECTED GEOM SEGMENTS a route geometry b route geometry 0 005 FROM lrs routes a lrs routes b WHERE a route id 11 AND b route_id 12 SDO_LRS CONNECTED GEOM SEGMENTS A ROUTE GEOMETRY B ROUTE GEOMETRY 0 005 16 12 Oracle Spatial User s Guide and Reference SDO_LRS CONVERT_TO_LRS_DIM_ARRAY SDO_LRS CONVERT_TO_LRS_DIM_ARRAY Format SDO_LRS CONVERT_TO_LRS_DIM_ARRAY or dim_array IN SDO_DIM_ARRAY lower_bound IN NUMBER IN NUMBER tolerance IN NUMBER RETURN SDO_DIM_ARRAY upper_bound SDO_LRS CONVERT_TO_LRS_DIM_ARRAY or IN SDO_DIM_ARRAY dim_name IN VARCHAR2 lower_bound IN NUMBER IN NUMBER IN NUMBER RETURN SDO_DIM_ARRAY dim_array upper_bound tolerance SDO_LRS CONVERT_TO_L
479. segment at which to start the offset operation offset Distance to measure perpendicularly from the points along geom_segment Positive offset values are to the left of geom_segment negative offset values are to the right of geom_segment tolerance Tolerance value see Section 1 5 5 and Section 7 6 unit Unit of measurement specification a quoted string with one or both of the following keywords unit and anSDO_UNIT value from the MDSYS SDO_DIST_UNITS table See Section 2 6 for more information about unit of measurement specification a arc_tolerance and an arc tolerance value See the Usage Notes for the SDO_ GEOM SDO_ARC_DENSIFY function in Chapter 13 for more information about the arc_tolerance keyword For example unit km arc_tolerance 0 05 If the input geometry is geodetic data this parameter is required and arc_ tolerance must be specified If the input geometry is Cartesian or projected data arc_tolerance has no effect and should not be specified If this parameter is not specified for a Cartesian or projected geometry or if the arc_tolerance keyword is specified for a geodetic geometry but the unit keyword is not specified the unit of measurement associated with the data is assumed start_measure and end_measure can be any points on the geometric segment They do not have to be in any specific order For example start_measure and end_measure can be 5 and 10 respectively or 10 and 5 respectively Linear
480. segment_2 Second geometric segment from the split point to the end point of geom_segment An exception is raised if geom_segment or split_measure is invalid The directions and measures of the resulting geometric segments are preserved The _3D format of this procedure SDO_LRS SPLIT_GEOM_SEGMENT_3D is available For information about _3D formats of LRS functions and procedures see Section 7 4 For more information about splitting a geometric segment see Section 7 5 4 The following example defines the geometric segment splits it into two segments then concatenates those segments This example uses the definitions from the example in Section 7 7 The definitions of result_geom_1 result_geom_2 and result_geom_3 are displayed in Example 7 3 DECLARE geom_segment SDO GEOMETRY line string SDO_GEOMETRY dim array SDO DIM ARRAY result_geom_1 SDO GEOMETRY result_geom 2 SDO GEOMETRY result_geom 3 SDO GEOMETRY BEGIN SELECT a route geometry into geom segment FROM lrs_routes a WHERE a route name Routel SELECT m diminfo into dim_array from user _sdo_geom metadata m WHERE m table name LRS ROUTES AND m column_name ROUTE GEOMETRY Define the LRS segment for Routel SDO_LRS DEFINE GEOM SEGMENT geom segment dim_ array 0 Zero starting measure LRS segment starts at start of route 27 End of LRS segment is at measure 27 SELECT a route_geometry INTO line string FROM lrs_ routes a WHERE a route name R
481. side TRUE UNION ALL SELECT a gid FROM polygons a query polys B WHERE B gid 1 AND SDO_RELATE A Geometry B Geometry mask coveredby TRUE The following examples are similar to those for the SDO_FILTER operator however they identify a specific type of interaction using the mask keyword and they determine with certainty not mere likelihood if the spatial interaction occurs The following example selects the geometries that have any interaction with a query window here a rectangle with lower left upper right coordinates 4 6 8 8 The example uses the definitions and data from Section 2 1 SELECT c mkt_id c name FROM cola_markets c WHERE SDO_RELATE c shape SDO GEOMETRY 2003 NULL NULL SDO_ ELEM INFO ARRAY 1 1003 3 SDO_ORDINATE ARRAY 4 6 8 8 mask anyinteract TRUE MKT _ID NAME Spatial Operators 12 41 SDO_RELATE 2 cola b 1 cola a 4 cola d The following example selects the GID values from the POLYGONS table where the GEOMETRY column objects have any spatial interaction with the GEOMETRY column object in the QUERY_POLYS table that has a GID value of 1 SELECT A gid FROM Polygons A query polys B WHERE B gid 1 AND SDO_RELATE A Geometry B Geometry mask ANYINTERACT TRUE The following example selects the GID values from the POLYGONS table where a GEOMETRY column object has any spatial interaction with the geometry stored in the aGeom variable Select A Gid FROM
482. sociating spatial locations longitude and latitude coordinates with postal addresses This chapter includes the following major sections a Section 5 1 Concepts for Geocoding Section 5 2 Data Types for Geocoding Section 5 3 Using the Geocoding Capabilities 5 1 Concepts for Geocoding This section describes concepts that you must understand before you use the Spatial geocoding capabilities 5 1 1 Address Representation Addresses to be geocoded can be represented either as formatted addresses or unformatted addresses A formatted address is described by a set of attributes for various parts of the address which can include some or all of those shown in Table 5 1 Table 5 1 Attributes for Formal Address Representation Address Attribute Description Name Place name optional Intersecting street Intersecting street name optional Geocoding Address Data 5 1 Concepts for Geocoding Table 5 1 Cont Attributes for Formal Address Representation Address Attribute Description Street Street address including the house or building number street name street type Street Road Blvd and so on and possibly other information In the current release the first four characters of the street name must match a street name in the geocoding data for there to be a potential street name match Settlement The lowest level administrative area to which the address belongs In most cases it is the city In so
483. some spatial queries Many concepts and techniques in Example 2 1 are explained in detail in other sections of this chapter 2 2 Oracle Spatial User s Guide and Reference Simple Example Inserting Indexing and Querying Spatial Data Example 2 1 Simple Example Inserting Indexing and Querying Spatial Data Create a table for cola soft drink markets in a given geography such as city or state Each row will be an area of interest for a specific cola for example where the cola is most preferred by residents where the manufacturer believes the cola has growth potential and so on For restrictions on spatial table and column names see Section 2 4 1 and Section 2 4 2 CREATE TABLE cola markets mkt_id NUMBER PRIMARY KEY name VARCHAR2 32 shape SDO GEOMETRY The next INSERT statement creates an area of interest for Cola A This area happens to be a rectangle The area could represent any user defined criterion for example where Cola A is the preferred drink where Cola A is under competitive pressure where Cola A has strong growth potential and so on INSERT INTO cola_markets VALUES 1 cola a SDO_GEOMETRY 2003 two dimensional polygon NULL NULL SDO ELEM INFO ARRAY 1 1003 3 one rectangle 1003 exterior SDO ORDINATE ARRAY 1 1 5 7 only 2 points needed to define rectangle lower left and upper right with Cartesian coordinate
484. spatially indexed Data type is SDO_GEOMETRY geometry2 Specifies either a geometry from a table or a transient instance of a geometry Specified using a bind variable or SDO_GEOMETRY constructor Data type is SDO_GEOMETRY The expression SDO_COVERS geometry1 geometry2 TRUE evaluates to TRUE for object pairs that have the COVERS topological relationship and FALSE otherwise See the Usage Notes for the SDO_RELATE operator in this chapter For an explanation of the topological relationships and the nine intersection model used by Spatial see Section 1 8 Spatial Operators 12 9 SDO_COVERS Examples The following example finds geometries that have the COVERS relationship with a query window here a rectangle with lower left upper right coordinates 1 1 4 6 The example uses the definitions and data described in Section 2 1 and illustrated in Figure 2 1 In this example only cola_a covers the query window geometry SELECT c mkt_id c name FROM cola_markets c WHERE SDO_ COVERS c shape SDO GEOMETRY 2003 NULL NULL SDO_ ELEM INFO ARRAY 1 1003 3 SDO_ORDINATE ARRAY 1 1 4 6 TRUE MKT _ID NAME 12 10 Oracle Spatial User s Guide and Reference SDO_EQUAL SDO_EQUAL Format SDO_EQUAL geometry1 geometry2 Description Checks if any geometries in a table have the EQUAL topological relationship with a specified geometry Equivalent to specifying the SDO_RELATE operator with mask EQU
485. ster 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 XXxi Spatial Analysis and Mining Geocoding You can use new spatial analysis and mining subprograms in Oracle Data Mining ODM applications See Chapter 8 for concept
486. stesiesiestesneneneeeness 6 3 6 2 2 Choosing a Geodetic or Projected Coordinate System ocononcocinnnonnnnonenennracinanannranneos 6 4 6 2 3 Geodetic MBR iras navies Adena libido ibi 6 4 6 2 4 Other Considerations and Requirements with Geodetic Data 6 6 6 3 Local Coordinate Support esisi ns Annie acl ini eh alas 6 7 6 4 Coordinate Systems Data Structures ooononocccccnnnnannnnnrnnnenanannnnnnnnnrornnnnnoranannnnnnn ra rarnnnaranan arcanos 6 8 6 4 1 MDS YS CS SRS Tablet EA AAA E ir Eds 6 8 6 4 1 1 Well now Text WK1 scion oda 6 9 6 4 2 MDSYS SDO_ANGLE_UNITS Table oocooccionocicinnoncononoononnonononnonoononconononnonnnnonnnnoncnno 6 12 6 4 3 MDSYS SDO DATUMS Table vasos ictipdlia 6 12 6 4 4 MDSYS SDO_ELLIPSOIDS Table nerra npani EEEE E 6 15 6 4 5 MDSYS SDO_PROJECTIONS Table sociis ERa aE iE ANO ARE i 6 16 6 5 Creating a User Defined Coordinate System oocociccncocononenennninnnnnnnnnrnnnennnananarnanararnnnnnananss 6 17 6 6 Coordinate System Transformation Functions onocccocononennnnnnnnnnnnnrnennncanannanarnrornennnananoss 6 20 vii viii 6 7 Notes and Restrictions with Coordinate Systems Support cooconcoccncononcnonnnnnnrnnnenncananannnnos 6 20 6 7 1 Different Coordinate Systems for Geometries with Operators and Functions 6 20 6 7 2 Functions Not Supported with Geodetic Data ccccecccsececessesnenesesesseneteseseenens 6 21 6 7 3 Functions Supported by Approximations with Geodetic Data ooocononincnnininannonros 6 21 6 8 Example
487. sts of one coordinate Line data consists of two coordinates representing a line segment of the element Polygon data consists of coordinate pair values one vertex pair for each line segment of the polygon Coordinates are defined in order around the polygon counterclockwise for an exterior polygon ring clockwise for an interior polygon ring 1 5 2 Geometry 1 5 3 Layer A geometry or geometry object is the representation of a spatial feature modeled as an ordered set of primitive elements A geometry can consist of a single element which is an instance of one of the supported primitive types or a homogeneous or heterogeneous collection of elements A multipolygon such as one used to represent a set of islands is a homogeneous collection A heterogeneous collection is one in which the elements are of different types for example a point and a polygon An example of a geometry might describe the buildable land in a town This could be represented as a polygon with holes where water or zoning prevents construction A layer is a collection of geometries having the same attribute set For example one layer in a GIS might include topographical features while another describes population density and a third describes the network of roads and bridges in the area lines and points Each layer s geometries and associated spatial index are stored in the database in standard tables 1 5 4 Coordinate System A coordinate system also cal
488. sure values along an LRS segment are decreasing that is descending in numerical value geom_segment Geometric segment to be checked dim_array Dimensional information array corresponding to geom_segment usually selected from one of the xxx_SDO_GEOM_METADATA views described in Section 2 4 This function returns TRUE if the measure values along an LRS segment are decreasing and FALSE if the measure values along an LRS segment are not decreasing The start and end measures of geom_segment must be defined cannot be null The _3D format of this function SDO_LRS IS_MEASURE_DECREASING_3D is available For information about _3D formats of LRS functions see Section 7 4 See also the SDO_LRS IS MEASURE_INCREASING function The following example checks if the measure values along the geometric segment representing Route 1 are decreasing This example uses the definitions from the example in Section 7 7 Linear Referencing Subprograms 16 63 SDO_LRS IS_MEASURE_DECREASING SELECT SDO LRS IS MEASURE DECREASING a route_geometry m diminfo FROM lrs_ routes a user _sdo geom_ metadata m WHERE m table name LRS ROUTES AND m column_name ROUTE_GEOMETRY AND a route_id 1 SDO_LRS IS MEASURE DECREASING A ROUTE GEOMETRY M DIMINFO 16 64 Oracle Spatial User s Guide and Reference SDO_LRS IS_MEASURE_INCREASING SDO_LRS IS_MEASURE_INCREASING Format Description Parameters Usage Notes Examples SD
489. t lt gml Polygon gt The following example uses the TO_GMLGEOMETRY function with the Oracle XML DB XMLTYPE data type and the XMLELEMENT and XMLFOREST functions SELECT xmlelement State xmlattributes http www opengis net gml as xmlns gml xmlforest state as Name totpop as Population xmltype sdo _util to gmlgeometry geom as gml geometryProperty Spatial Utility Subprograms 19 39 SDO_UTIL TO_GMLGEOMETRY AS theXMLElements FROM states WHERE state _abrv in DE UT THEXMLELEMENTS lt State xmlns gml http www opengis net gml gt lt Name gt Delaware lt Name gt lt Population gt 666168 lt Population gt lt gml geometryProperty gt lt gml Polygon srsName SDO xmlns gml http www opengis net gml gt lt gml outerBoundaryIs gt lt gml LinearRing gt lt gml coordinates decimal cs ts gt 75 788704 39 721699 75 78 8704 39 6479 75 767014 39 377106 75 76033 39 296497 75 756294 39 24585 75 74 8016 39 143196 75 722961 38 829895 75 707695 38 635166 75 701912 38 560619 7 5 693871 38 460011 75 500336 38 454002 75 341614 38 451855 75 049339 38 45165 3 75 053841 38 538429 75 06015 38 605465 75 063263 38 611275 75 065308 38 62 949 75 065887 38 660919 75 078697 38 732403 75 082527 38 772045 75 091667 38 801208 75 094185 38 803699 75 097572 38 802986 75 094116 38 793579 75 09926 6 38 78756 75 123619 38 781784 75 137962 38 782703 75 18692 38 803772 75 215 019 38
490. t perform more slowly will not include the results of new insert operations and might not include the results of new update operations Therefore you are advised not to use spatial operators while index modifications are being deferred For partitioned indexes the index status can only be changed for a single partition at a time That is you cannot set all index partitions to deferred status with a single ALTER INDEX statement If you set the index status to deferred you must later specify index_ status synchronize to make the index reflect the data in the table and to set the index to a valid state Another use of index_status synchronize is to return the index to a consistent state if an attempt to commit or roll back a transaction failed due to insufficient resources See the Usage Notes for the CREATE INDEX statement for usage information about many of the other available parameters The following example modifies the tablespace and the SDO_LEVEL value for partition IP2 of the spatial index named BGI ALTER INDEX bgi MODIFY PARTITION ip2 PARAMETERS tablespace TBS 3 sdo_level 4 j The following example defers index modifications and later after the updates to the spatial table synchronizes the index to reflect the table ALTER INDEX xyz idx PARAMETERS index status deferred lt Insert rows in spatial table gt 10 4 Oracle Spatial Users Guide and Reference ALTER INDEX ALTER INDEX xyz idx PARAMETERS index s
491. t conversion subprograms see Section 7 5 10 16 4 Oracle Spatial Users Guide and Reference The rest of this chapter provides reference information on the subprograms listed in alphabetical order Linear Referencing Subprograms 16 5 SDO_LRS CLIP_GEOM_SEGMENT SDO_LRS CLIP_GEOM_SEGMENT Format SDO_LRS CLIP_GEOM_SEGMENT geom_segment IN SDO_GEOMETRY start_measure IN NUMBER end_measure IN NUMBER tolerance IN NUMBER RETURN SDO_GEOMETRY or SDO_LRS CLIP_GEOM_SEGMENT geom_segment IN SDO_GEOMETRY dim_array IN SDO_DIM_ARRAY start_measure IN NUMBER end_measure IN NUMBER RETURN SDO_GEOMETRY Description Returns the geometry object resulting from a clip operation on a geometric segment Note SDO_LRS CLIP_GEOM_SEGMENT and SDO_ LRS DYNAMIC_SEGMENT are synonyms both functions have the same parameters behavior and return value Parameters geom_segment Cartographic representation of a linear feature 16 6 Oracle Spatial Users Guide and Reference SDO_LRS CLIP_GEOM_SEGMENT Usage Notes Examples dim_array Dimensional information array corresponding to geom_segment usually selected from one of the xxx_SDO_GEOM_METADATA views described in Section 2 4 start_measure Start measure of the geometric segment end_measure End measure of the geometric segment tolerance Tolerance value see Section 1 5 5 and Section 7 6 An exception is raised if geom_segment start_measure or
492. t geometry to a GML fragment based on some GML geometry types defined in the Open GIS Implementation Specification The input geometry must have a 4 digit SDO_GTYPE value Polygons must be defined using the conventions for Oracle9i and higher releases of Spatial That is the outer boundary is stored first with ETYPE 1003 followed by zero or more inner boundary elements ETYPE 2003 For a polygon with holes the outer boundary must be stored first in the SDO_ORDINATES definition followed by coordinates of the inner boundaries LRS geometries must be converted to standard geometries using the SDO_ LRS CONVERT_TO_STD_GEOM or SDO_LRS CONVERT_TO_STD_LAYER function before being passed to the TO_GMLGEOMETRY function See the Examples section for an example that uses CONVERT_TO_STD_GEOM with the TO_GMLGEOMETRY function Spatial Utility Subprograms 19 35 SDO_UTIL TO_GMLGEOMETRY Examples Any circular arcs or circles must be densified using the SDO_GEOM SDO_BUFFER or SDO_GEOM SDO_ARC_DENSIFY function before being passed to the TO_ GMLGEOMETRY function See the Examples section for an example that uses SDO_ARC_DENSIFY with the TO_ GMLGEOMETRY function Label points are discarded That is if a geometry has a value for the SDO_POINT field and values in SDO_ELEM_INFO and SDO_ORDINATES the SDO_POINT is not output in the GML fragment The SDO_SRID value is output in the form srsName SDO lt srid gt For example SDO 8307 indica
493. t near the center of Concord Massachusetts An arc_tolerance value of 5 meters is used in computing the polygon vertices SELECT SDO_UTIL ELLIPSE POLYGON 71 34937 42 46101 100 50 90 5 FROM DUAL SDO_UTIL ELLIPSE POLYGON 71 34937 42 46101 100 50 90 5 SDO_GTYPE SDO SRID SD SDO GEOMETRY 2003 8307 NULL SDO ELEM INFO ARRAY 1 1003 1 SDO ORDINATE ARR AY 71 350589 42 46101 71 350168 42 4606701 71 349708 42 460578 71 3493 7 42 4605603 71 349032 42 460578 71 348572 42 4606701 71 348151 42 461 01 71 348572 42 4613499 71 349032 42 461442 71 34937 42 4614597 71 34 9708 42 461442 71 350168 42 4613499 71 350589 42 46101 a SDO_UTIL CIRCLE_POLYGON 19 12 Oracle Spatial User s Guide and Reference SDO_UTIL EXTRACT SDO_UTIL EXTRACT Format Description Parameters SDO_UTIL EXTRACT geometry IN SDO_GEOMETRY element IN NUMBER ring IN NUMBER RETURN SDO_GEOMETRY Returns the geometry that represents a specified element and optionally a ring of the input geometry geometry Geometry from which to extract the geometry to be returned element Number of the element in the geometry 1 for the first element 2 for the second element and so on Geometries with SDO_GTYPE values explained in Section 2 2 1 ending in 1 2 or 3 have one element geometries with SDO_TYPE values ending in 4 5 6 or 7 can have more than one element For example a multipolygon with an SDO_GTYPE
494. table contains the columns shown in Table 2 6 Table 2 6 Columns in the SDO_DIST_UNITS Table Column Name Data Type Purpose SDO_UNIT VARCHAR2 Unit string to be specified with the unit parameter Examples M KM CM MM MILE NAUT_MILE FOOT INCH UNIT_NAME VARCHAR2 Descriptive name of the unit Examples Meter Kilometer Centimeter Millimeter Mile Nautical Mile Foot Inch CONVERSION _ NUMBER Ratio of the unit to 1 meter For example the FACTOR conversion factor for a meter is 1 0 and the conversion factor for a mile is 1609 344 The MDSYS SDO_AREA_UNITS table contains the columns shown in Table 2 7 Spatial Data Types and Metadata 2 33 Unit of Measurement Support Table 2 7 Columns in the SDO_AREA_UNITS Table Column Name Data Type Purpose SDO_UNIT VARCHAR2 Unit string to be specified with the unit parameter Examples SQ_M SQ_KM SQ_CM SQ_MM SQ MILE SQ_FOOT SQ_INCH UNIT_NAME VARCHAR2 Descriptive name of the unit Examples Square Meter Square Kilometer Square Centimeter Square Millimeter Square Mile Square Foot Square Inch CONVERSION_ NUMBER Ratio of the unit to 1 square meter For example the FACTOR conversion factor for a square meter is 1 0 and the conversion factor for a square mile is 2589988 For a complete list of supported unit strings unit names and conversion factors view the contents of the MDSYS SDO_DIST_UNITS and MDSYS SDO_AREA_ UNITS tables For example SEL
495. tadata describing the dimensions lower and upper bounds and tolerance in each dimension is stored in a global table owned by MDSYS which users should never directly update Each Spatial user has the following views available in the schema associated with that user USER_SDO_GEOM_METADATA contains metadata information for all spatial tables owned by the user schema This is the only view that you can update and it is the one in which Spatial users must insert metadata related to spatial tables ALL_SDO_GEOM_METADATA contains metadata information for all spatial tables on which the user has SELECT permission Spatial Data Types and Metadata 2 25 Geometry Metadata Views Spatial users are responsible for populating these views For each spatial column you must insert an appropriate row into the USER_SDO_GEOM_METADATA view Oracle Spatial ensures that the ALL_SDO_GEOM_METADATA view is also updated to reflect the rows that you insert into USER_SDO_GEOM_METADATA Note These views were new for release 8 1 6 If you are upgrading from an earlier release of Spatial see Appendix A and the information about the SDO_MIGRATE TO_CURRENT procedure in Chapter 17 Each metadata view has the following definition TABLE NAME VARCHAR2 32 COLUMN NAME VARCHAR2 32 DIMINFO SDO_DIM ARRAY SRID NUMBER 3 In addition the ALL_SDO_GEOM_METADATA view has an OWNER column identifying the schema that owns the table specified in TA
496. tangle bounding a map the size of which is determined by the minimum and maximum map coordinates feature An object with a distinct set of characteristics in a spatial database geocoding The process of converting tables of address data into standardized address location and possibly other data See also batch geocoding geodetic coordinates Angular coordinates longitude and latitude closely related to spherical polar coordinates and defined relative to a particular Earth geodetic datum Also referred to as geographic coordinates geodetic datum A means of representing the figure of the Earth usually as an oblate ellipsoid of revolution that approximates the surface of the Earth locally or globally and is the reference for the system of geodetic coordinates geographic coordinates See geodetic coordinates Glossary 3 Glossary 4 geographic information system GIS A computerized database management system used for the capture conversion storage retrieval analysis and display of spatial data geographically referenced data See spatiotemporal data geometry The geometric representation of the shape of a spatial feature in some coordinate space A geometry is an ordered sequence of vertices that are connected by straight line segments or circular arcs georeferenced data See spatiotemporal data GIS See geographic information system GIS grid A data structure composed of points located at the node
497. tatus synchronize The following example defers index modifications for an index partition and later after the updates to the spatial table synchronizes the index partition to reflect the table ALTER INDEX part _sidx MODIFY PARTITION p3 PARAMETERS index status deferred lt Insert rows in spatial table gt ALTER INDEX part _sidx MODIFY PARTITION p3 PARAMETERS index status synchronize Related Topics ALTER INDEX REBUILD a ALTER INDEX RENAME TO a CREATE INDEX ALTER TABLE clauses for partition maintenance in Oracle Database SQL Reference SQL Statements for Indexing Spatial Data 10 5 ALTER INDEX REBUILD ALTER INDEX REBUILD Syntax ALTER INDEX schema index REBUILD PARAMETERS rebuild_params physical_storage_params NOPARALLEL PARALLEL integer ALTER INDEX schema index REBUILD PARTITION partition PARAMETERS rebuild_params physical_storage_params Purpose Rebuilds a spatial index or a specified partition of a partitioned index Keywords and Parameters Value Description REBUILD_PARAMS layer_gtype rebuild_index sdo_indx_dims Specifies in a command string the index parameters to use in rebuilding the spatial index Checks to ensure that all geometries are of a specified geometry type The value must be from the Geometry Type column of Table 2 1 in Section 2 2 1 except that UNKNOWN_GEOMETRY is not allowed In addition specifying POINT
498. ter 16 7 1 3 Direction of a Geometric Segment The direction of a geometric segment is indicated from the start point of the geometric segment to the end point The direction is determined by the order of the vertices from start point to end point in the geometry definition Measures of Linear Referencing System 7 3 Terms and Concepts points on a geometric segment always either increase or decrease along the direction of the geometric segment 7 1 4 Measure Linear Measure The measure of a point along a geometric segment is the linear distance in the measure dimension to the point measured from the start point for increasing values or end point for decreasing values of the geometric segment The measure information does not necessarily have to be of the same scale as the distance However the linear mapping relationship between measure and distance is always preserved Some LRS functions use offset instead of measure to represent measured distance along linear features Although some other linear referencing systems might use offset to mean what the Oracle Spatial LRS refers to as measure offset has a different meaning in Oracle Spatial from measure as explained in Section 7 1 5 7 1 5 Offset The offset of a point along a geometric segment is the perpendicular distance between the point and the geometric segment Offsets are positive if the points are on the left side along the segment direction and are negative if the
499. tes SDO_SRID 8307 and SDO indicates a null SDO_SRID value No checks are made for the validity or consistency of the SDO_ SRID value For example the value is not checked to see if it exists in the MDSYS CS_SRS table or if it conflicts with the SRID value for the layer in the USER_SDO_GEOM_METADATA view Coordinates are always output using the lt coordinates gt tag and decimal es that is with the comma as the coordinate separator and ts thatis with a space as the tuple separator even if the NLS_LNUMERIC_CHARACTERS setting has comma as the decimal character The GML output is not formatted there are no line breaks or indentation of tags To see the contents of the returned CLOB in SQL Plus use the TO_CHAR function or set the SOL Plus parameter LONG to a suitable value for example SET LONG 40000 To get formatted GML output or to use the return value of TO_ GMLGEOMETRY in SQLX or Oracle XML DB functions such as XMLELEMENT use the XMLTYPE clobval CLOB constructor The following example returns the GML fragment for the cola_b geometry in the COLA_MARKETS table The example uses the definitions and data from Section 2 1 Convert cola_b geometry to GML fragment SELECT TO CHAR SDO UTIL TO GMLGEOMETRY shape AS GmlGeometry FROM COLA MARKETS c WHERE c name cola b GMLGEOMETRY lt gml Polygon srsName SDO xmlns gml http www opengis net gml gt lt gml outerBou ndaryIs gt lt gml LinearRing
500. tes a WHERE a route_id 1 ROUTE ID A ROUTE GEOMETRY GET LRS DIM 11 4 Oracle Spatial Users Guide and Reference 12 Spatial Operators This chapter describes the operators that you can use when working with the spatial object data type For an overview of spatial operators including how they differ from spatial procedures and functions see Section 1 9 Table 12 1 lists the main operators Table 12 1 Main Spatial Operators Operator Description SDO_FILTER Specifies which geometries may interact with a given geometry SDO_JOIN Performs a spatial join based on one or more topological relationships SDO_NN Determines the nearest neighbor geometries to a geometry SDO_NN_DISTANCE SDO_RELATE SDO_WITHIN_DISTANCE Returns the distance of an object returned by the SDO_NN operator Determines whether or not two geometries interact in a specified way See also Table 12 2 for convenient alternative operators for performing specific mask value operations Determines if two geometries are within a specified distance from one another Table 12 2 lists operators provided for convenience that perform an SDO_RELATE operation of a specific mask type Spatial Operators 12 1 Table 12 2 Convenience Operators for SDO_RELATE Operations Operator Description SDO_ANYINTERACT Checks if any geometries in a table have the ANYINTERACT topological relationship with a specified geometry SDO_CONTAINS Checks if an
501. the data used for geocoding For example if Pleasant Valley is the base name of a street in the data used for geocoding Pleasant Vale would also match as long as there were no ambiguities or other matches in the data The postal code if provided base name house or building number and street type can be different from the data used for geocoding The address can be outside the city specified as long as it is within the same county Also includes the characteristics of RELAX_POSTAL_CODE Equivalent to RELAX_BUILTUP_AREA Equivalent to RELAX_BASE_NAME 5 1 3 Match Codes The match code is a number indicating which input address attributes matched the data used for geocoding The match code is stored in the MATCH_CODE attribute of the output SDO_GEO_ADDR object described in Section 5 2 1 Table 5 3 lists the possible match code values Table 5 3 Match Codes for Geocoding Operations Match Code Description 1 Exact match the city name postal code street base name street type and suffix or prefix or both if applicable and house or building number match the data used for geocoding 2 The city name postal code street base name and house or building number match the data used for geocoding but the street type suffix or prefix does not match 3 The city name postal code and street base name match the data used for geocoding but the house or building number does not match 4 The city name and postal code mat
502. the definitions from the example in Section 7 7 SELECT SDO_LRS VALIDATE LRS GEOMETRY a route_geometry m diminfo FROM lrs routes a user_sdo_ geom metadata m WHERE m table name LRS ROUTES AND m column_name ROUTE GEOMETRY 16 110 Oracle Spatial User s Guide and Reference SDO_LRS VALIDATE_LRS_GEOMETRY AND a route_id 1 SDO_LRS VALIDATE LRS GEOMETRY A ROUTE GEOMETRY M DIMINFO Linear Referencing Subprograms 16 111 SDO_LRS VALIDATE_LRS_GEOMETRY 16 112 Oracle Spatial Users Guide and Reference 17 SDO MIGRATE Procedure The SDO_MIGRATE TO_CURRENT procedure described in this chapter lets you upgrade spatial geometry tables from previous releases of Spatial SDO_MIGRATE TO_CURRENT is the only procedure that you should use for upgrading Do not use the SDO_MIGRATE TO_81X SDO_MIGRATE FROM_815_ TO_81X or SDO_MIGRATE TO_734 procedures which were documented in previous Spatial releases but are no longer supported SDO_MIGRATE Procedure 17 1 SDO_MIGRATE TO_CURRENT SDO_MIGRATE TO_CURRENT Format Any Object Relational Model Implementation to Current SDO_MIGRATE TO_CURRENT tabname IN VARCHAR2 column_name IN VARCHAR2 or SDO_MIGRATE TO_CURRENT tabname IN VARCHAR2 column_name IN VARCHAR2 commit_int IN NUMBER Format Any Relational Model Implementation to Current SDO_MIGRATE TO_CURRENT layer IN VARCHAR2 newtabname IN VARCHARZ2 gidcolumn IN VARCHAR2 geocolname IN VARCHA
503. the entire ocean surface of the Earth however you can create multiple elements each representing part of the overall ocean surface To take full advantage of Spatial features you must index geodetic data layers using a geodetic R tree index You can create a non geodetic R tree or quadtree index on geodetic data by specifying geodetic FALSE in the PARAMETERS clause of the CREATE INDEX statement however this is not recommended See the Usage Notes for the CREATE INDEX statement in Chapter 10 for more information In addition for Spatial release 9 0 1 and higher you must delete DROP INDEX and re create all spatial indexes on geodetic data from a release before 9 0 1 Tolerance is specified as meters for geodetic layers If you use tolerance values that are typical for non geodetic data these values are interpreted as meters for geodetic 6 6 Oracle Spatial User s Guide and Reference Local Coordinate Support data For example if you specify a tolerance value of 0 005 for geodetic data this is interpreted as precise to 5 millimeters If this value is more precise than your applications need performance may be affected because of the internal computational steps taken to implement the specified precision For more information about tolerance see Section 1 5 5 For geodetic layers you must specify the dimensional extents in the index metadata as 180 180 for longitude and 90 90 for latitude The following statement from Exa
504. the topological symmetric difference XOR operation of two geometry objects Determines if a geometry is valid and returns context information if the geometry is invalid Determines if all geometries stored in a column are valid and returns context information about any invalid geometries Determines if two geometries are within a specified distance from one another 13 2 Oracle Spatial Users Guide and Reference The following usage information applies to the geometry subprograms See also the Usage Notes under the reference information for each subprogram a Certain combinations of input parameters and operations can return a null value that is an empty geometry For example requesting the intersection of two disjoint geometry objects returns a null value A null value empty geometry as an input parameter to a geometry function for example SDO_GEOM RELATE produces an error Certain operations can return a geometry of a different type than one or both input geometries For example the intersection of a line and an overlapping polygon returns a line the intersection of two lines returns a point and the intersection of two tangent polygons returns a line Geometry Subprograms 13 3 SDO_GEOM RELATE SDO_GEOM RELATE Format SDO_GEOM RELATE geom1 IN SDO_GEOMETRY dim1 IN SDO_DIM_ARRAY mask IN VARCHAR2 geom2 IN SDO_GEOMETRY dim2 IN SDO_DIM_ARRAY RETURN VARCHAR2 or SDO_GEOM RELATE geom
505. the units of the tolerance value but instead use the number of decimal places in the data followed by a 5 for example 0 00005 This tolerance value will be used for spatial operators When you use spatial functions that require a tolerance value with this data use the function format that allows you to specify a tolerance value and specify the tolerance value in meters Specifying sdo_non leaf tbl TRUE can help query performance with large data sets if the entire R tree table may not fit in the KEEP buffer pool In this case you must also cause Oracle to buffer the MDNT_ table in the KEEP buffer pool for example by using ALTER TABLE and specifying STORAGE BUFFER_POOL KEEP For partitioned indexes the same sdo_non_leaf_tbl value must be used for all partitions Any physical storage parameters except for tablespace are applied only to the MDRT_ table The MDNT_ table uses only the tablespace parameter if specified and default values for all other physical storage parameters If you are creating a function based spatial index the number of parameters must not exceed 32 For information about using function based spatial indexes see Section 9 2 To determine if a CREATE INDEX statement for a spatial index has failed check to see if the DOMIDX_OPSTATUS column in the USER_INDEXES view is set to FAILED This is different from the case of regular indexes where you check to see if the STATUS column in the USER_INDEXES view i
506. tial and spatial attributes Examples of nonspatial attributes are name soil_type landuse_classification and part_number The spatial attribute is a coordinate geometry or vector based representation of the shape of the feature 1 4 Geometry Types A geometry is an ordered sequence of vertices that are connected by straight line segments or circular arcs The semantics of the geometry are determined by its type Spatial supports several primitive types and geometries composed of collections of these types including two dimensional a Points and point clusters a Line strings n point polygons Arc line strings All arcs are generated as circular arcs Arc polygons a Compound polygons Compound line strings Circles Optimized rectangles Two dimensional points are elements composed of two ordinates X and Y often corresponding to longitude and latitude Line strings are composed of one or more pairs of points that define line segments Polygons are composed of connected line strings that form a closed ring and the area of the polygon is implied For example a point might represent a building location a line string might represent a road or flight path and a polygon might represent a state city zoning district or city block 1 4 Oracle Spatial Users Guide and Reference Data Model Self crossing polygons are not supported although self crossing line strings are supported If a line string crosses itself
507. tion Based Indexes create or replace function get_long lat pt longitude in number latitude in number return SDO GEOMETRY deterministic is begin return sdo_geometry 2001 8307 sdo point type longitude latitude NULL NULL NULL end If the spatial data table does not already exist create the table and add data to it as in the following example that creates a table named LONG_LAT_TABLE create table LONG_LAT TABLE longitude number latitude number name varchar2 32 insert into LONG_LAT TABLE values 10 10 Placel insert into LONG_LAT TABLE values 20 20 Place2 insert into LONG_LAT TABLE values 30 30 Place3 Update the USER_SDO_GEOM_METADATA view using dot notation to specify the schema name and function name The following example specifies SCOTT GET_ LONG_LAT_PT LONGITUDE LATITUDE as the COLUMN_NAME explained in Section 2 4 2 in the metadata view Set up the metadata entry for this table The column name sets up the function on top of the two columns used in this function along with the owner of the function insert into user_sdo_geom_metadata values LONG LAT TABLE scott get_long lat pt longitude latitude sdo_dim_array sdo dim element Longitude 180 180 0 005 sdo dim element Latitude 90 90 0 005 8307 Create the spatial index specifying the function name with parameters For example create index LONG LAT TABLE IDX on LONG LAT TABLE get_lo
508. tion with a corresponding table and its index For information about exchanging partitions see the description of the ALTER TABLE statement in the Oracle Database SQL Reference This feature can help you to operate more efficiently in a number of situations such as Bringing data into a partitioned table and avoiding the cost of index re creation Managing and creating partitioned indexes For example the data could be divided into multiple tables The index for each table could be built one after the other to minimize the memory and tablespace resources needed during index creation Alternately the indexes could be created in parallel in multiple sessions The tables along with the indexes could then be exchanged with the partitions of the original data table Indexing and Querying Spatial Data 4 7 Creating a Spatial Index Managing offline insert operations New data can be stored in a temporary table and periodically exchanged with a new partition for example in a database with historical data To exchange partitions including indexes with spatial data and indexes the two spatial indexes one on the partition the other on the table must be of compatible types Specifically a Both indexes must have the same dimensionality sdo_indx_dims value a Both indexes must be either geodetic or non geodetic Geodetic and non geodetic indexes are explained in Section 4 1 2 a Neither index can have a status of deferred
509. tions see Section 7 5 3 and offset operations see Section 7 5 7 if the returned segment has any shape points within the tolerance value of the input geometric segment from what would otherwise be the start point and or end point of the returned segment the shape point is used as the start point and or end point of the returned segment This is done to ensure that the resulting geometry does not contain any redundant vertices which would cause the geometry to be invalid For example assume that the tolerance associated with the geometric segment non geodetic data in Figure 7 19 is 0 5 Figure 7 19 Segment for Clip Operation Affected by Tolerance 5 10 Q 35 10 61 257 55 10 100 Start Point End Point 20 5 30 628 If you request a clip operation to return the segment between measure values 0 the start point and 61 5 in Figure 7 19 and if the distance between the points associated with measure values 61 5 and 61 257 is less than the 0 5 tolerance value the end point of the returned segment is 35 10 61 257 7 7 Example of LRS Functions This section presents a simplified example that uses LRS functions It refers to concepts that are explained in this chapter and uses functions documented in Chapter 16 This example uses the road that is illustrated in Figure 7 20 Linear Referencing System 7 21 Example of LRS Functions Figure 7 20 Simplified LRS Example Highway Route end y Segment N Direction
510. tions from the example in Section 7 7 The measure range of this segment is 27 and 5 is approximately 18 5 percent of 27 SELECT SDO LRS MEASURE TO PERCENTAGE a route geometry m diminfo 5 FROM lrs_ routes a user_sdo geom metadata m WHERE m table name LRS ROUTES AND m column_name ROUTE GEOMETRY AND a route_id 1 SDO_LRS MEASURE TO PERCENTAGE A ROUTE GEOMETRY M DIMINFO 5 18 5185185 Linear Referencing Subprograms 16 75 SDO_LRS OFFSET_GEOM_SEGMENT SDO_LRS OFFSET_GEOM_SEGMENT Format SDO_LRS OFFSET_GEOM_SEGMENT geom_segment IN SDO_GEOMETRY start_measure IN NUMBER end_measure IN NUMBER offset IN NUMBER tolerance IN NUMBER unit IN VARCHAR2 RETURN SDO_GEOMETRY or SDO_LRS OFFSET_GEOM_SEGMENT geom_segment IN SDO_GEOMETRY dim_array IN SDO_DIM_ARRAY start_measure IN NUMBER end_measure IN NUMBER offset IN NUMBER unit IN VARCHAR2 RETURN SDO_GEOMETRY Description Returns the geometric segment at a specified offset from a geometric segment Parameters geom_segment Cartographic representation of a linear feature 16 76 Oracle Spatial Users Guide and Reference SDO_LRS OFFSET_GEOM_SEGMENT Usage Notes dim_array Dimensional information array corresponding to geom_segment usually selected from one of the xxx_SDO_GEOM_METADATA views described in Section 2 4 start_measure Start measure of geom_segment at which to start the offset operation end_measure End measure of geom_
511. to a standard geometry and returns the GML fragment for the geometry The example uses the definitions and data from Section 7 7 SET LONG 40000 Convert LRS geometry to standard geometry before using TO GMLGEOMETRY SELECT XMLTYPE SDO_UTIL TO GMLGEOMETRY SDO_LRS CONVERT_TO_STD_GEOM route_geometry AS GmlGeometry FROM lrs_routes a WHERE a route_id 1 GMLGEOMETRY lt gml LineString srsName SDO xmlns gml http ww opengis net gml gt lt gml coordinates decimal cs ts gt 2 2 2 4 8 4 12 4 12 10 8 10 5 14 lt gml coordinates gt lt gml LineString gt The following examples return GML fragments for a variety of geometry types Point geometry with coordinates in SDO ORDINATES Note the coordinates in the GML are 10 10 and the values in the SDO_ POINT field are discarded SELECT TO CHAR Spatial Utility Subprograms 19 37 SDO_UTIL TO_GMLGEOMETRY SDO_UTIL TO GMLGEOMETRY sdo geometry 2001 8307 sdo point _type 80 70 null sdo elem info array 1 1 1 sdo ordinate array 10 10 AS GmlGeometry FROM DUAL GMLGEOMETRY lt gml Point srsName SDO 8307 xmlns gml http www opengis net gml gt lt gml coordi nates decimal cs ts gt 10 10 lt gml coordinates gt lt gml Point gt LRS geometry An Empty CLOB is returned SELECT SDO_UTIL TO GMLGEOMETRY sdo geometry 2306 8307 null sdo elem info array 1 1003 1 13 1003 1 23 1003 3 sdo ordinate array 10 10 10
512. to specifying the SDO_RELATE operator with mask OVERLAPBDYDISJOINT See the section on the SDO_RELATE operator in this chapter for information about the operations performed by this operator and for usage requirements Keywords and Parameters Returns Usage Notes Value Description geometryl Specifies a geometry column in a table The column must be spatially indexed Data type is SDO_GEOMETRY geometry2 Specifies either a geometry from a table or a transient instance of a geometry Specified using a bind variable or SDO_GEOMETRY constructor Data type is SDO_GEOMETRY The expression SDO_OVERLAPBDYDISJOINT geometry1 geometry2 TRUE evaluates to TRUE for object pairs that have the OVERLAPBDYDISJOINT topological relationship and FALSE otherwise See the Usage Notes for the SDO_RELATE operator in this chapter For an explanation of the topological relationships and the nine intersection model used by Spatial see Section 1 8 Spatial Operators 12 33 SDO_OVERLAPBDYDISJOINT Examples The following example finds geometries that have the OVERLAPBDYDISJOINT relationship with a line string geometry here a horizontal line from 0 6 to 2 6 The example uses the definitions and data described in Section 2 1 and illustrated in Figure 2 1 In this example only cola_a has the OVERLAPBDYDISJOINT relationship with the line string geometry SELECT c mkt_id c name FROM cola_markets c WHERE SDO_OVERLAPBDYDISJOINT
513. tolerance keyword value in the params parameter string for the SDO_ GEOM SDO_ARC_DENSIFY function The unit of measurement associated with the geometry is associated with the arc_tolerance parameter value For more information see the Usage Notes for the SDO_GEOM SDO_ARC_DENSIFY function in Chapter 13 Spatial Utility Subprograms 19 5 SDO_UTIL CIRCLE_POLYGON Usage Notes Examples Related Topics This function is useful for creating a circle like polygon around a specified center point when a true circle cannot be used a circle is not valid for geodetic data with Oracle Spatial The returned geometry has an SDO_SRID value of 8307 for Longitude Latitude WGS 84 The following example returns a circle like polygon around a point near the center of Concord Massachusetts A circle radius of 100 meters and an arc_tolerance value of 5 meters are used in computing the polygon vertices SELECT SDO UTIL CIRCLE POLYGON 71 34937 42 46101 100 5 FROM DUAL SDO_UTIL CIRCLE POLYGON 71 34937 42 46101 100 5 SDO_GTYPE SDO SRID SDO POINT SDO GEOMETRY 2003 8307 NULL SDO ELEM INFO ARRAY 1 1003 1 SDO ORDINATE ARR AY 71 34937 42 4601107 71 348653 42 4602824 71 348211 42 4607321 71 34 8211 42 4612879 71 348653 42 4617376 71 34937 42 4619093 71 350087 42 4617376 71 350529 42 4612879 71 350529 42 4607321 71 350087 42 4602824 71 34937 42 4601107 a SDO_UTIL ELLIPSE_POLYGON 19 6 Oracle Sp
514. tor identifies the nearest neighbors for a spatial object The syntax of these operators is given in Chapter 12 The SDO_RELATE operator implements a nine intersection model for categorizing binary topological relationships between points lines and polygons Each spatial object has an interior a boundary and an exterior The boundary consists of points or lines that separate the interior from the exterior The boundary of a line string consists of its end points however if the end points overlap that is if they are the same point the line string has no boundary The boundaries of a multiline string are the end points of each of the component line strings however if the end points overlap only the end points that overlap an odd number of times are boundaries The boundary of a polygon is the line that describes its perimeter The interior consists of points that are in the object but not on its boundary and the exterior consists of those points that are not in the object Given that an object A has three components a boundary Ab an interior Ai and an exterior Ae any pair of objects has nine possible interactions between their components Pairs of components have an empty 0 or not empty 1 set intersection The set of interactions between two geometries is represented by a nine intersection matrix that specifies which pairs of components intersect and which do not Figure 1 5 shows the nine intersection matrix for two polygons that a
515. tor is as follows SDO_RELATE geometryl SDO GEOMETRY geometry2 SDO GEOMETRY param VARCHAR2 In the preceding syntax a geometry is a column of type SDO_GEOMETRY in a table This column must be spatially indexed 4 12 Oracle Spatial Users Guide and Reference Querying Spatial Data geometry2 is an object of type SDO_GEOMETRY This object may or may not come from a table If it comes from a table it may or may not be spatially indexed paramis a quoted string with the mask keyword and a valid mask value as explained in the documentation for the SDO_RELATE operator in Chapter 12 The following examples perform both primary and secondary filter operations They return all the geometries in Figure 4 2 that lie within or overlap the query window The result of these examples is objects geom_1 and geom_2 Example 4 4 performs both primary and secondary filter operations without inserting the query window into a table The window will be indexed in memory and performance will be very good Example 4 4 Secondary Filter Using a Temporary Query Window SELECT A Feature ID FROM TARGET A WHERE sdo relate A shape SDO_geometry 2003 NULL NULL SDO elem info array 1 1003 3 SDO ordinate array x1 y1 x2 y2 mask anyinteract TRUE In Example 44 x1 y1 and x2 y2 are the lower left and upper right corners of the query window Example 4 5 assumes the query window was inserted into a table called WINDOWS with an ID v
516. ts will be inserted layer_gtype One of the following values POINT or NOTPOINT default If the layer you are upgrading is composed solely of point data set this parameter to POINT for optimal performance otherwise set this parameter to NOTPOINT If you set the value to POINT and the layer contains any nonpoint geometries the upgrade might produce invalid data updateflag One of the following values UPDATE or INSERT default If you are upgrading the layer into an existing populated attribute table set this parameter to UPDATE otherwise set this parameter to INSERT SDO_MIGRATE Procedure 17 3 SDO_MIGRATE TO_CURRENT Usage Notes for Object Relational Model Upgrade All geometry objects in tabname will be upgraded so that their SDO_GTYPE and SDO_ETYPE values are in the format of the current release SDO_GTYPE values of 4 digits are created using the format ditt shown in Table 2 1 in Section 2 2 1 SDO_ETYPE values are as discussed in Section 2 2 4 The procedure also orders geometries so that exterior rings are followed by their interior rings and saves them in the correct rotation counterclockwise for exterior rings and clockwise for interior rings Usage Notes for Relational Model Upgrade Consider the following when using this procedure Examples The new table must be created before calling this procedure The procedure converts geometries from the relational model to the object relational mod
517. turned geometry semi_major_axis Length in meters of the semi major axis of the ellipse to be used to create the returned geometry semi_minor_axis Length in meters of the semi minor axis of the ellipse to be used to create the returned geometry Spatial Utility Subprograms 19 11 SDO_UTIL ELLIPSE_POLYGON Usage Notes Examples Related Topics azimuth Number of degrees of the azimuth clockwise rotation of the major axis from north of the ellipse to be used to create the returned geometry Must be from 0 to 180 The returned geometry is rotated by the specified number of degrees arc_tolerance A numeric value to be used to construct the polygon geometry The arc_ tolerance parameter value has the same meaning and usage guidelines as the arc_tolerance keyword value in the params parameter string for the SDO_ GEOM SDO_ARC_DENSIFY function The unit of measurement associated with the geometry is associated with the arc_tolerance parameter value For more information see the Usage Notes for the SDO_GEOM SDO_ARC_DENSIFY function in Chapter 13 This function is useful for creating an ellipse like polygon around a specified center point when a true ellipse cannot be used an ellipse is not valid for geodetic data with Oracle Spatial The returned geometry has an SDO_SRID value of 8307 for Longitude Latitude WGS 84 The following example returns an ellipse like polygon oriented east west azimuth 90 around a poin
518. ual and usage information and Chapter 21 for reference information about each subprogram 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 xxxii The SDO_UTIL package contains the following new subprograms a SDO_UTIL APPEND appends one geometry to another geometry to create a new geometry a SDO_UTIL CONCAT_LINES concatenates two line or multiline two dimensional geometries to create a new geometry a 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 a SDO_UTIL ELLIPSE_POLY
519. uality degradation of R tree index 18 11 R tree 1 14 QUALITY_DEGRADATION function 18 11 query 4 9 query model for Spatial 1 10 QUERY REWRITE privilege and session requirements 9 4 query window 4 10 querying geometric segments subprograms for 16 2 R range measure 7 7 rebuilding spatial indexes 10 6 rectangle minimum bounding 18 7 type 2 13 REDEFINE_GEOM_SEGMENT procedure 16 84 redefining geometric segment 7 12 Index 8 RELATE function 13 4 See also SDO_RELATE operator release number Spatial retrieving 1 22 REMOVE_DUPLICATE_VERTICES function 19 27 replication multimaster B 4 object B 2 RESET_MEASURE procedure 16 87 restrictions in current release 6 20 geodetic data 6 6 REVERSE_GEOMETRY function 16 89 REVERSE_LINESTRING function 19 29 REVERSE_MEASURE function 16 91 ring exterior and interior polygon 2 10 extracting from a geometry 19 13 rollback segment R tree index creation 4 2 R tree indexes description of indexing process 1 12 quality degradation 18 11 rebuilding 10 6 requirements before creating 4 2 sequence object 2 32 when to use 1 12 R tree quality 1 14 S SCALE_GEOM_SEGMENT function 16 93 scaling geometric segment 7 15 schema creating index on table in another schema 4 5 invoking operators on table in another schema 4 17 SDO_ADDR_ARRAY data type 5 9 SDO_AGGR_CENTROID aggregate function 14 2 SDO_AGGR_CONCAT_LINES aggregate function 14 4 SDO_AGGR_CONVE
520. uide A partitioned spatial index can provide the following benefits Reduced response times for long running queries because partitioning reduces disk I O operations Reduced response times for concurrent queries because I O operations run concurrently on each partition Easier index maintenance because of partition level create and rebuild operations Indexes on partitions can be rebuilt without affecting the queries on other partitions and storage parameters for each local index can be changed independent of other partitions Parallel query on multiple partition searching The degree of parallelism is the value from the DEGREE column in the row for the index in the USER_INDEXES view that is the value specified or defaulted for the PARALLEL keyword with the CREATE INDEX ALTER INDEX or ALTER INDEX REBUILD statement Improved query processing in multiprocessor system environments Indexing and Querying Spatial Data 4 5 Creating a Spatial Index In a multiprocessor system environment if a spatial operator is invoked on a table with partitioned spatial index and if multiple partitions are involved in the query multiple processors can be used to evaluate the query The number of processors used is determined by the degree of parallelism and the number of partitions used in evaluating the query The following restrictions apply to spatial index partitioning The partition key for spatial tables must be a scalar value a
521. us the SDO_WITHIN_DISTANCE operation is performed n times if there are n rows in the COASTLINES table For non geodetic data there is an efficient way to accomplish a spatial join that involves buffering all geometries of a layer This method does not use the SDO_ WITHIN_DISTANCE operator First create a new table COSINE_BUFS as follows CREATE TABLE cosine bufs UNRECOVERABLE AS SELECT SDO BUFFER A SHAPE B DIMINFO 1 35 FROM COSINE A USER_SDO_GEOM METADATA B WHERE TABLE NAME COSINES AND COLUMN NAME SHAPE Next create a spatial index on the SHAPE column of COSINE_BUFS Then you can perform the following query SELECT a gid b gid FROM parks a cosine bufs b TABLE SDO _ JOIN PARKS SHAPE COSINE BUFS SHAPE mask ANYINTERACT c WHERE c rowidl a rowid AND c rowid2 b rowid 4 2 1 4 Nearest Neighbor Operator The SDO_NN operator described in Chapter 12 is used to identify the nearest neighbors for a geometry This operator can be used only if a spatial index has been created on two dimensions of data The syntax of the operator is as follows SDO_NN geometryl SDO_GEOMETRY geometry2 SDO GEOMETRY param VARCHAR2 number NUMBER In the preceding syntax geometry is a column of type SDO_GEOMETRY in a table This column must be spatially indexed geometry2 is an instance of type SDO_GEOMETRY paramis a quoted string of a keyword value pair that determines how many nearest neighbor geometries
522. ut local coordinate systems see Section 6 3 You can use the SDO_CS VALIDATE_WKT function described in Chapter 15 to validate the WKT of any coordinate system defined in the MDSYS CS_SRS table 6 4 2 MDSYS SDO_ANGLE_UNITS Table The MDSYS SDO_ANGLE_UNITS reference table contains one row for each valid UNIT specification in the well known text WKT description in the coordinate system definition The WKT is described in Section 6 4 1 1 The MDSYS SDO_ANGLE_UNITS table contains the columns shown in Table 6 2 Table 6 2 MDSYS SDO_ANGLE_UNITS Table Column Name Data Type Description SDO_UNIT VARCHAR2 32 Reserved for future use by Oracle Spatial UNIT_NAME VARCHAR2 100 Name of the angle unit Specify a value from this column in the UNIT specification of the WKT for any user defined coordinate system Examples Decimal Degree Radian Decimal Second Decimal Minute Gon Grad CONVERSION_ NUMBER The ratio of the specified unit to one Radian For FACTOR example the ratio of Decimal Degree to Radian is 0 017453293 6 4 3 MDSYS SDO_DATUMS Table The MDSYS SDO_DATUMS reference table contains one row for each valid DATUM specification in the well known text WKT description in the coordinate system definition The WKT is described in Section 6 4 1 1 The MDSYS SDO_DATUMS table contains the columns shown in Table 6 3 6 12 Oracle Spatial User s Guide and Reference Coordinate Systems Data Structures Table 6 3 MDSYS
523. vide better performance than procedures and functions In addition more Spatial performance and tuning information is available in one or more white papers through the Oracle Technology Network OTN That information is often more detailed than what is in this guide and it is periodically updated as a result of internal testing and consultations with Spatial users To find that information on the OTN go to http otn oracle com products spatial Look for material relevant to Spatial performance and tuning 1 15 Spatial Release Version Number To check which release of Spatial you are running use the SDO_VERSION function For example SELECT SDO VERSION FROM DUAL SDO_VERSION 1 22 Oracle Spatial Users Guide and Reference Spatial Examples 1 16 Spatial Application Hardware Requirement Considerations This section discusses some general guidelines that affect the amount of disk storage space and CPU power needed for spatial applications They are not however intended to replace any other guidelines you use for general application sizing but to supplement them The following characteristics of spatial applications can affect the need for storage space and CPU power a Data volumes The amount of storage space needed for spatial objects depends on their complexity precision of representation and number of points for each object For example storing one million point objects takes less space than storing one million
524. views described in Section 2 4 unit Unit of measurement a quoted string with unit and an SDO_UNIT value from the MDSYS SDO_AREA_UNITS table for example unit SQ_KM See Section 2 6 for more information about unit of measurement specification If this parameter is not specified the unit of measurement associated with the data is assumed For geodetic data the default unit of measurement is square meters Geometry Subprograms 13 11 SDO_GEOM SDO_AREA tol Tolerance value see Section 1 5 5 Usage Notes This function works with any polygon including polygons with holes Lines that close to form a ring have no area If the function format with tol is used all geometry objects must be defined using 4 digit SDO_GTYPE values explained in Section 2 2 1 Examples The following example returns the areas of geometry objects stored in the COLA_ MARKETS table The first statement returns the areas of all objects the second returns just the area of cola_a The example uses the definitions and data from Section 2 1 Return the areas of all cola markets SELECT name SDO GEOM SDO_ AREA shape 0 005 FROM cola_markets NAME SDO_GEOM SDO AREA SHAPE 0 005 cola_a 24 cola_b 16 5 cola c 5 cola d 12 5663706 Return the area of just cola a SELECT c name SDO_GEOM SDO_AREA c shape 0 005 FROM cola markets c WHERE c name cola_a NAME SDO_GEOM SDO AREA C SHAPE 0 005 cola_a 24 Related Topics None 13 12 Oracle
525. w Coordinate Systems Function VALIDATE_WKT ocicinococicinnonononocinananonananincnonononanananonos XXXIV MBRs Supported with Geodetic Data cccccccccscsesesssseescecesesssesnsneseseseecenesesssnsesesesesnenssescanenens XXXIV New and Changed LRS Subprogramss cccccccecscesesesessesssseesesssssssseesesesesssesesesssssseeseseeesesees XXXV Tolerance with LRS Subprogram ccocnconnconnnnnoncncnonnananocnnononanonononnnono nono nan iii rana narra i XXXV New Tuning Function ESTIMATE _RTREE_INDEX_SIZE 1 00 cccesecessseeesseseseseeseseecseneneseeaeees XXXV Deprecated Tuning Subprogram occconococoninnnonononcnnonanananononanonanononononanononononananononononananonononarananonononos XXXV New GML Support Function TO GMLGEOMETRY inonecoccccnononconcnnnnoronarnnnranororannrararonarnrar cronos xxxvi Interior Butters nio xxxvi Tablespace for Temporary Tables During Index Creation cnicicicinononinnnnononinnoninnnenccnanananononoso xxxvi Separate Index Table for Nonleaf NOd8S ooocococonononononcnnncnncncnrnnnononanoncnnnrororannnnanananonnnrnrarnnnacananano xxxvi MDSYS No Longer Needed with Spatial Data Types oococococononinccnnonnnnrncorenicncanoanannrarannaninananonoa XXXVi DBA_SDO_xxx Views No Longer Provided ocicicococoniononnnnonnnnncneencanccnarararonononorarononononos xxxvii SDO_MIGRATE Procedures e aa ee aea ea e Es EEEE E AA aE AE a a aSa xxxvii Java Client Interface omitidos xxxvii Transportable Tablespace SUPPOTt ococicicociciconononin
526. wid2 b rowid 4 2 3 Cross Schema Operator Invocation You can invoke spatial operators on an indexed table that is not in your schema Assume that user A has a spatial table T1 with index table IDX_TAB1 with a spatial index defined that user B has a spatial table T2 with index table IDX_TAB2 with a spatial index defined and that user C wants to invoke operators on tables in one or both of the other schemas If user C wants to invoke an operator only on T1 user C must perform the following steps 1 Connect as user A and execute the following statements GRANT select on T1 to C GRANT select on idx tabl to C 2 Connect as user C and execute a statement such as the following SELECT a gid FROM Tl a WHERE sdo filter a geometry theGeometry TRUE If user C wants to invoke an operator on both T1 and T2 user C must perform the following steps 1 Connect as user A and execute the following statements GRANT select on T1 to C GRANT select on idx tabl to C 2 Connect as user B and execute the following statements GRANT select on T2 to C GRANT select on idx tab2 to C 3 Connect as user C and execute a statement such as the following Indexing and Querying Spatial Data 4 17 Querying Spatial Data SELECT a gid FROM T1 a T2 b WHERE b gid 5 AND sdo filter a geometry b geometry TRUE 4 18 Oracle Spatial Users Guide and Reference 9 Geocoding Address Data Geocoding is the process of as
527. x test_long lat_idx on test_long lat location GetGeometry indextype is mdsys spatial index Perform queries on the data The following query performs a primary filter operation asking for the names of geometries that are likely to interact spatially with point 10 10 SELECT a name FROM test_long lat a WHERE SDO FILTER a location GetGeometry SDO GEOMETRY 2001 8307 SDO_ POINT TYPE 10 10 NULL NULL NULL TRUE Extending Spatial Indexing Capabilities 9 7 SDO_GEOMETRY Objects in Function Based Indexes 9 8 Oracle Spatial User s Guide and Reference Part Il Reference 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 II contains the following chapters with reference information Chapter 10 SQL Statements for Indexing Spatial Data Chapter 11 SDO_GEOMETRY Object Type Methods Chapter 12 Spatial Operators Chapter 13 Geometry Subprograms Chapter 14 Spatial Aggregate Functions Chapter 15 Coordinate System Transformation Subprograms Chapter 16 Linear Referencing Subprograms Chapter 17 SDO_MIGRATE Procedure Chapter 18 Spatial Tuning Subprograms Chapter 19 Spatial Utility Subprograms Chapter 20 Geocoding Subprograms
528. y Dimensional information array corresponding to geom_segment usually selected from one of the xxx_SDO_GEOM_METADATA views described in Section 2 4 start_measure Distance measured from the start point of a geometric segment to the start point of the linear feature The default is the existing value if any in the measure dimension otherwise the default is 0 16 84 Oracle Spatial User s Guide and Reference SDO_LRS REDEFINE_GEOM_SEGMENT Usage Notes Examples end_measure Distance measured from the end point of a geometric segment to the start point of the linear feature The default is the existing value if any in the measure dimension otherwise the default is the cartographic length of the segment An exception is raised if geom_segment has an invalid geometry type or dimensionality or if start_measure or end_measure is out of range The _3D format of this procedure SDO_LRS REDEFINE_GEOM_SEGMENT_3D is available For information about _3D formats of LRS functions and procedures see Section 7 4 For more information about redefining a geometric segment see Section 7 5 2 The following example redefines a geometric segment effectively converting miles to kilometers in the measure values This example uses the definitions from the example in Section 7 7 First display the original segment then redefine SELECT a route_geometry FROM lrs routes a WHERE a route_id 1 ROUTE GEOMETRY SDO_GTYPE SDO SRID
529. y are on the right side Points are on a geometric segment if their offsets to the segment are zero The unit of measurement for an offset is the same as for the coordinate system associated with the geometric segment For geodetic data the default unit of measurement is meters Figure 7 2 shows how a point can be located along a geometric segment with measure and offset information By assigning an offset together with a measure it is possible to locate not only points that are on the geometric segment but also points that are perpendicular to the geometric segment 7 4 Oracle Spatial User s Guide and Reference Terms and Concepts Figure 7 2 Describing a Point Along a Segment with a Measure and an Offset Segment Direction Start Point Positive Offset End Point S M a eee Me 1 Negative Offset Measure y b4 Offset Value Point to Be Located 7 1 6 Measure Populating Any unassigned measures of a geometric segment are automatically populated based upon their distance distribution This is done before any LRS operations for geometric segments with unknown measures NULL in Oracle Spatial The resulting geometric segments from any LRS operations return the measure information associated with geometric segments The measure of a point on the geometric segment can be obtained based upon a linear mapping relationship between its previous and next known measures or locations See the algorithm representation in Figure 7 3
530. y geometries in a table have the CONTAINS topological relationship with a specified geometry SDO_COVEREDBY Checks if any geometries in a table have the COVEREDBY topological relationship with a specified geometry SDO_COVERS Checks if any geometries in a table have the COVERS topological relationship with a specified geometry SDO_EQUAL Checks if any geometries in a table have the EQUAL topological relationship with a specified geometry SDO_INSIDE Checks if any geometries in a table have the INSIDE topological relationship with a specified geometry SDO_ON Checks if any geometries in a table have the ON topological relationship with a specified geometry SDO_ Checks if any geometries in a table have the OVERLAPBDYDISJOINT OVERLAPBDYDISJOINT topological relationship with a specified geometry SDO_ Checks if any geometries in a table have the OVERLAPBDYINTERSECT OVERLAPBDYINTERSECT topological relationship with a specified geometry SDO_OVERLAPS Checks if any geometries in a table overlap that is have the OVERLAPBDYDISJOINT or OVERLAPBDYINTERSECT topological relationship with a specified geometry SDO_TOUCH Checks if any geometries in a table have the TOUCH topological relationship with a specified geometry The rest of this chapter provides reference information on the operators listed in alphabetical order 12 2 Oracle Spatial Users Guide and Reference SDO_ANYINTERACT SDO_ANYINTERACT Format Description SDO
531. ygon representing a buffer of 1 around cola_ a Note the rounded corners for example at 292893219 292893219 in the returned polygon The example uses the non geodetic definitions and data from Section 2 1 Generate a buffer of 1 unit around a geometry SELECT c name SDO GEOM SDO BUFFER c shape m diminfo 1 FROM cola_markets c user_sdo geom metadata m WHERE m table_name COLA MARKETS AND m column name SHAPE AND c name cola_a cola a SDO _ GEOMETRY 2003 NULL NULL SDO ELEM_INFO_ARRAY 1 1005 8 1 2 2 5 2 1 7 2 2 11 2 1 13 2 2 17 2 1 19 2 2 23 2 1 SDO ORDINATE ARRAY O 1 292893219 292893219 1 0 5 0 5 70710678 292893219 6 Ls 6 Fy 5 70710678 7 70710678 5 8 1 8 292893219 7 70710678 0 7 0 1 The following example returns a polygon representing a buffer of 1 around cola_a using the geodetic definitions and data from Section 6 8 Generate a buffer of 1 kilometer around a geometry SELECT c name SDO GEOM SDO BUFFER c shape m diminfo 1 unit km arc_tolerance 0 05 FROM cola markets c user sdo geom metadata m WHERE m table name COLA MARKETS AND m column_name SHAPE AND c name cola a cola a SDO GEOMETRY 2003 8307 NULL SDO ELEM INFO ARRAY 1 1003 1 SDO ORDINATE ARR AY 991023822 1 00002073 992223711 995486419 99551726 99217077 1 00001 929 990964898 4 99998067 990964929 5 00448268 9921708 5 00777624 9954 86449 5 0
532. ypes and Metadata 2 19 Geometry Examples required to represent this shape points 6 10 10 1 and 14 10 describe one acute angle shaped line string and points 14 10 10 14 and 6 10 describe the circular arc The starting point of the line string and the ending point of the circular arc are the same point 6 10 The SDO_ELEM_INFO array contains three triplets for this compound line string These triplets are 1 1005 2 1 2 1 5 2 2 Figure 2 5 Compound Polygon 01234 56 7 8 9 10 1112 1314 15 In the SDO_GEOMETRY definition of the geometry illustrated in Figure 2 5 a SDO_GTYPE 2003 The 2 indicates two dimensional and the 3 indicates a polygon a SDO_SRID NULL a SDO_POINT NULL a SDO_ELEM_INFO 1 1005 2 1 2 1 5 2 2 There are three triplet elements 1 1005 2 1 2 1 and 5 2 2 The first triplet indicates that this element is a compound polygon made up of two subelement line strings which are described using the next two triplets 2 20 Oracle Spatial Users Guide and Reference Geometry Examples The second triplet indicates that the first subelement line string is made up of straight line segments and that the ordinates for this line string start at offset 1 The end point of this line string is determined by the starting offset of the second line string 5 in this instance Because the vertices are two
Download Pdf Manuals
Related Search
Related Contents
英語・日本語 - Scosche RocketFish RF-MFH2 User guide Roger インスパイロ クイックガイド Manual (1) 海外有名選手を招待する競技大会主催者への注意喚起 Sistema de Válvula de Controle e Atuador GX Fisherr Tool Catalog - Racine Railroad 8 - Baby Lock Canada Extending Forth in a Camac Controlled Muon Channel Copyright © All rights reserved.
Failed to retrieve file