Correcting OpenStreetMap wrong tag values
As a hobbyist consumer of OSM data to render maps, I find wrong tags annoying. Bad values mean that the resulting map is wrong or incomplete, so less useful. I decided to attack the most egregious ...
Source: .:: Marcos Dione/StyXman's glob ::.
As a hobbyist consumer of OSM data to render maps, I find wrong tags annoying. Bad values mean that the resulting map is wrong or incomplete, so less useful. I decided to attack the most egregious ones, which include typos, street names instead of type and some other errors. The idea is to attack the long tail first, so I'm not blocked because the next batch of errors (objects with exactly the same error) looks too big (yes, OCD). So I hacked a small python script to help me find and edit them: #! /usr/bin/env python3 import os import psycopg2 def main(): db = psycopg2.connect(dbname='europe') cursor = db.cursor() cursor.execute(''' SELECT count(*) AS count, highway FROM planet_osm_line WHERE highway IS NOT NULL GROUP BY highway ORDER BY count ASC ''') data = cursor.fetchall() for count, highway in data: print(f"next {count}: {highway}") cursor.execute(''' SELECT osm_id FROM planet_osm_line WHERE highway = %s ''', (highway, )) for (osm_id, ) in cursor.fetchall(): if osm_id < 0: # in