draw

Draw geometries as SVG elements

svgis.draw.geometry(geom, bbox=None, precision=None, **kwargs)

Draw a geometry. Will return either a single geometry or a group.

Parameters:
  • geom (object) – A GeoJSON-like geometry object. Coordinates must be 2-dimensional.
  • bbox (tuple) – An optional bounding minimum bounding box
  • precision (int) – Rounding precision, must be 0 or greater (default: no rounding).
  • kwargs (object) – keyword args to be passed onto the created elements (e.g. class, id, style).
Returns:

str representation of SVG element(s) of the given geometry.

svgis.draw.geometrycollection(collection, bbox, precision, **kwargs)

Serialize diverse geometry rtpes to svg.

svgis.draw.group(geometries, **kwargs)

Add a list of geometries to a group.

Parameters:geometries (Sequence) – GeoJSON-like geometry dicts.
Returns:str representation of the SVG group
svgis.draw.lines(geom, **kwargs)

Draw a LineString or MultiLineString geometry.

Parameters:geom (object) – A GeoJSON-like LineString or MultiLineString geometry object.
Returns:str representation of the SVG group or polyline element(s).
svgis.draw.linestring(coordinates, **kwargs)

Serialize coordinates to a svg line.

svgis.draw.multilinestring(coordinates, **kwargs)

Serialize lists of coordinates to a multiline svg lines.

svgis.draw.multipoint(coordinates, **kwargs)

Serialize coordinates to multiple svg points.

svgis.draw.multipolygon(coordinates, **kwargs)

Serialize lists of lists of coordinates to multiple svg polygons.

svgis.draw.points(geom, **kwargs)

Draw a Point or MultiPoint geometry

Parameters:geom (object) – A GeoJSON-like Point or MultiPoint geometry object.
Returns:str representation of the SVG group, or circle element
svgis.draw.polygon(coordinates, **kwargs)

Serialize lists of coordinates to a svg polygon.

Parameters:coordinates (sequence) – Sequence of rings.
Returns:str representation of an svg path
svgis.draw.polygons(geom, **kwargs)

Draw polygon(s) in a feature. transform is a function to operate on coords. Draws first ring clockwise, and subsequent ones counter-clockwise.

Parameters:geom (object) – A GeoJSON-like Polygon or MultiPolygon geometry object.
Returns:str representation of the SVG group, path or polygon element.