gee-community / geemap

A Python package for interactive geospatial analysis and visualization with Google Earth Engine.
https://geemap.org
MIT License
3.41k stars 1.08k forks source link

Support for rotating a rectangle feature #2132

Open patel-zeel opened 13 hours ago

patel-zeel commented 13 hours ago

Description

Motivation

Oriented bounding box (OBB) detection applications are increasing, especially in communities working on aerial/satellite imagery. Top computer vision conferences such as CVPR and ICCV have numerous papers proposing new methods to detect OBBs every year. OpenMMLab has a library mmrotate just for OBB detection. Few paperswithcode threads track the state-of-the-art in OBB detection [thread1, thread2].

Proposals

giswqs commented 12 hours ago

This is possible through the ipyleaflet Geoman Draw Control. https://ipyleaflet.readthedocs.io/en/latest/controls/geoman_draw_control.html

import geemap
from ipyleaflet import Map, GeomanDrawControl

m = geemap.Map(center=(50, 354), zoom=5, draw_ctrl=False)

draw_control = GeomanDrawControl()
draw_control.polyline =  {
    "pathOptions": {
        "color": "#6bc2e5",
        "weight": 8,
        "opacity": 1.0
    }
}
draw_control.polygon = {
    "pathOptions": {
        "fillColor": "#6be5c3",
        "color": "#6be5c3",
        "fillOpacity": 1.0
    }
}
draw_control.circlemarker = {
    "pathOptions": {
        "fillColor": "#efed69",
        "color": "#efed69",
        "fillOpacity": 0.62
    }
}
draw_control.rectangle = {
    "pathOptions": {
        "fillColor": "#fca45d",
        "color": "#fca45d",
        "fillOpacity": 1.0
    }
}

m.add(draw_control)

m

Peek 2024-09-19 12-33

patel-zeel commented 12 hours ago

This is precisely what I thought with P1. Thank you, Prof. @giswqs! For P2, how to load previously saved features and edit their geometry?

giswqs commented 11 hours ago

I am not sure it if supports loading existing vector data. You need to study their source code to see if it is feasible. https://www.geoman.io/docs/modes/draw-mode#customize-style https://github.com/jupyter-widgets/ipyleaflet/blob/master/python/ipyleaflet/ipyleaflet/leaflet.py#L2294

patel-zeel commented 11 hours ago

Sure, Prof. @giswqs. I'll try to figure it out and if it works, will share here for everyone.