spatialdata.models.ShapesModel#
- class spatialdata.models.ShapesModel#
Attributes table#
Methods table#
|
Parse shapes data. |
|
Validate data. |
Attributes#
- ShapesModel.ATTRS_KEY = 'spatialdata_attrs'#
- ShapesModel.GEOMETRY_KEY = 'geometry'#
- ShapesModel.GEOS_KEY = 'geos'#
- ShapesModel.NAME_KEY = 'name'#
- ShapesModel.RADIUS_KEY = 'radius'#
- ShapesModel.TRANSFORM_KEY = 'transform'#
- ShapesModel.TYPE_KEY = 'type'#
Methods#
- ShapesModel.parse(data, **kwargs)#
Parse shapes data.
- Parameters:
data (
Any
) –Data to parse:
If
numpy.ndarray
, it assumes the shapes are parsed as ragged arrays, in case of (Multi)`Polygons`. Therefore additional argumentsoffsets
andgeometry
must be providedif
Path
orstr
, it’s read as a GeoJSON file.If
geopandas.GeoDataFrame
, it’s validated. The object needs to have a column calledgeometry
which is ageopandas.GeoSeries
orshapely
objects. Valid options are combinations ofPolygon
/MultiPolygon
orPoint
. If the geometries arePoint
, there must be another column calledradius
.
geometry –
Geometry type of the shapes. The following geometries are supported:
0:
Circles
3:
Polygon
6:
MultiPolygon
offsets – In the case of (Multi)`Polygons` shapes, in order to initialize the shapes from their ragged array representation, the offsets of the polygons must be provided. Alternatively you can call the parser as
ShapesModel.parse(data)
, where data is aGeoDataFrame
object and ignore theoffset
paramter (recommended).radius – Size of the
Circles
. It must be provided if the shapes areCircles
.index – Index of the shapes, must be of type
str
. If None, it’s generated automatically.transformations – Transformations of shapes.
kwargs (
Any
) – Additional arguments for GeoJSON reader.
- Return type:
- Returns:
- classmethod ShapesModel.validate(data)#
Validate data.
- Parameters:
data (
GeoDataFrame
) –geopandas.GeoDataFrame
to validate.- Return type:
None
- Returns:
: None