Skip to content

Instantly share code, notes, and snippets.

@maxerickson
maxerickson / wiki.js
Last active November 1, 2018 12:40
Ease copying OSM tags for Wikipedia entry.
// ==UserScript==
// @name Wiki tags
// @namespace maxerickson
// @version 0.1
// @description Add osm style key=value tags to wikipedia pages.
// @author Max Erickson
// @match *://*.wikipedia.org/*
// @grant none
// ==/UserScript==
@maxerickson
maxerickson / simpleMAtranslation.py
Last active July 19, 2018 14:56
ogr2osm.py translation file for MA state addresses.
def filterTags(tags):
if tags is None:
return
newtags = {}
if tags["STREETNAME"]!="":
newtags["addr:street"]=tags["STREETNAME"].title()
if tags["STATE"]!="":
newtags["addr:state"]=tags["STATE"]
if tags["ZIPCODE"]!="":
newtags["addr:postcode"]=tags["ZIPCODE"]
FeatureName ID Class County State Latitude Longitude Ele(ft) Map BGN Date Entry Date wikidata wikipedia
Groveland Township 1625796 Civil Oakland MI 42.8139171 -83.5471684 1004 Davisburg 01-AUG-1995
# -*- coding: utf8 -*-
# mapping for Carreteras estatales found
# at http://www2.pr.gov/agencias/gis/descargaGeodatos/Infraestructuras/Pages/Transportaci%C3%B3n.aspx
# more documentation at http://wiki.openstreetmap.org/wiki/Puerto_Rico_Projects/Puerto_Rico_TIGER_Fixup
#
# need to delete one feature because of character encoding issues.
# ogrinfo -dialect SQLite -sql "delete from g35_viales_carreteras_estatales_julio_2015 where objectid==2022" /share/gis/prhta
road_map={
"Red Primaria Urbana Paseo Peatonal":"footway",
(
way(5610940);
way(5613614);
way(5628515);
way(5668989);
way(5669355);
way(5669945);
way(5670127);
way(5670485);
way(5670627);
/* JOSM Validator rules for flagging potential issues with US highways */
way[highway=unclassified][!name][!ref]{
group: tr("US Highways - Tagging");
throwWarning: tr("Unnamed highway=unclassified");
}
way!:closed[highway=~/ry/]>[index=1] node!:connection:in-downloaded-area,
way!:closed[highway=~/ry/]>[index=-1] node!:connection:in-downloaded-area{
group: tr("US Highways - Geometry");
#!/bin/python3
import json
import os
import argparse
def make_parser():
parser = argparse.ArgumentParser(description='Clean up tags.')
parser.add_argument('input', type=str,
Existing height for 261458936 125 14.0
Existing height for 261458937 107 125.0
Existing height for 261458938 110 125.0
Existing height for 261458939 46 125.0
Existing height for 261458940 121 125.0
Existing height for 261458941 121 125.0
Existing height for 261458942 110 125.0
Existing height for 261458943 114 125.0
Existing height for 261458944 118 125.0
Existing height for 261458945 23 125.0
#! /bin/bash -x
# transform USFS tag scheme to osm tags
INFILE=$1
OUTFILE=$2
INLAYER=$(basename $INFILE)
INLAYER=${INLAYER%.*}
OUTLAYER=$(basename $OUTFILE)
OUTLAYER=${OUTLAYER%.*}
# select interesting columns, create osm fields
ogr2ogr -overwrite -sql "select 'FS ' + ID as ref, NAME as name, SYMBOL_COD as fscode, '' as highway, '' as surface from $INLAYER" -f "ESRI Shapefile" $OUTFILE $INFILE
@maxerickson
maxerickson / gist:1438ede6a5bc8282d01f
Created February 5, 2016 16:34
Match coastline with modified geometry.
node:modified < way[natural=coastline]{
throwWarning: tr("Outdated coastline source=");
fixAdd: "source=kartverket n50";
}