The ST_MPointFromGML() function
The ST_MPointFromGML() function takes a GML2 or GML3 string representation of an ST_MultiPoint and an optional spatial reference ID and returns a polygon object.
Syntax
ST_MPointFromGML(gmlstring lvarchar)
ST_MPointFromGML(gmlstring lvarchar, SRID integer)
Return type
ST_MultiPoint
Example
The gml_pointtest table
is created with the SMALLINT column gid and the ST_MultiPoint
column mpt1:
CREATE TABLE gml_pointtest(gid smallint, mpt1 ST_MultiPoint);
INSERT INTO gml_pointtest VALUES (1, ST_MPointFromGML('<gml:MultiPoint>
<gml:PointMember><gml:Point><gml:pos>-110.45 45.256</gml:pos>
</gml:Point></gml:PointMember><gml:PointMember><gml:Point>
<gml:pos>-99.45 33.256</gml:pos></gml:Point></gml:PointMember>
</gml:MultiPoint>',4));
INSERT INTO gml_pointtest VALUES (2, ST_MPointFromGML('<gml:MultiPoint
srsName="EPSG:4326" srsDimension="3"><gml:PointMember><gml:Point
srsName="EPSG:4326" srsDimension="3"><gml:pos>-110.449999933
45.2559999343 10</gml:pos></gml:Point></gml:PointMember>
<gml:PointMember><gml:Point srsName="EPSG:4326" srsDimension="3">
<gml:pos>-99.86 33.84 20</gml:pos></gml:Point></gml:PointMember>
</gml:MultiPoint>'));
INSERT INTO gml_pointtest VALUES (3, ST_MPointFromGML('<gml:MultiPoint
srsName="EPSG:4326" srsDimension="4"><gml:PointMember><gml:Point
srsName="EPSG:4326" srsDimension="4"><gml:pos>-109.47999994
46.4600005499 10 58</gml:pos></gml:Point></gml:PointMember>
<gml:PointMember><gml:Point srsName="EPSG:4326" srsDimension="4">
<gml:pos>-99.45 33.256 10 54</gml:pos></gml:Point></gml:PointMember>
</gml:MultiPoint>'));
The first record
specifies a spatial reference ID of 4
(WGS84) and
a default dimension of 2
. The second and third records
contain Z and M measures and pass the spatial reference ID through
the srsName attribute.
Output:
SELECT * FROM gml_pointtest;
gid 1
mpt1 4 MULTIPOINT (-110.449999933 45.2559999343, -99.4499999329 33.2559999343)
gid 2
mpt1 4 MULTIPOINT Z (-110.449999933 45.2559999343 10, -99.8600000805 33.840000
0201 20)
gid 3
mpt1 4 MULTIPOINT ZM (-109.47999994 46.4600005499 10 58, -99.4499999329 33.255
9999343 10 54)
3 row(s) retrieved.