Skip to content

Repository files navigation

OSM Speed Limit Editor

A Chrome/Chromium extension for viewing and editing OpenStreetMap speed-limit tags directly in the iD editor.

The extension adds a color-coded speed overlay, connected-road suggestions, directional speed editing, and controls for reducing visual clutter while mapping.

Features

  • Color-coded road overlay based on maxspeed, maxspeed:forward, and maxspeed:backward.
  • Shared speed colors for roads, the legend, and connected-road suggestion buttons.
  • Interpolated colors for speed limits between configured palette entries.
  • General or separate forward/backward speed-limit editing.
  • Reset and remove speed-limit values through the editor panel.
  • Connected-road suggestions based on nearby ways.
  • Optional car-accessible-road filtering.
  • Optional hiding of areas, vertices, and point markers.
  • On-map popup or Chrome side-panel display.
  • Live settings synchronization without reloading the OSM page.
  • Ctrl+click on a selected path to add a node through the normal iD editing flow.

Requirements

  • Chrome or Chromium with Manifest V3 and side-panel support.
  • A logged-in OpenStreetMap account.
  • Access to https://www.openstreetmap.org/.

Installation from source

  1. Clone the repository and install dependencies:

    git clone https://github.com/nsbgg/osms.git
    cd osms
    npm install
  2. Build the extension:

    npm run build

    The build creates the ignored dist/ directory used by the manifest.

  3. Open chrome://extensions.

  4. Enable Developer mode.

  5. Click Load unpacked and select the repository directory.

Reload the extension from the Extensions page after rebuilding. Open an OSM edit page afterward if the previous page was loaded before the new build.

Usage

  1. Open an OSM edit page at https://www.openstreetmap.org/edit or https://www.openstreetmap.org/id.
  2. Select one or more road paths in iD.
  3. Enter a speed limit, choose a connected-road suggestion, or set both forward and backward values.
  4. Click Apply to selection.
  5. Review the resulting iD changes and use iD's normal Save workflow.

To add a node, select a path and hold Ctrl while clicking the path at the desired position. Splitting and subsequent editing remain part of the normal iD workflow.

Settings

The settings panel is available from the extension popup and side panel:

  • Enable OSM Speed Limit Editor: turns the extension behavior on or off while leaving normal iD available.
  • Show legend: toggles the speed-color legend.
  • Only show car-accessible streets: filters the displayed road paths.
  • Hide areas: hides iD area geometry.
  • Hide vertices: hides iD vertices.
  • Hide markers: hides iD point markers.
  • Editor location: selects the on-map popup or Chrome side panel.

The theme button switches the side panel between light and dark appearance.

Speed colors

The palette is defined in src/lib/config.ts through OSM_SPEED_CONFIG.colors. Exact configured limits use their configured color; values between two configured limits are linearly interpolated. Special values use the configured no_limit and unknown colors.

Speed (km/h) Color
5 #f958ff
10 #00FF00
20 #9096ee
30 #87e4eb
50 #ffd000
70 #FF6347
100 #800080
130 #0303f1
No limit #808080
Unknown / no data #CCCCCC

Development

Install dependencies, then use the following commands:

npm run build       # Clean and compile the extension into dist/
npm test            # Run the Jest tests
npm run test:watch  # Run tests in watch mode
npm run lint        # Type-check without emitting files

For additional development guidance, see CONTRIBUTING.md.

Project structure

osms/
├── manifest.json              # Chrome extension manifest
├── scripts/build.js           # Clean build entry point
├── src/
│   ├── edit-content-script.ts # iD integration, overlay, and editing
│   ├── page-bridge.ts         # Main-world bridge for iD pointer events
│   ├── service-worker.ts      # Storage, popup, and side-panel messages
│   ├── sidepanel.ts           # Side-panel UI
│   ├── osms.html              # Popup markup
│   ├── lib/                   # Shared configuration, UI, and logging
│   └── styles/                # Extension and editor styles
├── test/                      # Jest tests
└── dist/                      # Generated build output, not committed

License

This project is licensed under the Open Data Commons Open Database License (ODbL) v1.0. OpenStreetMap data remains subject to the OpenStreetMap license and attribution requirements. See LICENSE for details.

About

A Chrome/Chromium extension for viewing and editing OpenStreetMap speed-limit tags directly in the iD editor.

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages