geopyspark.geotrellis package¶
-
class
geopyspark.geotrellis.Tile¶ Represents a raster in GeoPySpark.
Note
All rasters in GeoPySpark are represented as having multiple bands, even if the original raster just contained one.
Parameters: - cells (nd.array) – The raster data itself. It is contained within a NumPy array.
- data_type (str) – The data type of the values within
dataif they were in Scala. - no_data_value – The value that represents no data value in the raster. This can be represented by a variety of types depending on the value type of the raster.
-
cells¶ nd.array – The raster data itself. It is contained within a NumPy array.
-
data_type¶ str – The data type of the values within
dataif they were in Scala.
-
no_data_value¶ The value that represents no data value in the raster. This can be represented by a variety of types depending on the value type of the raster.
-
cell_type¶ Alias for field number 1
-
cells¶ Alias for field number 0
-
count(value) → integer -- return number of occurrences of value¶
-
static
dtype_to_cell_type(dtype)¶ Converts a
np.dtypeto the corresponding GeoPySparkcell_type.Note
bool,complex64,complex128, andcomplex256, are currently not supportednp.dtypes.Parameters: dtype (np.dtype) – The dtypeof the numpy array.Returns: str. The GeoPySpark cell_typeequivalent of thedtype.Raises: TypeError– If the givendtypeis not a supported data type.
-
classmethod
from_numpy_array(numpy_array, no_data_value=None)¶ Creates an instance of
Tilefrom a numpy array.Parameters: - numpy_array (np.array) –
The numpy array to be used to represent the cell values of the
Tile.Note
GeoPySpark does not support arrays with the following data types:
bool,complex64,complex128, andcomplex256. - no_data_value (optional) – The value that represents no data value in the raster.
This can be represented by a variety of types depending on the value type of
the raster. If not given, then the value will be
None.
Returns: - numpy_array (np.array) –
-
index(value[, start[, stop]]) → integer -- return first index of value.¶ Raises ValueError if the value is not present.
-
no_data_value¶ Alias for field number 2
-
class
geopyspark.geotrellis.Extent¶ The “bounding box” or geographic region of an area on Earth a raster represents.
Parameters: - xmin (float) – The minimum x coordinate.
- ymin (float) – The minimum y coordinate.
- xmax (float) – The maximum x coordinate.
- ymax (float) – The maximum y coordinate.
-
xmin¶ float – The minimum x coordinate.
-
ymin¶ float – The minimum y coordinate.
-
xmax¶ float – The maximum x coordinate.
-
ymax¶ float – The maximum y coordinate.
-
count(value) → integer -- return number of occurrences of value¶
-
classmethod
from_polygon(polygon)¶ Creates a new instance of
Extentfrom a Shapely Polygon.The new
Extentwill contain the min and max coordinates of the Polygon; regardless of the Polygon’s shape.Parameters: polygon (shapely.geometry.Polygon) – A Shapely Polygon. Returns: Extent
-
index(value[, start[, stop]]) → integer -- return first index of value.¶ Raises ValueError if the value is not present.
-
to_polygon¶ Converts this instance to a Shapely Polygon.
The resulting Polygon will be in the shape of a box.
Returns: shapely.geometry.Polygon
-
xmax¶ Alias for field number 2
-
xmin¶ Alias for field number 0
-
ymax¶ Alias for field number 3
-
ymin¶ Alias for field number 1
-
class
geopyspark.geotrellis.ProjectedExtent¶ Describes both the area on Earth a raster represents in addition to its CRS.
Parameters: - extent (
Extent) – The area the raster represents. - epsg (int, optional) – The EPSG code of the CRS.
- proj4 (str, optional) – The Proj.4 string representation of the CRS.
-
epsg¶ int, optional – The EPSG code of the CRS.
-
proj4¶ str, optional – The Proj.4 string representation of the CRS.
Note
Either
epsgorproj4must be defined.-
count(value) → integer -- return number of occurrences of value¶
-
epsg¶ Alias for field number 1
-
extent¶ Alias for field number 0
-
index(value[, start[, stop]]) → integer -- return first index of value.¶ Raises ValueError if the value is not present.
-
proj4¶ Alias for field number 2
- extent (
-
class
geopyspark.geotrellis.TemporalProjectedExtent¶ Describes the area on Earth the raster represents, its CRS, and the time the data was collected.
Parameters: - extent (
Extent) – The area the raster represents. - instant (
datetime.datetime) – The time stamp of the raster. - epsg (int, optional) – The EPSG code of the CRS.
- proj4 (str, optional) – The Proj.4 string representation of the CRS.
-
instant¶ datetime.datetime– The time stamp of the raster.
-
epsg¶ int, optional – The EPSG code of the CRS.
-
proj4¶ str, optional – The Proj.4 string representation of the CRS.
Note
Either
epsgorproj4must be defined.-
count(value) → integer -- return number of occurrences of value¶
-
epsg¶ Alias for field number 2
-
extent¶ Alias for field number 0
-
index(value[, start[, stop]]) → integer -- return first index of value.¶ Raises ValueError if the value is not present.
-
instant¶ Alias for field number 1
-
proj4¶ Alias for field number 3
- extent (
-
class
geopyspark.geotrellis.GlobalLayout(tile_size, zoom, threshold)¶ -
count(value) → integer -- return number of occurrences of value¶
-
index(value[, start[, stop]]) → integer -- return first index of value.¶ Raises ValueError if the value is not present.
-
threshold¶ Alias for field number 2
-
tile_size¶ Alias for field number 0
-
zoom¶ Alias for field number 1
-
-
class
geopyspark.geotrellis.LocalLayout¶ TileLayout type that snaps the layer extent.
When passed in place of LayoutDefinition it signifies that a LayoutDefinition instances should be constructed over the envelope of the layer pixels with given tile size. Resulting TileLayout will match the cell resolution of the source rasters.
Parameters: - tile_size (int, optional) – The number of columns and row pixels in each tile. If this
is
None, then the sizes of each tile will be set usingtile_colsandtile_rows. - tile_cols (int, optional) – The number of column pixels in each tile. This supersedes
tile_size. Meaning if this andtile_sizeare set, then this will be used for the number of colunn pixles. IfNone, then the number of column pixels will default to 256. - tile_rows (int, optional) – The number of rows pixels in each tile. This supersedes
tile_size. Meaning if this andtile_sizeare set, then this will be used for the number of row pixles. IfNone, then the number of row pixels will default to 256.
-
tile_cols¶ int – The number of column pixels in each tile
-
tile_rows¶ int – The number of rows pixels in each tile. This supersedes
-
count(value) → integer -- return number of occurrences of value¶
-
index(value[, start[, stop]]) → integer -- return first index of value.¶ Raises ValueError if the value is not present.
-
tile_cols¶ Alias for field number 0
-
tile_rows¶ Alias for field number 1
- tile_size (int, optional) – The number of columns and row pixels in each tile. If this
is
-
class
geopyspark.geotrellis.LocalLayout TileLayout type that snaps the layer extent.
When passed in place of LayoutDefinition it signifies that a LayoutDefinition instances should be constructed over the envelope of the layer pixels with given tile size. Resulting TileLayout will match the cell resolution of the source rasters.
Parameters: - tile_size (int, optional) – The number of columns and row pixels in each tile. If this
is
None, then the sizes of each tile will be set usingtile_colsandtile_rows. - tile_cols (int, optional) – The number of column pixels in each tile. This supersedes
tile_size. Meaning if this andtile_sizeare set, then this will be used for the number of colunn pixles. IfNone, then the number of column pixels will default to 256. - tile_rows (int, optional) – The number of rows pixels in each tile. This supersedes
tile_size. Meaning if this andtile_sizeare set, then this will be used for the number of row pixles. IfNone, then the number of row pixels will default to 256.
-
tile_cols int – The number of column pixels in each tile
-
tile_rows int – The number of rows pixels in each tile. This supersedes
-
count(value) → integer -- return number of occurrences of value
-
index(value[, start[, stop]]) → integer -- return first index of value. Raises ValueError if the value is not present.
-
tile_cols Alias for field number 0
-
tile_rows Alias for field number 1
- tile_size (int, optional) – The number of columns and row pixels in each tile. If this
is
-
class
geopyspark.geotrellis.TileLayout(layoutCols, layoutRows, tileCols, tileRows)¶ -
count(value) → integer -- return number of occurrences of value¶
-
index(value[, start[, stop]]) → integer -- return first index of value.¶ Raises ValueError if the value is not present.
-
layoutCols¶ Alias for field number 0
-
layoutRows¶ Alias for field number 1
-
tileCols¶ Alias for field number 2
-
tileRows¶ Alias for field number 3
-
-
class
geopyspark.geotrellis.LayoutDefinition(extent, tileLayout)¶ -
count(value) → integer -- return number of occurrences of value¶
-
extent¶ Alias for field number 0
-
index(value[, start[, stop]]) → integer -- return first index of value.¶ Raises ValueError if the value is not present.
-
tileLayout¶ Alias for field number 1
-
-
class
geopyspark.geotrellis.SpatialKey(col, row)¶ -
col¶ Alias for field number 0
-
count(value) → integer -- return number of occurrences of value¶
-
index(value[, start[, stop]]) → integer -- return first index of value.¶ Raises ValueError if the value is not present.
-
row¶ Alias for field number 1
-
-
class
geopyspark.geotrellis.SpaceTimeKey(col, row, instant)¶ -
col¶ Alias for field number 0
-
count(value) → integer -- return number of occurrences of value¶
-
index(value[, start[, stop]]) → integer -- return first index of value.¶ Raises ValueError if the value is not present.
-
instant¶ Alias for field number 2
-
row¶ Alias for field number 1
-
-
geopyspark.geotrellis.RasterizerOptions¶ alias of
RasterizeOption
-
class
geopyspark.geotrellis.Bounds¶ Represents the grid that covers the area of the rasters in a Layer on a grid.
Parameters: - minKey (
SpatialKeyorSpaceTimeKey) – The smallestSpatialKeyorSpaceTimeKey. - minKey – The largest
SpatialKeyorSpaceTimeKey.
Returns: -
count(value) → integer -- return number of occurrences of value¶
-
index(value[, start[, stop]]) → integer -- return first index of value.¶ Raises ValueError if the value is not present.
-
maxKey¶ Alias for field number 1
-
minKey¶ Alias for field number 0
- minKey (
-
class
geopyspark.geotrellis.Metadata(bounds, crs, cell_type, extent, layout_definition)¶ Information of the values within a
RasterLayerorTiledRasterLayer. This data pertains to the layout and other attributes of the data within the classes.Parameters: - bounds (
Bounds) – TheBoundsof the values in the class. - crs (str or int) – The
CRSof the data. Can either be the EPSG code, well-known name, or a PROJ.4 projection string. - cell_type (str or
CellType) – The data type of the cells of the rasters. - extent (
Extent) – TheExtentthat covers the all of the rasters. - layout_definition (
LayoutDefinition) – TheLayoutDefinitionof all rasters.
-
crs¶ str or int – The CRS of the data. Can either be the EPSG code, well-known name, or a PROJ.4 projection string.
-
cell_type¶ str – The data type of the cells of the rasters.
-
no_data_value¶ int or float or None – The noData value of the rasters within the layer. This can either be
None, anint, or afloatdepending on thecell_type.
-
tile_layout¶ TileLayout– TheTileLayoutthat describes how the rasters are orginized.
-
layout_definition¶ LayoutDefinition– TheLayoutDefinitionof all rasters.
-
classmethod
from_dict(metadata_dict)¶ Creates
Metadatafrom a dictionary.Parameters: metadata_dict (dict) – The Metadataof aRasterLayerorTiledRasterLayerinstance that is indictform.Returns: Metadata
-
to_dict()¶ Converts this instance to a
dict.Returns: dict
- bounds (