Skip to content

Instantly share code, notes, and snippets.

@grischard
grischard / udata-latest.sh
Last active May 15, 2018 00:34
Download latest file from data.public.lu, run process if download was successful
#!/bin/bash
# Run in cron: udata-latest.sh && process.sh whatever_latest.zip
# Dataset UUID you want to track
UDATA_UUID='fdd093fe-60ad-4673-b194-00cc302a728a'
# Name of symlink pointing to latest version
LATEST='OpenData_latest.zip'
# No user serviceable parts below
url=$(curl --silent https://data.public.lu/fr/datasets/r/$UDATA_UUID -w "%{redirect_url}\n" -o /dev/null)
#!/usr/bin/env python
"""
Add missing Serbian transliterations
- Downloads places with a name:sr but no name:sr-Latn in Kosovo from overpass
- Transliterates missing values using cyrtranslit
- Writes enriched data to enriched_place.osm
#!/usr/bin/env python
"""
Add missing Serbian transliterations to Kosovo place=* objects
- Downloads places with a name:sr but no name:sr-Latn in Kosovo from overpass
- Transliterates missing values using cyrtranslit
- Writes enriched data to enriched_place.osm
To run:
@grischard
grischard / create_osm_street_list.sql
Created September 11, 2018 11:08
Import and maintain openstreetmap into postgis for Luxembourg
-- The following lines must be added to /usr/local/Cellar/osm2pgsql/HEAD/share/osm2pgsql/default.style
-- # Extras for create_osm_street_list.sql
-- way postal_code text linear
-- way alt_name text linear
-- way name:lb text linear
-- way alt_name:lb text linear
-- way is_in:city text linear
DROP TABLE IF EXISTS road_names_osm;
#!/usr/bin/env python3
"""
Process diffs between Luxembourg address dumps
TODO
-- notice if an address has changed street, postcode or house number
#!/usr/bin/env python
from xmltodict import parse, unparse
import requests
import psycopg2
from psycopg2.extras import DictCursor
from collections import OrderedDict
import logging
logging.basicConfig(level=logging.WARNING)
#!/usr/bin/env python
import argparse
# results = []
from requests_xml import XMLSession
import re
import datetime
from collections import Counter
stop_id orig_lat orig_lon my_lat my_lon note
008000044 NULL NULL 50.732311 7.094813 % CFL Bonn
008000085 NULL NULL 51.220229 6.790818 % CFL DUESSELDORF HBF
008230082 NULL NULL 47.58591 6.89754 % Belfort-Montbéliard
008700021 NULL NULL 47.32305 5.02712 % Dijon Ville(France)
008700032 NULL NULL 46.30274 4.82459 % Macon Ville(France)
008700040 NULL NULL 45.74833 4.82568 % Lyon-Perrache
008700097 NULL NULL 43.60435 3.88058 % Montpellier-St-Roch
008700151 NULL NULL 43.83238 4.36634 % Nîmes(France)
008700152 NULL NULL 45.76051 4.86015 % Lyon Part Dieu(Franc
@grischard
grischard / create_osm_street_list.sql
Last active February 11, 2019 14:25
Scripts to import OSM in Luxembourg
-- The following lines must be added to default.style
-- # Extras for create_osm_street_list.sql
-- way postal_code text linear
-- way alt_name text linear
-- way name:lb text linear
-- way alt_name:lb text linear
-- way is_in:city text linear
DROP TABLE IF EXISTS road_names_osm;
/*
Find out which reference ways aren't present in osm too
With many thanks to Jerry Clough (http://www.openstreetmap.org/user/SK53) and Rory McCann (http://www.openstreetmap.org/user/rorym)
reference is all reference highways, planet_osm_bighighways is all osm significant ways:
construction
cycleway