ecoscope.mapping ================ .. py:module:: ecoscope.mapping Submodules ---------- .. toctree:: :maxdepth: 1 /autoapi/ecoscope/mapping/map/index Package Contents ---------------- .. py:class:: EcoMap(static=False, default_widgets=True, *args, **kwargs) Bases: :py:obj:`lonboard.Map` .. py:method:: add_widget(widget) Adds a deck widget to the map :param widget: :type widget: lonboard.BaseDeckWidget or list[lonboard.BaseDeckWidget] .. py:method:: polyline_layer(gdf, color_column = None, tooltip_columns = None, **kwargs) :staticmethod: Creates a polyline layer to add to a map :param gdf: The data used to create the polyline layer :type gdf: gpd.GeoDataFrame :param tooltip_columns: A list of dataframe columns to be included in the map picking tooltip Will default to all columns if no list is provided :param kwargs: Additional kwargs passed to lonboard.PathLayer: http://developmentseed.org/lonboard/latest/api/layers/path-layer/ .. py:method:: polygon_layer(gdf, fill_color_column = None, line_color_column = None, tooltip_columns = None, **kwargs) :staticmethod: Creates a polygon layer to add to a map :param gdf: The data used to create the polygon layer :type gdf: gpd.GeoDataFrame :param tooltip_columns: A list of dataframe columns to be included in the map picking tooltip Will default to all columns if no list is provided :param kwargs: Additional kwargs passed to lonboard.PathLayer: http://developmentseed.org/lonboard/latest/api/layers/polygon-layer/ .. py:method:: point_layer(gdf, fill_color_column = None, line_color_column = None, tooltip_columns = None, **kwargs) :staticmethod: Creates a polygon layer to add to a map :param gdf: The data used to create the point layer :type gdf: gpd.GeoDataFrame :param tooltip_columns: A list of dataframe columns to be included in the map picking tooltip Will default to all columns if no list is provided :param kwargs: Additional kwargs passed to lonboard.ScatterplotLayer: http://developmentseed.org/lonboard/latest/api/layers/scatterplot-layer/ .. py:method:: add_legend(labels, colors, **kwargs) Adds a legend to the map :param placement: One of "top-left", "top-right", "bottom-left", "bottom-right" or "fill" Where to place the widget within the map :type placement: str :param title: A title displayed on the widget :type title: str :param labels: A list or series of labels :type labels: list or pd.Series :param colors: A list or series of colors as string hex values or RGBA color tuples :type colors: list or pd.Series :param style: Additional style params :type style: dict .. py:method:: add_north_arrow(**kwargs) Adds a north arrow to the map :param placement: Where to place the widget within the map :type placement: str, one of "top-left", "top-right", "bottom-left", "bottom-right" or "fill" :param style: Additional style params :type style: dict .. py:method:: add_scale_bar(**kwargs) Adds a scale bar to the map :param placement: Where to place the widget within the map :type placement: str, one of "top-left", "top-right", "bottom-left", "bottom-right" or "fill" :param use_imperial: If true, show scale in miles/ft, rather than m/km :type use_imperial: bool :param style: Additional style params :type style: dict .. py:method:: add_title(title, **kwargs) Adds a title to the map :param title: The map title :type title: str :param style: Additional style params :type style: dict .. py:method:: add_save_image(**kwargs) Adds a button to save the map as a png :param placement: Where to place the widget within the map :type placement: str, one of "top-left", "top-right", "bottom-left", "bottom-right" or "fill" :param style: Additional style params :type style: dict .. py:method:: ee_layer(ee_object, visualization_params, **kwargs) :staticmethod: Creates a layer from the provided Earth Engine. If an EE.Image/EE.ImageCollection or EE.FeatureCollection is provided, this results in a BitmapTileLayer being added For EE.Geometry objects, a list of ScatterplotLayer,PathLayer and PolygonLayer will be added based on the geometry itself (see add_gdf) :param ee_object: The ee object to represent as a layer :type ee_object: ee.Image, ee.ImageCollection, ee.Geometry, ee.FeatureCollection] :param visualization_params: Visualization params passed to EarthEngine :type visualization_params: dict :param kwargs: Additional params passed to either lonboard.BitmapTileLayer or add_gdf .. py:method:: zoom_to_bounds(feat, max_zoom = 20) Zooms the map to the bounds of a dataframe or layer. :param feat: The feature to zoom to :type feat: BaseLayer, list[lonboard.BaseLayer], gpd.GeoDataFrame .. py:method:: geotiff_layer(tiff, cmap = None, opacity = 0.7) :staticmethod: Creates a layer from a given geotiff Note that since deck.gl tiff support is limited, this extracts the CRS/Bounds from the tiff and converts the image data in-memory to PNG :param tiff: The string path to a tiff on disk or a rio.MemoryFile :type tiff: str | rio.MemoryFile :param cmap: The colormap to apply to the raster :type cmap: str or matplotlib.colors.Colormap :param opacity: The opacity of the overlay :type opacity: float .. py:method:: pil_layer(image, bounds, opacity=1) :staticmethod: Creates layer from a PIL.Image :param image: The image to be overlaid :type image: PIL.Image :param bounds: Tuple containing the EPSG:4326 (minx, miny, maxx, maxy) values bounding the given image :type bounds: tuple :param opacity: Sets opacity of overlaid image :type opacity: float, optional .. py:method:: get_named_tile_layer(layer, widget_id = None, opacity = 1) :staticmethod: .. py:method:: to_html(filename: None = None, title: Optional[str] = None, maximize: bool = True) -> str to_html(filename: Union[str, pathlib.Path, TextIO, IO[str]], title: Optional[str] = None, maximize: bool = True) -> None