Oracle spatial converts Geometry to a gml string

Source: Internet
Author: User
Tags sdo


Oracle spatial converts Geometry to the gml string oracle spatial has a function that converts geometry to gml. The function name is SDO_UTIL.TO_GMLGEOMETRY (geo ).
This geo is SDO. Geometry type, but the return value of this function is Clob type Geometry. Of course we can.
Use the TO_CHAR function to convert it to the string type. The following is a test SQL statement: select t. objectid, TO_CHAR (sdo_util.TO_GMLGEOMETRY (t. shape) as gml, t. comp_type, t. datatype, t. comp_name, t. health_lic, t. shape. SDO_POINT.X as x, t. shape.
SDO_POINT.Y as y, t. reg_addr, t. bus_addr from t_publicplaces t where 1 = 1 and substr (t. comp_type,) = '01' and sdo_within_distance (t. SHAPE, SDO_GEOMETRY (116.4, 8307, SDO_POINT_TYPE (39.9, NULL), NULL,
NULL), 'distance = 1500.0 unit = M') = 'true' the gml string queried by www.2cto.com is: <gml: Point srsName = "SDO: 8307" xmlns: gml = "http://www.opengis.net/gml"> <gml: coordinates
Decimal = "." cs = "," ts = ""> 116.4, 39.9 </gml: coordinates> </gml: Point>. Because the front-end uses openlayers as the client openlayers, it often receives string data such as gml, wkt, and geojson.
As for wkt oralce spatial, the function name is get_wkt (), which is a direct geometry method.
The above function is changed to: www.2cto.com select t. objectid, TO_CHAR (t. shape. get_wkt () AS wkt, t. comp_type, t. datatype, t. comp_name, t. health_lic, t. shape. SDO_POINT.X as x, t. shape.
SDO_POINT.Y as y, t. reg_addr, t. bus_addr from t_publicplaces t where 1 = 1 and substr (t. comp_type,) = '01' and sdo_within_distance (t. SHAPE, SDO_GEOMETRY (116.4, 8307, SDO_POINT_TYPE (39.9, NULL), NULL,
NULL), 'distance = 1500.0 unit = M') = 'true' query wkt string: POINT (116.4 39.9 ). If it is designed for geojson, there is currently no solution, you can only spell the geojson string by yourself using the program (see its official website for rules: http://geojson.org /)
 

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.