OpenStreetMap logo OpenStreetMap

Post When Comment
rw

I can see the village is now mapped. Have you thought about adding local knowledge, using StreetComplete? https://streetcomplete.app/

You will need access to a smartphone to do this.

Thanks,

Chris.

Solar farms uk

The OSM tag wiki should help. I find this from one of the linked reports:

https://taginfo.geofabrik.de/europe:united-kingdom/tags/plant%3Asource=solar#map

Chris

Correcting wrong tag values

Nice work.

Correcting wrong tag values

Thanks for the clarification Marcos, makes sense to keep the edits manual for accuracy.

I had a go at tidying up the script a little, in case it’s useful. The main changes:

  • Swapped os.system() for subprocess.run() — a bit safer and more Pythonic
  • Added an input() pause between objects so they open one at a time rather than all at once
  • Used a context manager for the DB connection
  • Added a HAVING count(*) < N filter to focus on the long tail and skip common valid values
  • Added a KNOWN_GOOD set to skip values you already know are fine
  • Added comments explaining the negative-ID-means-relation behaviour (I didn’t know that, good to learn!)

Revised script below. Sorry about the formatting, the diary interprets hash/ pound as bold font, they should be comments in the script. Happy to be ignored if you prefer your original — it clearly does the job! :)

Chris


Revised script

```python #! /usr/bin/env python3 “”” fix_osm_tags.py - Find and manually correct wrong highway tag values in OSM.

Requires a local osm2pgsql rendering database (e.g. ‘europe’). Workflow: 1. Queries planet_osm_line for highway values, rarest first (long tail first). 2. For each rare value, opens the OSM editor in your browser one object at a time. 3. You review, correct or leave a note, then press Enter to continue. “””

import subprocess import sys

import psycopg2

— Configuration —

DB_NAME = “europe” BROWSER = “librewolf” BROWSER_PROFILE = “default”

Highway values that are known-good and should be skipped.

# Expand this list to avoid being prompted for valid rare values. KNOWN_GOOD = { “residential”, “track”, “path”, “footway”, “cycleway”, “service”, “unclassified”, “tertiary”, “secondary”, “primary”, “trunk”, “motorway”, “living_street”, “pedestrian”, “steps”, “motorway_link”, “trunk_link”, “primary_link”, “secondary_link”, “tertiary_link”, }

Only show groups with fewer than this many occurrences.

# Keeps the focus on the long tail of rare/likely-wrong values. MAX_COUNT = 50

def open_in_editor(osm_id: int) -> None: “"”Open the OSM web editor for a given osm2pgsql osm_id.

In osm2pgsql rendering databases, negative IDs represent relations;
positive IDs represent ways.
"""
if osm_id < 0:
    # Negative ID => relation
    url = f"https://www.openstreetmap.org/edit?relation={-osm_id}"
else:
    # Positive ID => way
    url = f"https://www.openstreetmap.org/edit?way={osm_id}"

subprocess.run([BROWSER, "-P", BROWSER_PROFILE, url], check=False)

def main() -> None: with psycopg2.connect(dbname=DB_NAME) as db: cursor = db.cursor()

    # Fetch highway values ordered by frequency ascending (rarest first).
    # HAVING filters out common values that are unlikely to be errors,
    # keeping the focus on the suspicious long tail.
    cursor.execute(
        """
        SELECT
            count(*) AS count,
            highway
        FROM planet_osm_line
        WHERE
            highway IS NOT NULL
        GROUP BY highway
        HAVING count(*) < %s
        ORDER BY count ASC
        """,
        (MAX_COUNT,),
    )
    groups = cursor.fetchall()

    for count, highway in groups:
        # Skip values we already know are valid.
        if highway in KNOWN_GOOD:
            continue

        print(f"\n{'='*50}")
        print(f"Value: '{highway}'  ({count} occurrence{'s' if count != 1 else ''})")
        print("Press Enter to open each object, or type 's' to skip this group.")

        choice = input("> ").strip().lower()
        if choice == "s":
            continue

        # Fetch all OSM IDs with this highway value.
        cursor.execute(
            """
            SELECT osm_id
            FROM planet_osm_line
            WHERE highway = %s
            """,
            (highway,),
        )
        osm_ids = [row[0] for row in cursor.fetchall()]

        for i, osm_id in enumerate(osm_ids, start=1):
            print(f"  Opening {i}/{len(osm_ids)} (osm_id={osm_id}) ...")
            open_in_editor(osm_id)

            # Note: if the object no longer exists in OSM, the editor
            # will open a view of the whole planet — just close that tab.
            if i < len(osm_ids):
                next_action = input("  Press Enter for next, or 's' to skip rest of group: ").strip().lower()
                if next_action == "s":
                    break

    print("\nAll done!")

if name == “main”: sys.exit(main()) ```

Correcting wrong tag values

Nice script, Marcos! Would you be able to share an example of a ‘before’ and ‘after’ tag?

Thanks,

Chris

I built a free neighborhood scoring tool for 50 European cities using OSM data

Excellent job, well done.

Chris

Finally giving back...

Well done, have you tried StreetComplete? https://streetcomplete.app/

Chris

Lethbridge Neighbourhoods & My first edit!

You’re doing a really good job, Marcie. Re the addresses, if you’ve got an Android smartphone, I think having a look at StreetComplete https://streetcomplete.app/?lang=en-gb would help.

Take care,

Chris

Lethbridge Neighbourhoods & My first edit!

Hi, Marcie.

Well done for taking your first foray into editing the best map in the world! You’re bound to make some mistakes as you go along, we all do.

Something to watch out for, is importing information from sources that don’t have a compatible licence. The government map you refer to, may have some sort of proprietary licence; it’s best, if possible, to survey in person, and update OSM with what you can see. The other downside of relying on other maps, is you may introduce errors to OSM, from poorly verified local maps. Just something to watch out for.

Not sure whether you’ve heard of it, but an app called StreetComplete is good for adding information.

Good luck,

Chris (UK)

Sulphur (Springs) Creek

Cool, have fun. Don’t forget the quick and easy updates that you can do, using the StreetComplete smartphone app.

https://streetcomplete.app/

Chris

Sulphur (Springs) Creek

Perhaps add this tag, to show the previously used name?

osm.wiki/Key:old_name

Chris

Did you know OSMwrapped? Also celebrating 1 year of mapping everyday.

This is new to me, but thanks for highlighting it.

Chris

New properties to be added

Hi, Ray.

Good work! To help your efforts, are you aware of the RapidID editor? It analyses the mapping imagery and suggests houses, etc. https://rapideditor.org/

This of course, should not replace common sense, and if using this method, it should be done in small batches. Mass/ automated editing is strongly discouraged, and just because Rapid identifies something, it may not be correct; you should always be sure, before committing the change.

Happy mapping.

Chris

Statistics.. Statistics.. Statistics..

Hi, this sounds interesting. Are you aware of the useful tools, here: ohsome - dashboard https://share.google/PiwlQi1k512agz7ec

Thanks,

Chris

Sakumaps v2

Hi, rphyrin.

That’s a really good idea, especially the reuse of your code. I’m not a developer, but am trying to get MOROW off the ground. I have two versions; one based on old code, which I couldn’t get to build, and one created in Flutter, which I’ve just started. Any thoughts you have, would be greatly received.

https://github.com/chrisdebian

Chris

Learning OSM and JOSM and Accessibility

Jason, I meant to say, have you tried the StreetComplete app? https://streetcomplete.app

Cheers,

Chris

Learning OSM and JOSM and Accessibility

OSM devs, I wonder how we get this on the backlog, to factor into future planning? Jason makes valid points. I tried the accessibility checker, but it came up with a paywall, for me.

Cheers,

Chris chris_debian 2E0FRU

Finding streets that are really steps with OSMnx

Good point, Alan.

I guess there would have to be a minimal acceptable imagery resolution, for a Quest to be available.

Thanks,

Chris

Finding streets that are really steps with OSMnx

Alan,

You mentioned SCEE, and I wonder whether StreetComplete or SCEE could be more formally used. Could you engage with the StreetComplete community, to see whether it would be possible to create a Quest to improve the map based on your good work?

For example, for highlighted areas, like the SCEE import, the quest could ask “This appears to be a steep gradient, are there steps here?”

Just an idea.

Well done,

Chris

Hello, OSM!

Cool!