The ST_PointFromGML() function
The ST_PointFromGML() function takes a GML2 or GML3 string representation of an ST_Point and an optional spatial reference ID and returns a point object.
Syntax
ST_PointFromGML(gmlstring lvarchar)
ST_PointFromGML(gmlstring lvarchar, SRID integer)
Return type
ST_Point
Example
The point_t table contains
the gid INTEGER column, which uniquely identifies each row, the pdesc
column which describes the point, and the p1 column which stores the
point. In this example, GML3 is shown.
CREATE TABLE point_t (gid INTEGER, pdesc VARCHAR(30), p1 ST_Point);
INSERT INTO point_t VALUES(
1,
'This point is a simple XY point',
ST_PointFromGML('<gml:Point srsName="DEFAULT" srsDimension="2">
<gml:pos>10.02 20.01</gml:pos></gml:Point>',1000)) ;
INSERT INTO point_t VALUES(
2,
'This point is a XYZ point',
ST_PointFromGML('<gml:Point srsName="DEFAULT" srsDimension="3">
<gml:pos>10.02 20.01 5</gml:pos></gml:Point>',1000)) ;
INSERT INTO point_t VALUES(
3,
'This point is a XYM point',
ST_PointFromGML('<gml:Point srsName="DEFAULT" srsDimension="3">
<gml:pos>10.02 20.01 7</gml:pos></gml:Point>',1000));
INSERT INTO point_t VALUES(
4,
'This point is a XYZM point',
ST_PointFromGML('<gml:Point srsName="DEFAULT" srsDimension="4">
<gml:pos>10.02 20.01 5 7</gml:pos></gml:Point>',1000)) ;
INSERT INTO point_t VALUES(
5,
'This point is an empty point',
ST_PointFromGML('<gml:Point xsi:nil="true" srsName="UNKNOWN:0"
srsDimension="2"/>',1000));