Skip to content

Label in OpenStreetMap

Trace each object in OpenStreetMap over the project imagery, so every label is checked against the same images the model trains on. Then download the traced areas with the HOT Export Tool. LearnOSM teaches editing in iD; the steps below cover what this workflow adds. In JOSM, add the imagery as in LearnOSM: adding imagery.

OpenAerialMap states that "All imagery is available to be traced in OpenStreetMap" (source). For imagery released under a licence with attribution, the OpenStreetMap Foundation publishes waiver templates. Mapping for a project follows the Organised Editing Guidelines.

1. Add the project imagery

  1. Open iD from https://www.openstreetmap.org/edit and log in.
  2. Open the Background panel (B) and click … next to Custom.
  3. Paste the project's tile URL in Custom Background Settings and click OK.

iD accepts {z} as it is (iD source).

Custom Background Settings with the Freetown tile URL

2. Find the objects

  1. Drag the file saved with Download cells in View the results onto the map. iD shows it under Map Data (U) > Custom Map Data.
  2. Zoom to a marked cell.
  3. Check that each area already mapped there matches the object in the image.

Drone imagery of Freetown in iD at zoom 20

3. Trace and tag each object

  1. Click Area and trace tight around an array of touching panels.
  2. Choose the Rooftop Solar Panel preset.
  3. Click Accept the suggested updates when iD suggests generator:output:electricity=yes.
  4. Repeat steps 1 to 3 for each array of touching panels.

The preset adds power=generator, generator:source=solar, generator:method=photovoltaic, generator:type=solar_photovoltaic_panel and location=roof (preset, OSM wiki).

A traced array with its tags in iD

For other objects, trace each one as an area (the auto labeller skips points), with these tags:

  • Water tanks: man_made=storage_tank and content=water (wiki). Where line: man_made = 'storage_tank' AND content = 'water'.
  • Ponds: natural=water and water=pond (wiki). Where line: natural = 'water' AND water = 'pond'.
  • Green spaces, such as parks: leisure=park (wiki). Where line: leisure = 'park'.

In step 5, rename solar_panels (letters, numbers and underscores), list the tag keys under select, and use the object's where line. For water tanks:

water_tanks:
  types:
    - polygons
  select:
    - man_made
    - content
  where: >-
    man_made = 'storage_tank'
    AND content = 'water'

Other green spaces and water bodies use other tags (Key:leisure, Key:water). The Export Tool accepts AND (YAML guide).

4. Upload

Click Save and upload the changes, as in LearnOSM.

5. Download with the HOT Export Tool

Log in to the HOT Export Tool with your OpenStreetMap account and click Start Exporting. Fill in the four steps of the form (source):

  1. Describe: name the export, and draw the area of interest on the map, or load area-of-interest.geojson from Create a Locate project in the Import AOI dialog (source).
  2. Formats: tick Geojson .geojson.
  3. Data: open the YAML tab and paste:

    solar_panels:
      types:
        - polygons
      select:
        - power
        - generator:source
        - location
      where: generator:source = 'solar'
    
  4. Summary: click Create Export, then download the .zip file when it is ready.

The YAML follows the Export Tool's YAML guide. The tool updates from OpenStreetMap every minute (source).

The HOT Export Tool start page

6. Load the file in the auto labeller

  1. In the auto labeller, load the project.
  2. Under Load labels (GeoJSON), click the file field (Choose File or Browse…) and pick the .geojson file from the download.
  3. Go through the tiles with Next, and tap any object that is still missing.
  4. Click Download dataset, then check the dataset.

Labels loaded from a GeoJSON file on a tile in the auto labeller

Roads and drains

Roads and drains are delivered as lines. The auto labeller skips lines, so the file comes straight from the Export Tool. Map every road or drain in the project area.

  1. In step 3, trace each road or drain as a line along its centre, with highway=* and surface=* for a road (Key:highway, Key:surface), or waterway=drain for a lined drain and waterway=ditch for an unlined one (drain, ditch). Add surface to every road, including those already mapped, and move any line that doesn't match the imagery.
  2. In step 5, use lines under types:

    roads:
      types:
        - lines
      select:
        - highway
        - surface
      where: >-
        highway IN ('primary','secondary','tertiary',
        'unclassified','residential','service','track')
        AND surface IS NOT NULL
    

    For drains, list waterway under select and use where: waterway IN ('drain','ditch'). The Export Tool accepts IN, AND and IS NOT NULL (YAML guide).

  3. Unzip the download and open its .geojson file in QGIS. Open the attribute table and click the field calculator. Tick Create a new field, set Output field name to object_name and Output field type to text, enter 'road' or 'drain' with the single quotes, and click OK. Click Save Edits, then right-click the layer, choose Export > Save Features As…, set Format to GeoJSON and name the file labels.geojson.

  4. Open labels.geojson in a text editor and add the imagery_url line after "type": "FeatureCollection",, as in The imagery URL at the top.