geopyspark.geotrellis.rasterize module¶
-
geopyspark.geotrellis.rasterize.
rasterize
(geoms, crs, zoom, fill_value, cell_type=<CellType.FLOAT64: 'float64'>, options=None, partition_strategy=None)¶ Rasterizes a Shapely geometries.
Parameters: - geoms ([shapely.geometry] or (shapely.geometry) or pyspark.RDD[shapely.geometry]) – Either a list, tuple, or a Python RDD of shapely geometries to rasterize.
- crs (str or int) – The CRS of the input geometry.
- zoom (int) – The zoom level of the output raster.
- fill_value (int or float) – Value to burn into pixels intersectiong geometry
- cell_type (str or
CellType
) – Which data type the cells should be when created. Defaults toCellType.FLOAT64
. - options (
RasterizerOptions
, optional) – Pixel intersection options. - partition_strategy (
HashPartitionStrategy
orSpatialPartitioinStrategy
, optional) –Sets the
Partitioner
for the resulting layer and how many partitions it has. Default is,None
.If
None
, then the output layer will have the defaultPartitioner
and a number of paritions that was determined by the method.If
partition_strategy
is set but has nonum_partitions
, then the resulting layer will have thePartioner
specified in the strategy with the with same number of partitions the source layer had.If
partition_strategy
is set and has anum_partitions
, then the resulting layer will have thePartioner
and number of partitions specified in the strategy.
Returns:
-
geopyspark.geotrellis.rasterize.
rasterize_features
(features, crs, zoom, cell_type=<CellType.FLOAT64: 'float64'>, options=None, zindex_cell_type=<CellType.INT8: 'int8'>, partition_strategy=None)¶ Rasterizes a collection of
Feature
s.Parameters: - features (pyspark.RDD[Feature]) –
A Python
RDD
that containsFeature
s.Note
The
properties
of eachFeature
must be an instance ofCellValue
. - crs (str or int) – The CRS of the input geometry.
- zoom (int) –
The zoom level of the output raster.
Note
Not all rasterized
Feature
s may be present in the resulting layer if thezoom
is not high enough. - cell_type (str or
CellType
) – Which data type the cells should be when created. Defaults toCellType.FLOAT64
. - options (
RasterizerOptions
, optional) – Pixel intersection options. - zindex_cell_type (str or
CellType
) – Which data type theZ-Index
cells are. Defaults toCellType.INT8
. - partition_strategy (
HashPartitionStrategy
orSpatialPartitioinStrategy
, optional) –Sets the
Partitioner
for the resulting layer and how many partitions it has. Default is,None
.If
None
, then the output layer will have the defaultPartitioner
and a number of paritions that was determined by the method.If
partition_strategy
is set but has nonum_partitions
, then the resulting layer will have thePartioner
specified in the strategy with the with same number of partitions the source layer had.If
partition_strategy
is set and has anum_partitions
, then the resulting layer will have thePartioner
and number of partitions specified in the strategy.
Returns: - features (pyspark.RDD[Feature]) –