Using Oracle Spatial to calculate the length and area of a geometric object

Source: Internet
Author: User

I. Length of geometric objects

Format:

 

Sdo_geom.sdo_length (Geom In MDSYS. sdo_geometry, dim In MDSYS. sdo_dim_array [ , Unit in varchar2 ] ) Return   Number ;

Or

 

Sdo_geom.sdo_length (Geom In MDSYS. sdo_geometry, Tol In   Number [ , Unit in varchar2 ] ) Return   Number ;


Note:

Returns the length or perimeter of a geometric object.

Parameter description:

Geom.: ry object.

Dim: array of dimension information corresponding to Geom, which is usually obtained from the xxx_sdo_geom_metadata view.

Unit: the unit of measurement. Use a string with quotation marks in the form of unit = value. The value is derived from a sdo_unit value in the MDSYS. sdo_dist_units table. If this parameter is not specified, the measurement unit is the unit associated with the data.

Tol: tol.

Usage notes

If the input polygon contains one or more holes, the function calculates the perimeter of the outer boundary and all holes, and then accumulates these perimeter to obtain the final total perimeter.

If the tol value is used in the function Format, all ry must be defined using a four-digit sdo_gtype value.

Example

The following example shows the ry perimeter in the "Exploration and Development Project. The SQL statement returns the perimeter of all ry.

Select C. xmmc, sdo_geom.sdo_length (C. geometry2, M. diminfo)

FromExploration and Development Project C, MDSYS. user_sdo_geom_metadata m

 WhereM. table_name= 'Exploration and Development Projects'

AndM. column_name= 'Geometry2';

2. Area of the geometric object

Format:

 

Sdo_geom.sdo_area (Geom In MDSYS. sdo_geometry, dim In MDSYS. sdo_dim_array [ , Unit in varchar2 ] ) Return   Number ;

Or

 

Sdo_geom. sdo_area (Geom In MDSYS. sdo_geometry, Tol In   Number [ , Unit in varchar2 ] ) Return   Number ;

 

Note:

Returns the area of a two-dimensional ry polygon.

Parameter description:

Geom.: ry object.

Dim: array of dimension information corresponding to Geom, which is usually obtained from the xxx_sdo_geom_metadata view.

Unit: the unit of measurement. Use a string with quotation marks in the form of unit = value. Its value comes from the MDSYS. sdo_area_units table (for example, unit = sq_km ).

If unit is specified, the value must come from the MDSYS. sdo_dist_units table. If no unit is specified, the unit value associated with the ry is used. The default measurement unit for location data is square meters.

Tol: tol.

Usage notes

This function can work on any polygon, including a polygon with holes. If the tol parameter is included, all ry must be defined using a four-digit sdo_gtype value.

Example

The following example shows the area of the ry in the "Exploration and Development Project. The SQL statement returns the area of all ry.

Select C. xmmc, sdo_geom.sdo_area (C. geometry2, M. diminfo)

from Exploration and Development Project C, MDSYS. user_sdo_geom_metadata m

where M. table_name = ' exploration and development project '

and M. column_name = ' geometry2 ' ;

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.