gws.gis.gml

GML support.

GML documentation: https://www.ogc.org/standards/gml

Source code: gws.gis.gml

Submodules

Package Contents

gws.gis.gml.is_geometry_element(el: gws.XmlElement) bool

Checks if the current element is a valid geometry type.

Parameters:

el – A GML element.

Returns:

True if the element is a geometry type.

gws.gis.gml.parse_envelope(el: gws.XmlElement, default_crs: gws.Crs = None, always_xy: bool = False) gws.Bounds

Parse a gml:Box/gml:Envelope element

Parameters:
  • el – A xml-Element.

  • default_crs – A Crs object.

  • always_xy – If True, coordinates are assumed to be in the XY (lon/lat) order.

Returns:

A Bounds object.

gws.gis.gml.parse_geometry(el: gws.XmlElement) dict

Convert a GML geometry element to a geometry dict.

Parameters:

el – A GML element.

Returns:

The GML geometry as a geometry dict.

gws.gis.gml.parse_shape(el: gws.XmlElement, default_crs: gws.Crs = None, always_xy: bool = False) gws.Shape

Convert a GML geometry element to a Shape.

Parameters:
  • el – A GML element.

  • default_crs – A Crs object.

  • always_xy – If True, coordinates are assumed to be in the XY (lon/lat) order.

Returns:

A GWS shape object.

gws.gis.gml.shape_to_element(shape: gws.Shape, version: int = 3, coordinate_precision: int | None = None, always_xy: bool = False, with_xmlns: bool = True, with_inline_xmlns: bool = False, namespace: gws.XmlNamespace | None = None, crs_format: gws.CrsFormat | None = None) gws.XmlElement

Convert a Shape to a GML geometry element.

Parameters:
  • shape – A Shape object.

  • version – GML version (2 or 3).

  • coordinate_precision – The amount of decimal places.

  • always_xy – If True, coordinates are assumed to be always in the XY (lon/lat) order.

  • with_xmlns – If True add the “gml” namespace prefix.

  • with_inline_xmlns – If True add inline “xmlns” attributes.

  • namespace – Use this namespace (default “gml”).

  • crs_format – Crs format to use (default “url” for version 2 and “urn” for version 3).

Returns:

A GML element.