Convert Types

Bounding Box

pb_gee_tools.convert_types.get_vec_file_bbox_wgs84(vec_file: str, vec_lyr: str = None)
Parameters:
  • vec_file – A file path to the vector file that contains the spatial data.

  • vec_lyr – The name of the layer within the vector file to be used for processing. Default is None.

Returns:

An Earth Engine Geometry object representing the bounding box of the vector data in WGS84 (EPSG:4326) projection.

Points

pb_gee_tools.convert_types.get_gee_pts(vec_file: str, vec_lyr: str = None, rnd_smpl: int = None, rnd_seed: int = None, use_replace: bool = False, vec_roi_file: str = None, vec_roi_lyr: str = None)

A function which converts an input vector file into a ee.geometry.MultiPoint object. This function is intended to be used to when reading a set of points as training data for classification. If provided the points will be subsetted using a region of interest polygon.

Parameters:
  • vec_file – file path for the vector file which must be of type Points.

  • vec_lyr – vector layer name

  • rnd_smpl – Optionally randomly sample the data to retreve a subset of the input options. (e.g., return 100 points)

  • rnd_seed – Optionally seed the random number generator for reproducibility.

  • use_replace – Optionally use replacement when randomly sampling the vector layer.

  • vec_roi_file – file path for the vector file defining a region of interest.

  • vec_roi_lyr – vector layer name of the region of interest.

Returns:

ee.Geometry.MultiPoint

pb_gee_tools.convert_types.get_gee_pts_bbox(vec_file: str, vec_lyr: str = None, rnd_smpl: int = None, rnd_seed: int = None, use_replace: bool = False, bbox: Tuple[float, float, float, float] | List[float] = None)

A function which converts an input vector file into a ee.geometry.MultiPoint object. This function is intended to be used to when reading a set of points as training data for classification. If provided the points will be subsetted using a region of interest polygon.

Parameters:
  • vec_file – file path for the vector file which must be of type Points.

  • vec_lyr – vector layer name

  • rnd_smpl – Optionally randomly sample the data to retreve a subset of the input options. (e.g., return 100 points)

  • rnd_seed – Optionally seed the random number generator for reproducibility.

  • use_replace – Optionally use replacement when randomly sampling the vector layer.

  • bbox – the bounding box (xMin, xMax, yMin, yMax): EPSG:4326.

Returns:

ee.Geometry.MultiPoint

pb_gee_tools.convert_types.get_gee_pts_gp(vec_file: str, vec_lyr: str = None, rnd_smpl: int = None, rnd_seed: int = None, use_replace: bool = False, gp_roi_gdf: GeoDataFrame = None)

A function which converts an input vector file into a ee.geometry.MultiPoint object. This function is intended to be used to when reading a set of points as training data for classification. If provided the points will be subsetted using a region of interest polygon.

Parameters:
  • vec_file – file path for the vector file which must be of type Points.

  • vec_lyr – vector layer name

  • rnd_smpl – Optionally randomly sample the data to retreve a subset of the input options. (e.g., return 100 points)

  • rnd_seed – Optionally seed the random number generator for reproducibility.

  • use_replace – Optionally use replacement when randomly sampling the vector layer.

  • gp_roi_gdf – geopandas object

Returns:

ee.Geometry.MultiPoint

pb_gee_tools.convert_types.get_gee_pts_gp_gdf(vec_gdf: GeoDataFrame, rnd_smpl: int = None, rnd_seed: int = None, use_replace: bool = False, gp_roi_gdf: GeoDataFrame = None)

A function which converts an input vector file into a ee.geometry.MultiPoint object. This function is intended to be used to when reading a set of points as training data for classification. If provided the points will be subsetted using a region of interest polygon.

Parameters:
  • vec_gdf – geopandas GeoDataframe of the type Points.

  • rnd_smpl – Optionally randomly sample the data to retreve a subset of the input options. (e.g., return 100 points)

  • rnd_seed – Optionally seed the random number generator for reproducibility.

  • use_replace – Optionally use replacement when randomly sampling the vector layer.

  • gp_roi_gdf – geopandas object

Returns:

ee.Geometry.MultiPoint

Polygons

pb_gee_tools.convert_types.convert_vector_to_gee_polygon(vec_file: str, vec_lyr: str = None)

Converts a vector file with a single polygon to a ee.Geometry.Polygon object.

Parameters:
  • vec_file – file path to the vector file

  • vec_lyr – vector layer name

Returns:

an ee.Geometry.Polygon object

pb_gee_tools.convert_types.get_gee_multi_polygon(vec_file: str, vec_lyr: str = None)

A function which converts an input vector file into a ee.Geometry.MultiPolygon object.

Parameters:
  • vec_file – file path to the vector file

  • vec_lyr – vector layer name

Returns:

ee.Geometry.MultiPolygon