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 (
HashPartitionStrategyorSpatialPartitioinStrategy, optional) –Sets the
Partitionerfor the resulting layer and how many partitions it has. Default is,None.If
None, then the output layer will have the defaultPartitionerand a number of paritions that was determined by the method.If
partition_strategyis set but has nonum_partitions, then the resulting layer will have thePartionerspecified in the strategy with the with same number of partitions the source layer had.If
partition_strategyis set and has anum_partitions, then the resulting layer will have thePartionerand 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
Features.Parameters: - features (pyspark.RDD[Feature]) – A Python
RDDthat containsFeatures. - crs (str or int) – The CRS of the input geometry.
- zoom (int) –
The zoom level of the output raster.
Note
Not all rasterized
Features may be present in the resulting layer if thezoomis 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-Indexcells are. Defaults toCellType.INT8. - partition_strategy (
HashPartitionStrategyorSpatialPartitioinStrategy, optional) –Sets the
Partitionerfor the resulting layer and how many partitions it has. Default is,None.If
None, then the output layer will have the defaultPartitionerand a number of paritions that was determined by the method.If
partition_strategyis set but has nonum_partitions, then the resulting layer will have thePartionerspecified in the strategy with the with same number of partitions the source layer had.If
partition_strategyis set and has anum_partitions, then the resulting layer will have thePartionerand number of partitions specified in the strategy.
Returns: - features (pyspark.RDD[Feature]) – A Python