Geo modules

The Geo modules of the vois library contains functions and classes to display geospatial content on an interactive map.

_images/line.png

Map module

_images/line.png

mapUtils module

Utilities functions for maps

mapUtils.BDAPLayer(p)[source]

Returns a TileLayer instance from a BDAP ImageProcess or VectorLayer instance passed as input parameter.

mapUtils.CartoLabels()[source]

Returns a TileLayer instance displaying only EC compliant labels.

mapUtils.EmptyBasemap()[source]

Returns a fully gray basemap TileLayer instance.

mapUtils.EsriWorldImagery()[source]

Returns Esri WorldImagery TileLayer instance.

mapUtils.GoogleHybrid()[source]

Returns Google Hybrid TileLayer instance.

mapUtils.GoogleRoadmap()[source]

Returns Google Roadmap TileLayer instance.

mapUtils.GoogleSatellite()[source]

Returns Google Satellite TileLayer instance.

mapUtils.OSM_EC()[source]

Returns a OpenStreetMap European Commission compliant TileLayer instance.

mapUtils.addLayer(m, tLayer, name, opacity=1.0)[source]

Add or substitutes a layer given a name.

Parameters:
  • m (ipyleaflet.Map instance) – Map where the layer is to be added.

  • tLayer (ipyleaflet.TileLayer instance) – Layer to add to the map.

  • name (str) – Name of the layer

  • opacity (float, optional) – Opacity of the layer in the [0.0,1.0] range. Default is 1.0.

Returns:

tLayer – The layer added to the map.

Return type:

ipyleaflet.TileLayer instance

mapUtils.addOverview(m, color='red', position='bottomright', overviewLayer=None)[source]

Add an overview map.

Parameters:
  • m (ipyleaflet.Map instance) – Map instance.

  • color (str, optional) – Color of the rectangle that displays the current zoom of the map inside the overview map.

  • position (str, optional) – Position of the card inside the map. Valid positions are ‘bottomleft’, ‘bottomright’, ‘topleft’ and ‘topright’. Default is ‘bottomright’.

  • overviewLayer (ipyleaflet.TileLayer instance, optional) – Optional layer to be displayed on the overview map (default is None).

mapUtils.clear(m)[source]

Remove all layer except current first layer from a map.

Parameters:

m (ipyleaflet.Map instance) – Map to be cleared.

mapUtils.getCardByName(m, name, position='topright', class_='pa-0 ma-0')[source]

Searches the controls of the Map m to find a control added as a Widget by using its name. If the control is not found, a new control is added to the map.

Parameters:
  • m (ipyleaflet.Map instance) – Map instance.

  • name (str) – Name of the card to search for.

  • position (str, optional) – Position of the card inside the map. Valid positions are ‘bottomleft’, ‘bottomright’, ‘topleft’ and ‘topright’. Default is ‘topright’.

  • class (str, optional) – Margins to set for the adde card (default is ‘pa-0 ma-0’)

Returns:

c – The card added to the map that can be filled with any type of widgets content by setting its children property.

Return type:

v.Card instance

mapUtils.getCoordinatesCard(m)[source]

Searches the controls of the Map m to find the coordinates control (where the lat/lon coordinates are displayed at mouse move) and returns a v.Card instance.

mapUtils.getLayer(m, name)[source]

Search for a layer of a map by name.

Parameters:
  • m (ipyleaflet.Map instance) – Map where to search for the layer.

  • name (str) – Name of the layer.

Returns:

tLayer – If a layer with the name exists on the map it is returned, otherwise the function returns None.

Return type:

ipyleaflet.TileLayer instance

mapUtils.removeAllPopups(m)[source]

Remove all instances of ipyleaflet.leaflet.Popup class present in the map.

Parameters:

m (ipyleaflet.Map instance) – Map where the popups must be removed.

mapUtils.removeCardByName(m, name)[source]

Remove a WidgetControl Card from the map given its name, if present.

Parameters:
  • m (ipyleaflet.Map instance) – Map instance.

  • name (str) – Name of the card to search for.

mapUtils.removeCoordinates(m)[source]

Remove the WidgetControl dedicated to the display of the coordinates at mouse move.

mapUtils.removeLayer(m, name)[source]

Remove a layer from a map given its name.

Parameters:
  • m (ipyleaflet.Map instance) – Map where to search for the layer.

  • name (str) – Name of the layer to remove.

mapUtils.removeOverview(m)[source]

Remove the overview map, if present.

mapUtils.toImage(m)[source]

Save the current map content as a PIL image.

Parameters:

m (ipyleaflet.Map instance) – Map instance.

Returns:

img – A raster image displaying the current content of the map.

Return type:

PIL/Pillow image

_images/line.png