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.0.tar.gz
(29.3 kB
view details)
Built Distribution
pygml-0.2.0-py2.py3-none-any.whl
(44.6 kB
view details)
File details
Details for the file pygml-0.2.0.tar.gz
.
File metadata
- Download URL: pygml-0.2.0.tar.gz
- Upload date:
- Size: 29.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8405de005caeeffae3676ecba61cb2394e0fb9b5d8f4cb6089c9ce83ddef8e4c |
|
MD5 | 3e756aa313bd46acb863cca4a719bcf3 |
|
BLAKE2b-256 | 480f6d0c30e34409d9e5e74caccd0a7135857be7ff6f4869908ff0273ace9295 |
Provenance
File details
Details for the file pygml-0.2.0-py2.py3-none-any.whl
.
File metadata
- Download URL: pygml-0.2.0-py2.py3-none-any.whl
- Upload date:
- Size: 44.6 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dba4865854a2b51f79c47027dcc5a20ad24550f18294755e8bf7a07b97ff2c6a |
|
MD5 | 6141750ab35c9497f2b6d24ecddaa486 |
|
BLAKE2b-256 | 69d79da22f7b58301d462c9e3fb4bd430d990d6ce4070cb31692cf6f565c63ec |