pysepal.mapping.draw_control.GeomanDrawControl#

class pysepal.mapping.draw_control.GeomanDrawControl(*args, **kwargs)[source]#

Drawing control based on Leaflet-Geoman.

Provides the same API as DrawControl (show/hide/to_json/clear) but uses the Geoman library which offers additional tools (drag, cut, rotate, text).

Usage:

Replace DrawControl with GeomanDrawControl in SepalMap or use directly:

from pysepal.mapping import GeomanDrawControl

dc = GeomanDrawControl(my_map)
my_map.add(dc)

A custom DrawingControl based on Leaflet-Geoman.

Parameters:
  • m (Map | None) – the map on which the drawControl is displayed

  • kwargs – any available arguments from ipyleaflet.GeomanDrawControl

Attributes

m

the map on which the drawControl is displayed

Methods

__init__

A custom DrawingControl based on Leaflet-Geoman.

hide

Hide the drawing control from the map and clear its content.

polygonize

Transform a circle (a point with a radius) into a GeoJson polygon.

show

Show the drawing control on the map and clear its content.

to_json

Return the content of the DrawControl data.

GeomanDrawControl.__init__(m, **kwargs)[source]#

A custom DrawingControl based on Leaflet-Geoman.

Parameters:
  • m (Map) – the map on which the drawControl is displayed

  • kwargs – any available arguments from ipyleaflet.GeomanDrawControl

Return type:

None

GeomanDrawControl.hide()[source]#

Hide the drawing control from the map and clear its content.

Return type:

None

static GeomanDrawControl.polygonize(geo_json)[source]#

Transform a circle (a point with a radius) into a GeoJson polygon.

Handles both Geoman format (radius in properties) and legacy format (radius in properties.style.radius).

Params:

geo_json: the circle geojson

Returns:

the polygonised feature

Parameters:

geo_json (dict)

Return type:

dict

GeomanDrawControl.show()[source]#

Show the drawing control on the map and clear its content.

Return type:

None

GeomanDrawControl.to_json()[source]#

Return the content of the DrawControl data.

Returns a GeoJSON FeatureCollection without styling properties and with circles polygonized. Compatible with __geo_interface__.

Returns:

the json representation of all the geometries drawn on the map

Return type:

dict