Giter Club home page Giter Club logo

josmmagicwand's Introduction

DS-annotate plugin for Java OpenStreetMap Editor

The DS-annotate plugin is an extension for the Java OpenStreetMap Desktop Editor (JOSM). Built upon ds-annotate, this plugin utilizes the Segment Anything Service, which leverages Generative AI. Additionally, it allows users to label areas using a spectrum of colors, similar to a magic wand tool, enabling faster and more accurate mapping.

Peek 2022-11-09 16-53

Installation

  1. Search the magic wand plugin.

    image

  2. Wait to download the plugin, sometimes it takes a few minutes, because the plugin is 100 MB in size.

    image

  3. Confirmation window.

    image image

Usage

The JOSM Magic Wand plugin offers three functionalities:

  • Generate Geometries
  • Merge Geometries
  • Simplify Geometries

Generate geometries.

To generate geometries, you must have a base map activated and a data layer.

  • You can press the shortcut Ctrl + 1 or select directly in the mode bar (upper left) image, you will enter Magic Wand mode and you will see a wand on the cursor image .

  • Click on the area.

  • ctrl + 2 to generate the geometry.

  • To add or enhance the selection, you can press the ctrl button and click on new area.

  • To subtract the selection, you can press the switch button and click on area.

Merge geometries

This functionality allows you to merge several geometries into one, the geometries must intersects.

Peek 2022-09-22 22-44

  • Select one or more geometries.
  • Press ctrl + 3.

Simplify geometries.

This functionality allows you to simplify and smooth a geometry.

  • Select one or more geometries.
  • Press ctrl + 4.

Requirements

  • Java JDK 11+.
  • JOSM 18193 or higher.

Extra options

image

image

  1. Select mode.

  2. Open window.

  3. In the window, you will find the following options:

    • Tolerance: This option allows you to configure the color tolerance of the Magic Wand tool.
    Higher values expand the tolerance to more colors.
    Lower values make the tool more specific to colors.
    
    • Exterior contour: This algorithm is specifically designed to simplify polygons while maintaining the shape and outer contour (hull) of the original polygon.
    Higher values result in less simplification.
    Lower values result in more simplification.
    
    • Vertices: This algorithm focuses on the general simplification of polygons. Its goal is to reduce the number of vertices in a geometry while preserving its overall shape.
    Higher values result in more simplification.
    Lower values result in less simplification.
    
    • Topology: This algorithm is used to simplify geometries while preserving their topology. Topology refers to the spatial relationship and connectivity between geometric elements.
    Higher values result in more simplification.
    Lower values result in less simplification.
    
    • Smooth Angle: This option allows you to smooth very sharp angles. The value entered represents the minimum angle to be simplified.
    • add tag: a pop-up window will appear, allowing you to enter the tag that will be added when generating or simplifying the geometry, the format its key=value.

To disable the algorithms, set the value to 0.

Use cases

Cases where it works well

Image Description
image The edge of the lake has borders marked with the path.
image The edge of the lake and the farm have marked borders.
image Uniform color and sharp edges (contrast).
image Uniform color and sharp edges (contrast).
image Uniform color and sharp edges (contrast).
image Uniform color and sharp edges (contrast).

Cases where it doesn't work well

Image Description
image The two farms are separated by a very thin path of similar color.
image Parts of the farm and the border have similar colors with the rest.
image The borders of the farm with the road and the other farm have similar colors.

josmmagicwand's People

Contributors

yunica avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

josmmagicwand's Issues

Magic Wand: IAE during layer cleanup

Copied from https://josm.openstreetmap.de/ticket/22575 . Is there a good person to assign the ticket to on JOSM Trac?


What steps will reproduce the problem?

Install JOSM Magic Wand plugin
Open some layer(s)
Close all layers
Open some layer(s) again
Close all layers again
Crash 

Please provide any additional information below. Attach a screenshot if possible.

I managed to confirm that this plugin is the source by uninstalling it and following the steps above without crash, and then I reinstalled the plugin, did those steps and the crash was back.

The magic wand plugin is not listed in the "component" section of this ticket creation page.

Revision:18583
Build-Date:2022-11-01 14:35:40

Identification: JOSM/1.5 (18583 en_GB) Windows 10 64-Bit
OS Build number: Windows 10 Education 2009 (19044)
Memory Usage: 454 MB / 4052 MB (97 MB allocated, but free)
Java version: 17.0.5+8-LTS, Azul Systems, Inc., OpenJDK 64-Bit Server VM
Look and Feel: com.formdev.flatlaf.FlatDarkLaf
Screen: \Display0 1920×1080 (scaling 1.25×1.25)
Maximum Screen Size: 1920×1080
Best cursor sizes: 16×16→32×32, 32×32→32×32
System property file.encoding: Cp1252
System property sun.jnu.encoding: Cp1252
Locale info: en_GB
Numbers with default locale: 1234567890 -> 1234567890
VM arguments: [-Djpackage.app-version=1.5.18583, --add-modules=java.scripting,java.sql,javafx.controls,javafx.media,javafx.swing,javafx.web, --add-exports=java.base/sun.security.action=ALL-UNNAMED, --add-exports=java.desktop/com.sun.imageio.plugins.jpeg=ALL-UNNAMED, --add-exports=java.desktop/com.sun.imageio.spi=ALL-UNNAMED, --add-opens=java.base/java.lang=ALL-UNNAMED, --add-opens=java.base/java.nio=ALL-UNNAMED, --add-opens=java.base/jdk.internal.loader=ALL-UNNAMED, --add-opens=java.base/jdk.internal.ref=ALL-UNNAMED, --add-opens=java.desktop/javax.imageio.spi=ALL-UNNAMED, --add-opens=java.desktop/javax.swing.text.html=ALL-UNNAMED, --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED, -Djpackage.app-path=%UserProfile%\AppData\Local\JOSM\JOSM.exe]

Plugins:
+ FastDraw (35978)
+ MakeParallel (v1.1.0)
+ PolygonCutOut (v0.7)
+ SimplifyArea (35978)
+ apache-commons (36034)
+ apache-http (35924)
+ areaselector (1652822522)
+ austriaaddresshelper (1597341117)
+ conflation (0.6.9)
+ ejml (35924)
+ flatlaf (36036)
+ geotools (36028)
+ imagery_offset_db (35978)
+ jackson (36034)
+ jaxb (35952)
+ jna (36005)
+ josm_magic_wand (1.1.0)
+ jts (36004)
+ log4j (36034)
+ mapwithai (v1.9.20)
+ measurement (35978)
+ opendata (36025)
+ reltoolbox (35976)
+ reverter (36043)
+ shrinkwrap (v1.0.4)
+ terracer (35978)
+ turnrestrictions (36011)
+ utilsplugin2 (36011)

Tagging presets:
+ https://josm.openstreetmap.de/josmfile?page=Presets/ParkingLanes&zip=1
+ https://josm.openstreetmap.de/josmfile?page=Presets/Playground_Equipment&zip=1
+ https://raw.githubusercontent.com/yopaseopor/traffic_signs_preset_JOSM/master/NL.zip
+ https://josm.openstreetmap.de/josmfile?page=Presets/Leaftype&zip=1
+ https://josm.openstreetmap.de/josmfile?page=Presets/Heritage&zip=1
+ https://josm.openstreetmap.de/josmfile?page=Presets/Historical_Objects&zip=1
+ https://raw.githubusercontent.com/Sowa1980/Start_Data_preset/master/Start_Data_preset.zip
+ https://raw.githubusercontent.com/species/josm-preset-wheelchair/master/sidewalks_kerbs.xml
+ http://mijndev.openstreetmap.nl/~allroads/JOSM/Presets/NL-Fiets.zip
+ https://josm.openstreetmap.de/josmfile?page=Presets/NewTags&zip=1

Map paint styles:
+ https://josm.openstreetmap.de/josmfile?page=Styles/Incline&zip=1
+ https://josm.openstreetmap.de/josmfile?page=Styles/NewHighwayColors&zip=1
- https://josm.openstreetmap.de/josmfile?page=Styles/Lit&zip=1
- https://josm.openstreetmap.de/josmfile?page=Styles/FixmeAndNote&zip=1
+ https://josm.openstreetmap.de/josmfile?page=Styles/MaxspeedIcons&zip=1
- https://josm.openstreetmap.de/josmfile?page=Styles/MapWithAI&zip=1
- https://signs.tools4osm.nl/JOSM/Styles_Traffic_signs-style.mapcss
+ https://josm.openstreetmap.de/josmfile?page=Styles/Bench&zip=1
+ https://josm.openstreetmap.de/josmfile?page=Styles/Building_Levels_Labels&zip=1
+ https://raw.githubusercontent.com/species/josm-preset-traffic_sign_direction/master/direction.mapcss
- https://www.dropbox.com/s/qo3ai47fpv241jf/Styles_Fixme_and_Notes.zip?raw=1
+ https://josm.openstreetmap.de/josmfile?page=Styles/Greenery&zip=1

Last errors/warnings:
- 00000.279 W: extended font config - overriding 'filename.Myanmar_Text=mmrtext.ttf' with 'MMRTEXT.TTF'
- 00000.281 W: extended font config - overriding 'filename.Mongolian_Baiti=monbaiti.ttf' with 'MONBAITI.TTF'
- 00000.605 E: java.security.KeyStoreException: Windows-ROOT not found. Cause: java.security.NoSuchAlgorithmException: Windows-ROOT KeyStore not available
- 00010.347 E: Failed to locate image 'MapWithAI'
- 01705.373 E: Handled by bug report queue: java.lang.IllegalArgumentException: Listener Magic Wand (instance of org.openstreetmap.josm.plugins.devseed.JosmMagicWand.MagicWandDialog) was not registered before or already removed.



=== REPORTED CRASH DATA ===
DialogsPanel#destroy:
 - dialog: Magic Wand
 - dialog-class: class org.openstreetmap.josm.plugins.devseed.JosmMagicWand.MagicWandDialog

BugReportExceptionHandler#handleException:
No data collected.

Warning issued by: BugReportExceptionHandler#handleException

=== STACK TRACE ===
Thread: AWT-EventQueue-0 (23) of main
java.lang.IllegalArgumentException: Listener Magic Wand (instance of org.openstreetmap.josm.plugins.devseed.JosmMagicWand.MagicWandDialog) was not registered before or already removed.
	at org.openstreetmap.josm.tools.ListenerList.failRemove(ListenerList.java:137)
	at org.openstreetmap.josm.tools.ListenerList.removeListener(ListenerList.java:131)
	at org.openstreetmap.josm.data.Preferences.removePreferenceChangeListener(Preferences.java:261)
	at org.openstreetmap.josm.gui.dialogs.ToggleDialog.destroy(ToggleDialog.java:492)
	at org.openstreetmap.josm.gui.dialogs.DialogsPanel.destroy(DialogsPanel.java:330)
	at org.openstreetmap.josm.gui.MapFrame.destroy(MapFrame.java:355)
	at org.openstreetmap.josm.gui.MainPanel.updateContent(MainPanel.java:59)
	at org.openstreetmap.josm.gui.MainPanel$1.afterLastLayerRemoved(MainPanel.java:162)
	at org.openstreetmap.josm.gui.layer.MainLayerManager.realRemoveSingleLayer(MainLayerManager.java:334)
	at org.openstreetmap.josm.gui.layer.LayerManager.realRemoveLayer(LayerManager.java:266)
	at org.openstreetmap.josm.gui.layer.LayerManager.lambda$removeLayer$1(LayerManager.java:248)
	at org.openstreetmap.josm.gui.util.GuiHelper.runInEDTAndWaitWithException(GuiHelper.java:247)
	at org.openstreetmap.josm.gui.layer.LayerManager.removeLayer(LayerManager.java:248)
	at org.openstreetmap.josm.gui.dialogs.layer.DeleteLayerAction.actionPerformed(DeleteLayerAction.java:52)
	at java.desktop/javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
	at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
	at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
	at java.desktop/javax.swing.DefaultButtonModel.setPressed(Unknown Source)
	at java.desktop/javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
	at java.desktop/java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
	at java.desktop/java.awt.Component.processMouseEvent(Unknown Source)
	at java.desktop/javax.swing.JComponent.processMouseEvent(Unknown Source)
	at java.desktop/java.awt.Component.processEvent(Unknown Source)
	at java.desktop/java.awt.Container.processEvent(Unknown Source)
	at java.desktop/java.awt.Component.dispatchEventImpl(Unknown Source)
	at java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.desktop/java.awt.Component.dispatchEvent(Unknown Source)
	at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
	at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
	at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
	at java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.desktop/java.awt.Window.dispatchEventImpl(Unknown Source)
	at java.desktop/java.awt.Component.dispatchEvent(Unknown Source)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source)
	at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
	at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
	at java.base/java.security.AccessController.doPrivileged(Unknown Source)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
	at java.desktop/java.awt.EventQueue$5.run(Unknown Source)
	at java.desktop/java.awt.EventQueue$5.run(Unknown Source)
	at java.base/java.security.AccessController.doPrivileged(Unknown Source)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
	at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.run(Unknown Source)

Unable to load plugin

I'm getting the following message "Could not load plugin 'josm_magic_wand'. Delete from preferences?"

Running version 18593 of JOSM and openjdk 17

Show dominant color detected for trial & error, and as stop-gap for color picking

Maybe this is not intended here, but I wanted to have an eyedropper functionality in JOSM to pick colors from imagery. There is only an old request https://josm.openstreetmap.de/ticket/8935 from a decade ago, stale since 5 years ago from administrative activities.
Here, the panel could show the main color found, and allow copying of its hex code (and perhaps closest color name if possible), for tagging *colour=. I believe this will be helpful for Magic Wand usage in the first place, to learn what landscapes and colors work best. Ultimately, it could evolve into a new functionality, a separate mode that allows selecting all pixels in view or selection that matches the color according to the options. (I don't know how useful it will be)

Magic Wand SAM action

Hello
Please, can you help me to activate “Magic Wand SAM action”, because when I click on it and then the following message appeared:
Click inside of active AOI to enable Segment Anything Model.

Is it necessary to install an additional component on the JOSM, or program, or special settings?

Thanks and regards

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.