pyiem.wellknowntext module#

Convert Well-Known Text format to python objects

Main entry point is the convert_well_known_text function which takes a geometry in Well-Known Text format and returns a python object with the geometry.

pyiem.wellknowntext.parse_coordinate_lists(wkt)[source]#

Return the coordinates in wkt as a list of lists of coordinate pairs.

The wkt parameter is the coordinate part of a geometry in well-known text format.

pyiem.wellknowntext.parse_multipolygon(wkt)[source]#

Return the MULTIPOLYGON geometry wkt as a list of lists of float pairs

pyiem.wellknowntext.parse_polygon(wkt)[source]#

Return the POLYGON geometry in wkt as a list of float pairs

pyiem.wellknowntext.parse_multilinestring(wkt)[source]#

Return the MULTILINESTRING geometry wkt as a list of lists of float pairs

pyiem.wellknowntext.parse_linestring(wkt)[source]#

Return the LINESTRING geometry in wkt as a list of float pairs

pyiem.wellknowntext.parse_point(wkt)[source]#

Return the POINT geometry in wkt format as pair of floats

pyiem.wellknowntext.convert_well_known_text(wkt)[source]#

Return the geometry given in well-known text format as python objects

The function accepts only 2D data and supports the POINT, POLYGON, MULTIPOLYGON, LINESTRING and MULTILINESTRING geometries.

The structure of the return value depends on the geometry type. For MULTIPOLYGON and MULTILINESTRING return a list of lists of coordinate pairs. For POLYGON and LINESTRING return a list of coordinate pairs. For POINT return a coordinate pair. All coordinates are floats.

The string wkt may contain an SRID specification in addition to the actual geometry. This SRID is ignored.