gws.gis.gml

GML support.

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

Source code: gws.gis.gml

Submodules

Package Contents

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_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.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.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.shape_to_element(shape: gws.Shape, coordinate_precision: int | None = None, always_xy: bool = False, crs_format: gws.CrsFormat = gws.CrsFormat.urn, namespace: gws.XmlNamespace | None = None, with_xmlns: bool = True, with_inline_xmlns: bool = False) gws.XmlElement

Convert a Shape to a GML3 geometry element.

Parameters:
  • shape – A GWS shape object.

  • coordinate_precision – The amount of decimal places.

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

  • crs_format – The crs format in the resulting GML element.

  • namespace – A XML namespace.

  • with_xmlns – If True then namespaces will be kept.

  • with_inline_xmlns – If True then the inline namespace will be kept.

Returns:

A GML element.