Download Oracle Spatial User's Guide and Reference
Transcript
SDO_SAM.AGGREGATES_FOR_GEOMETRY 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 either of the following: ■ The distance keyword and optionally the unit keyword (unit of measurement associated with the distance value), to specify a buffer around the geometry. For example, 'distance=2 unit=km' specifies a 2-kilometer buffer around the input geometry. If dst_spec is not specified, no buffer is used. 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.10 for more information about unit of measurement specification. ■ The sdo_num_res keyword, to specify the number of nearest-neighbor geometries to consider, without considering proportional coverage. For example, 'sdo_num_res=5' could be used in a query that asks for the populations of the five cities that are nearest to a specified point. Examples 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 area 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 ; 29-4 Oracle Spatial Developer’s Guide