package documentation

Shape object.

The Shape object implements the IShape protocol (georefenced geometry). Internally, it holds a pointer to a Shapely geometry object and a Crs object.

From __init__.py:

Class Props Shape properties object.
Class Shape Undocumented
Exception Error Undocumented
Function from_bounds Creates a polygon Shape from a Bounds object.
Function from_dict Creates a Shape from a dictionary.
Function from_extent Creates a polygon Shape from an extent.
Function from_geojson Creates a shape object from a GeoJSON geometry dict.
Function from_props Creates a Shape from a properties object.
Function from_wkb Creates a shape object from a WKB byte string.
Function from_wkb_element Undocumented
Function from_wkb_hex Creates a shape object from a hex-encoded WKB string.
Function from_wkt Creates a shape object from a WKT string.
Function from_xy Creates a point Shape from coordinates.
Function _from_wkb Undocumented
Function _shapely_shape Undocumented
Function _swap_xy Undocumented
Constant _CIRCLE_RESOLUTION Undocumented
Constant _MIN_TOLERANCE_POLYGON Undocumented
Constant _TOLERANCE_QUAD_SEGS Undocumented
_TOLERANCE_QUAD_SEGS: int = (source)

Undocumented

Value
6
_MIN_TOLERANCE_POLYGON: float = (source)

Undocumented

Value
0.01
def from_wkt(wkt: str, default_crs: gws.ICrs = None) -> gws.IShape: (source)

Creates a shape object from a WKT string.

Parameters
wkt:strA WKT or EWKT string.
default_crs:gws.ICrsDefault Crs.
Returns
gws.IShapeA Shape object.
def from_wkb(wkb: bytes, default_crs: gws.ICrs = None) -> gws.IShape: (source)

Creates a shape object from a WKB byte string.

Parameters
wkb:bytesA WKB or EWKB byte string.
default_crs:gws.ICrsDefault Crs.
Returns
gws.IShapeA Shape object.
def from_wkb_hex(wkb: str, default_crs: gws.ICrs = None) -> gws.IShape: (source)

Creates a shape object from a hex-encoded WKB string.

Parameters
wkb:strA hex-encoded WKB or EWKB byte string.
default_crs:gws.ICrsDefault Crs.
Returns
gws.IShapeA Shape object.
def _from_wkb(wkb: bytes, default_crs): (source)

Undocumented

def from_wkb_element(element: sa.geo.WKBElement, default_crs): (source)

Undocumented

def from_geojson(geojson: dict, crs: gws.ICrs, always_xy=False) -> gws.IShape: (source)

Creates a shape object from a GeoJSON geometry dict.

Parses a dict as a GeoJSON geometry object (https://www.rfc-editor.org/rfc/rfc7946#section-3.1).

The coordinates are assumed to be in the projection order, unless always_xy is True.

Parameters
geojson:dictA GeoJSON geometry dict
crs:gws.ICrsA Crs object.
always_xyIf True, coordinates are assumed to be in the XY (lon/lat) order
Returns
gws.IShapeA Shape object.
def from_props(props: gws.Props) -> gws.IShape: (source)

Creates a Shape from a properties object.

Parameters
props:gws.PropsA properties object.
Returns
gws.IShapeA Shape object.
def from_dict(d: dict) -> gws.IShape: (source)

Creates a Shape from a dictionary.

Parameters
d:dictA dictionary with the keys 'crs' and 'geometry'.
Returns
gws.IShapeA Shape object.
def from_extent(extent: gws.Extent, crs: gws.ICrs, always_xy=False) -> gws.IShape: (source)

Creates a polygon Shape from an extent.

Parameters
extent:gws.ExtentA hex-encoded WKB byte string.
crs:gws.ICrsA Crs object.
always_xyIf True, coordinates are assumed to be in the XY (lon/lat) order
Returns
gws.IShapeA Shape object.
def from_bounds(bounds: gws.Bounds) -> gws.IShape: (source)

Creates a polygon Shape from a Bounds object.

Parameters
bounds:gws.BoundsA Bounds object.
Returns
gws.IShapeA Shape object.
def from_xy(x: float, y: float, crs: gws.ICrs) -> gws.IShape: (source)

Creates a point Shape from coordinates.

Parameters
x:floatX coordinate (lon/easting)
y:floatY coordinate (lat/northing)
crs:gws.ICrsA Crs object.
Returns
gws.IShapeA Shape object.
def _swap_xy(geom): (source)

Undocumented

_CIRCLE_RESOLUTION: int = (source)

Undocumented

Value
64
def _shapely_shape(d): (source)

Undocumented