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.3.2.tar.gz
(29.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
pygml-0.3.2-py2.py3-none-any.whl
(44.9 kB
view details)
File details
Details for the file pygml-0.3.2.tar.gz.
File metadata
- Download URL: pygml-0.3.2.tar.gz
- Upload date:
- Size: 29.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eeb4175daa25200881b90c071df3d9249079b7e0c78485d7d773974556892b16
|
|
| MD5 |
19f87aba359ed7aa7e6253bc7b54ddcf
|
|
| BLAKE2b-256 |
a572dfa8e0ccc7b692322c2c4541b2c285b0022cb7b4e0eb436aa7b67daf6873
|
File details
Details for the file pygml-0.3.2-py2.py3-none-any.whl.
File metadata
- Download URL: pygml-0.3.2-py2.py3-none-any.whl
- Upload date:
- Size: 44.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1aeeeac8f1ba7c07fd6e9cc5d9c61892e2e3574a165abf3005934237baa70961
|
|
| MD5 |
a29482f820d6931e56cc0a1977f38023
|
|
| BLAKE2b-256 |
6dd34829b61d0048b2097ce403d4dafb4687de1ce3fbd2bacee3cbab494e4669
|