emilhe / dash-leaflet

MIT License
213 stars 37 forks source link

Freehand drawing #233

Open akunihiro opened 4 months ago

akunihiro commented 4 months ago

Is Freedraw still available in dash-leaflet? I keep getting a message that "AttributeError: module 'dash_leaflet' has no attribute 'FreeDraw'". I have tried with 1.0.15 and 1.016rc2.

import dash_bootstrap_components as dbc
from dash import Dash
import dash_leaflet as dl

app = Dash()

app.layout = dl.Map(
    dl.TileLayer(
        url = "URL HERE"
    ),
    dl.FreeDraw(),
    minZoom=8,
    maxZoom=17,
    center = [0,0],
    # center = [1,1],
    bounds = {'paddingTopLeft':0,
                'paddingBottomRight':0},
    crs='Simple',
    zoom = 9,
    style = {'height':'75vh', 'width':'75vw'}
    )

if __name__ == "__main__":
    app.run_server(port=8887, jupyter_mode="external", debug=False)

Running Windows 11 with Python 3.11.9.

dir(dl)

results in: ['AttributionControl', 'BaseLayer', 'Circle', 'CircleMarker', 'Colorbar', 'DivMarker', 'EasyButton', 'EditControl', 'FeatureGroup', 'FullScreenControl', 'GeoJSON', 'GestureHandling', 'ImageOverlay', 'LayerGroup', 'LayersControl', 'LocateControl', 'Map', 'MapContainer', 'Marker', 'MeasureControl', 'Overlay', 'Pane', 'Polygon', 'Polyline', 'PolylineDecorator', 'Popup', 'Rectangle', 'SVGOverlay', 'ScaleControl', 'TileLayer', 'Tooltip', 'VideoOverlay', 'WMSTileLayer', 'ZoomControl', '_', '__all__', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__', '__version__', '_basepath', '_component', '_css_dist', '_current_path', '_dash', '_filepath', '_imports_', '_js_dist', '_os', '_sys', '_this_module', 'async_resources', 'f', 'json', 'package', 'package_name']

emilhe commented 2 months ago

While there have previouslty been discussions on FreeDraw (and a draft implementation), it never made to an actual dash-leaflet release. Maybe the EditControl could suit your usecase?