:py:mod:`ecoscope.mapping` ========================== .. py:module:: ecoscope.mapping Submodules ---------- .. toctree:: :titlesonly: :maxdepth: 1 map/index.rst Package Contents ---------------- .. py:class:: ControlElement(html, position='bottomright') Bases: :py:obj:`branca.element.MacroElement` Class to wrap arbitrary HTML as Leaflet Control. :param html: HTML to render an element from. :type html: str :param position: Possible values are 'topleft', 'topright', 'bottomleft' or 'bottomright'. :type position: str .. py:attribute:: _template .. py:class:: EcoMap(*args, static=False, print_control=True, **kwargs) Bases: :py:obj:`EcoMapMixin`, :py:obj:`ecoscope.contrib.foliumap.Map` The Map class inherits folium.Map. By default, the Map will add OpenStreetMap as the basemap. :returns: folium map object. :rtype: object .. py:method:: add_gdf(data, *args, simplify_tolerance=None, **kwargs) Wrapper for `geopandas.explore._explore`. .. py:method:: add_legend(*args, **kwargs) Patched method for allowing legend hex colors to start with a "#". .. py:method:: add_north_arrow(position='topright', scale=1.0) :param position: Possible values are 'topleft', 'topright', 'bottomleft' or 'bottomright'. :type position: str :param scale: Scale dimensions of north arrow. :type scale: float .. py:method:: add_title(title, font_size = '32px', font_style = 'normal', font_family = 'Helvetica', font_color = 'rgba(0,0,0,1)', position = None, background_color = '#FFFFFF99', outline = '0px solid rgba(0, 0, 0, 0)', **kwargs) :param title: Text of title. :type title: str :param font_size: CSS font size that includes units. font_style : str :type font_size: str :param font_family: Font family selection; Could be one or more separated by spaces. :type font_family: str"Helvetica", :param font_color: Text color (css color property); supports rgb, rgba and hex string formats. :type font_color: str :param position: Dict object with top, left and bottom margin values for the title container position. ex. { "top": "10px", "left": "25px", "right": "0px", "bottom": "0px" } All keys are optional in the dictionary (could be passed some of them as necessary). Values could be passed as px or accepted css metric. Default None. :type position: dict|None :param background_color: Box background color; supports rgb, rgba and hex string formats. Default '#FFFFFF99'. :type background_color: str :param outline: Element outline values (width style color_with_transparency). Could be passed as a string with spaced separated values or a dict structure: ex. { "width": "1px", "style": "solid", "color": "#FFFFFF99" # or rgb/rgba tuple (0, 0, 0, 0) } :type outline: str :param kwargs: Additional style kwargs. Underscores in keys will be replaced with dashes .. py:method:: _repr_html_(**kwargs) Displays the HTML Map in a Jupyter notebook. .. py:method:: to_html(outfile, **kwargs) :param outfile: Output destination :type outfile: str, Pathlike .. py:method:: to_png(outfile, sleep_time=10, **kwargs) :param outfile: Output destination :type outfile: str, Pathlike :param sleep_time: Additional seconds to wait before taking screenshot. Should be increased if map tiles in the output haven't fully loaded but can also be decreased in most cases. :type sleep_time: int, optional .. py:method:: add_ee_layer(ee_object, visualization_params, name) Method for displaying Earth Engine image tiles. :param ee_object: :param visualization_params: :param name: :rtype: None .. py:method:: zoom_to_bounds(bounds) Zooms to a bounding box in the form of [minx, miny, maxx, maxy]. :param bounds: Map extent in WGS 84 :type bounds: [x1, y1, x2, y2] .. py:method:: zoom_to_gdf(gs) :param gs: Geometry to adjust map bounds to. CRS will be converted to WGS 84. :type gs: gpd.GeoSeries or gpd.GeoDataFrame .. py:method:: add_local_geotiff(path, zoom=False, cmap=None, colorbar=True) Displays a local GeoTIFF. :param path: Path to local GeoTIFF :type path: str, Pathlike :param zoom: Zoom to displayed GeoTIFF :type zoom: bool :param cmap: Matplotlib colormap to apply to raster :type cmap: `matplotlib.colors.Colormap` or str or None :param colorbar: Whether to add colorbar for provided `cmap`. Does nothing if `cmap` is not provided. :type colorbar: bool .. py:method:: add_print_control() .. py:method:: add_datashader_gdf(gdf, geom_type, name=None, width=600, height=600, cmap=['lightblue', 'darkblue'], ds_agg=None, zoom=True, opacity=1, **kwargs) Overlays a static visualization of the given gdf generated using Datashader :param gdf: GeoDataFrame used to create visualization (geometry must be projected to a CRS) :type gdf: geopandas.GeoDataFrame :param geom_type: The Datashader canvas() function to use valid values are 'polygon', 'line', 'point' :type geom_type: str :param name: The name of the image layer to be displayed in Folium layer control :type name: string :param width: The canvas width in pixels, determines the resolution of the generated image :type width: int :param height: The canvas height in pixels, determines the resolution of the generated image :type height: int :param cmap: The colormap to use for the generated image :type cmap: list of colors or matplotlib.colors.Colormap :param ds_agg: The Datashader reduction to use :type ds_agg: datashader.reductions function :param zoom: Zoom to the generated image :type zoom: bool :param opacity: Sets opacity of overlaid image :type opacity: float :param kwargs: Additional kwargs passed to datashader.transfer_functions.shade .. py:class:: FloatElement(html, left='', right='', top='', bottom='') Bases: :py:obj:`branca.element.MacroElement` Class to wrap arbitrary HTML as a floating Element. :param html: HTML to render an element from. :type html: str :param left: Distance between edge of map and nearest edge of element. Two should be provided. Style can also be specified in html. :type left: str :param right: Distance between edge of map and nearest edge of element. Two should be provided. Style can also be specified in html. :type right: str :param top: Distance between edge of map and nearest edge of element. Two should be provided. Style can also be specified in html. :type top: str :param bottom: Distance between edge of map and nearest edge of element. Two should be provided. Style can also be specified in html. :type bottom: str .. py:attribute:: _template