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 /)