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.2.tar.gz
(29.4 kB
view details)
Built Distribution
pygml-0.2.2-py2.py3-none-any.whl
(44.8 kB
view details)
File details
Details for the file pygml-0.2.2.tar.gz
.
File metadata
- Download URL: pygml-0.2.2.tar.gz
- Upload date:
- Size: 29.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0f20639344ec3c1779fec7953d934a3909e96b4db0b18f91c3340375f4a99b01 |
|
MD5 | b11dcee57a9e98a33e3032f8af799e7f |
|
BLAKE2b-256 | 3fb6559d70f6e1453314a3df795f09ab27c86029dea55a87c86deb5b2af9ea4e |
File details
Details for the file pygml-0.2.2-py2.py3-none-any.whl
.
File metadata
- Download URL: pygml-0.2.2-py2.py3-none-any.whl
- Upload date:
- Size: 44.8 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 075f0c6b99b0f26ed49c28c74dfc55692dfb378f7dc7ba5e8672f6860323cfa3 |
|
MD5 | 2905b8c4dbc30f9b87a0f4eb0fef56e3 |
|
BLAKE2b-256 | 961b4a3be5785f49432ea71f18bfd01aec670fb4e34ba0868a353f347520fec6 |