GeoScript

Previous topic

geom.io

Next topic

JSON

This Page

GML

geoscript.geom.io.gml.readGML(input, ver=2)

Reads a geometry from GML.

input is the GML to read specified as a str, file, or some other input stream.

ver specifies the gml version to encode. Supported versions include 2, 3, and 3.2.

>>> readGML('<gml:Point xmlns:gml="http://www.opengis.net/gml"><gml:coord><gml:X>1.0</gml:X><gml:Y>2.0</gml:Y></gml:coord></gml:Point>')
POINT (1 2)
geoscript.geom.io.gml.writeGML(g, ver=2, format=True, xmldecl=False)

Writes a geometry object as GML.

ver specifies the gml version to encode. Supported versions include 2, 3, and 3.2.

format specifies whether to format or pretty print the result.

xmldecl specifies whether to include the XML declaration in the result.

>>> from geoscript.geom import Point 
>>> writeGML(Point(1,2), format=False)
u'<gml:Point xmlns:gml="http://www.opengis.net/gml" xmlns:xlink="http://www.w3.org/1999/xlink"><gml:coord><gml:X>1.0</gml:X><gml:Y>2.0</gml:Y></gml:coord></gml:Point>'