Parsing GML geometries
Project description
pygml
A pure python parser and encoder for OGC GML Geometries.
Installation
$ pip install pygml
Features
Parse GML 3.1, 3.2, compact encoded GML 3.3 and GeoRSS geometries to a Geo Interface compliant class.
>>> import pygml
>>> geom = pygml.parse("""
... <gml:Point gml:id="ID" xmlns:gml="http://www.opengis.net/gml/3.2">
... <gml:pos>1.0 1.0</gml:pos>
... </gml:Point>
... """)
>>> print(geom)
Geometry(geometry={'type': 'Point', 'coordinates': (1.0, 1.0)})
>>> print(geom.__geo_interface__)
{'type': 'Point', 'coordinates': (1.0, 1.0)}
Conversely, it is possible to encode GeoJSON or Geo Interfaces to GML
>>> from pygml.v32 import encode_v32
>>> from lxml import etree
>>> tree = encode_v32({'type': 'Point', 'coordinates': (1.0, 1.0)}, 'ID')
>>> print(etree.tostring(tree, pretty_print=True).decode())
<gml:Point xmlns:gml="http://www.opengis.net/gml/3.2" srsName="urn:ogc:def:crs:OGC::CRS84" gml:id="ID">
<gml:pos>1.0 1.0</gml:pos>
</gml:Point>
>>>
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pygml-0.2.1.tar.gz
(29.3 kB
view hashes)
Built Distribution
pygml-0.2.1-py2.py3-none-any.whl
(44.6 kB
view hashes)
Close
Hashes for pygml-0.2.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f4bbbe3f9d6da7b735404db0d2e1598acbcb8ae15bfeaaa21c01943f41086281 |
|
MD5 | 35981f04dc7523869c28510192421cab |
|
BLAKE2b-256 | 5845a9d83a5d7bf5f2a41a64b23a463e8225d67fbefec9c605b7d5ae10c1d5a5 |