smif.convert.region module¶
Handles conversion between the sets of regions used in the SosModel
Summary¶
Data:
NamedShape |
|
RegionAdaptor |
Convert regions, assuming uniform distributions where necessary |
RegionSet |
Hold a set of regions, spatially indexed for ease of lookup when constructing conversion matrices. |
Reference¶
-
class
smif.convert.region.
RegionAdaptor
(name)[source]¶ Bases:
smif.convert.adaptor.Adaptor
Convert regions, assuming uniform distributions where necessary
-
class
smif.convert.region.
NamedShape
(name, shape)¶ Bases:
tuple
-
name
¶ Alias for field number 0
-
shape
¶ Alias for field number 1
-
-
class
smif.convert.region.
RegionSet
(set_name, elements)[source]¶ Bases:
smif.convert.register.ResolutionSet
Hold a set of regions, spatially indexed for ease of lookup when constructing conversion matrices.
Parameters: - set_name (str) – Name to use as identifier for this set of regions
- elements (iterable) – Iterable (probably a list or a reader handle) of fiona feature records e.g. the ‘features’ entry of a GeoJSON collection
-
get_entry_names
()[source]¶ Get the names of the entries in the ResolutionSet
Returns: The set of names which identify each entry in the ResolutionSet Return type: set
-
as_features
()[source]¶ Get the regions as a list of feature dictionaries
Returns: A list of GeoJSON-style dicts Return type: list
-
centroids_as_features
()[source]¶ Get the region centroids as a list of feature dictionaries
Returns: A list of GeoJSON-style dicts, with Point features corresponding to region centroids Return type: list
-
get_proportion
(from_idx, entry_b)[source]¶ Calculate the proportion of shape a that intersects with shape b
-
static
get_bounds
(entry)[source]¶ Implement this helper method to return bounds from an entry in the register
Parameters: entry – An entry from a ResolutionSet Returns: The bounds of the entry Return type: bounds
-
coverage
¶