GML output

Topological GML can be retrieved from the database using the topology.AsGML function. The simplest use case is to supply a single argument, the TopoGeometry column:

SELECT topology.AsGML(topogeom) FROM countries WHERE name='Nulland'; 

<gml:TopoSurface><gml:directedFace><gml:Face gml:id="F4258"><gml:directedEdge orientation="-"><gml:Edge gml:id="E4766"><gml:directedNode orientation="-"><gml:Node gml:id="N4568"/></gml:directedNode><gml:directedNode><gml:Node gml:id="N4574"/></gml:directedNode><gml:curveProperty><gml:Curve srsName="urn:ogc:def:crs:EPSG::4326"><gml:segments><gml:LineStringSegment><gml:posList srsDimension="2">-1 1 0 1</gml:posList></gml:LineStringSegment></gml:segments></gml:Curve></gml:curveProperty></gml:Edge></gml:directedEdge><gml:directedEdge orientation="-"><gml:Edge gml:id="E4774"><gml:directedNode orientation="-"><gml:Node gml:id="N4574"/></gml:directedNode><gml:directedNode><gml:Node gml:id="N4578"/></gml:directedNode><gml:curveProperty><gml:Curve srsName="urn:ogc:def:crs:EPSG::4326"><gml:segments><gml:LineStringSegment><gml:posList srsDimension="2">0 1 1 1 1 -1 0 -1 -1 -1 -1 0.001</gml:posList></gml:LineStringSegment></gml:segments></gml:Curve></gml:curveProperty></gml:Edge></gml:directedEdge><gml:directedEdge orientation="-"><gml:Edge gml:id="E4779"><gml:directedNode orientation="-"><gml:Node gml:id="N4578"/></gml:directedNode><gml:directedNode><gml:Node gml:id="N4568"/></gml:directedNode><gml:curveProperty><gml:Curve srsName="urn:ogc:def:crs:EPSG::4326"><gml:segments><gml:LineStringSegment><gml:posList srsDimension="2">-1 0.001 -1 1</gml:posList></gml:LineStringSegment></gml:segments></gml:Curve></gml:curveProperty></gml:Edge></gml:directedEdge></gml:Face></gml:directedFace></gml:TopoSurface>

This will output a GML with a gml namespace. The second optional argument can be given, and PostGIS will output XML elements in a custom namespace, such as topogml:

SELECT topology.AsGML(topogeom,'topogml') FROM countries WHERE name='Nulland'; 

<topogml:TopoSurface><topogml:directedFace><topogml:Face topogml:id="F4258">...

Alternatively, we can create a GML document without namespaces, in which case we'll supply an empty string as the second argument:

SELECT topology.AsGML(topogeom,'') FROM countries WHERE name='Nulland'; 

<TopoSurface><directedFace><Face id="F4258"><directedEdge orientation="-"><Edge id="E4766">...
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset