Skip to content

geopython/pygml

Folders and files

NameName
Last commit message
Last commit date

Latest commit

69d7913 · May 22, 2024

History

75 Commits
Jul 23, 2021
Dec 21, 2021
May 22, 2024
May 22, 2024
Dec 21, 2021
Jul 14, 2021
Aug 1, 2021
Aug 31, 2021
Aug 1, 2021
Jul 13, 2021
Aug 1, 2021
Sep 21, 2021
Jul 14, 2021
Jul 14, 2021

Repository files navigation

pygml

A pure python parser and encoder for OGC GML Geometries.

PyPI version CI Documentation Status

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>

>>>

About

No description, website, or topics provided.

Resources

License

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

Languages