geodata.mask.Mask.extract_shapes
================================

.. py:method:: geodata.mask.Mask.extract_shapes(shapes: dict[str, shapely.Geometry] | geopandas.GeoDataFrame, layer: Optional[str] = None, combine_shape: bool = False, combine_name: Optional[str] = None, show_raster: bool = False, attribute_save: bool = True, src_crs: str = 'EPSG:4326', dst_crs: str = 'EPSG:4326', **kwargs) -> dict[str, rasterio.DatasetReader]

   Extract the shapes on the (by default) merged_mask layer, and save the result
   shape rasters as a dictionary in `shape_mask` attribute.

   :param shapes: A dictionary or GeoPanda's dataframe of shapes
   :type shapes: dict or GeoDataFrame
   :param layer: The layer to extract shape from. If unspecified, this method will extract the shapes
                 from the `merged_mask` layer.
   :type layer: str
   :param combine_shape: Whether combine the shapes as one shape, and only
                         one layer will be added as a result. This option is set to False by default.
   :type combine_shape: bool
   :param combine_name: The name of the combined shape if combine_shape is True.
   :type combine_name: str
   :param show_raster: Whether to plot the result shapes. True by default.
   :type show_raster: bool
   :param attribute_save: if the program will want to save the shapes to the shape_mask attributes.
                          True by default.
   :type attribute_save: bool
   :param src_crs: The source tif CRS, by default it is 'EPSG:4326' lat lon coordinate system.
   :type src_crs: str
   :param dst_crs: The destination CRS, by default it is 'EPSG:4326' lat lon coordinate system.
   :type dst_crs: str
   :param \*\*kwargs: Additional arguments passed to the `rasterio.mask.mask` method.

   :returns: A dictionary of extracted shapes with shape names as keys and shape rasters as values.
   :rtype: dict

   :raises ValueError: If the shapes input is not a dictionary or GeoDataFrame.
   :raises ValueError: If the layer is not specified and the merged_mask is not ready.

