Skip to content

developmentseed/JosmMagicWand

Repository files navigation

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.