Skip to content

Instantly share code, notes, and snippets.

@maxerickson
maxerickson / osm_chunker.py
Last active February 5, 2020 01:05
Split an osm xml file into pieces of a given size, outputting reasonably compact, referentially complete chunks.
#!python3
import os.path
import argparse
import collections
import operator
import xml.etree.ElementTree as ElementTree
import geohash_hilbert
@maxerickson
maxerickson / RI.validator.mapcss
Last active June 16, 2019 18:07
Validation rules for surface tagging highways
way[highway=motorway][!surface],
way[highway=motorway_link][!surface],
way[highway=trunk][!surface],
way[highway=trunk_link][!surface],
way[highway=primary][!surface],
way[highway=primary_link][!surface],
way[highway=secondary][!surface],
way[highway=secondary_link][!surface],
way[highway=tertiary][!surface],
@maxerickson
maxerickson / USAddress.validator.mapcss
Last active March 7, 2020 14:20
JOSM validation rules for US addresses.
/* JOSM Validator rules for flagging potential issues with US addresses.*/
/* check addr:city for capitalization. */
*["addr:city"]["addr:city"!~/([A-Z][^\s]*)/]{
group: tr("US Address");
throwWarning: tr("Check capitalization of addr:city.");
}
*["addr:city"=~/,/]{
group: tr("US Address");
throwWarning: tr("Check addr:city for extra info.");
@maxerickson
maxerickson / max.presets.xml
Created January 17, 2020 21:53
My josm presets file.
<?xml version="1.0" encoding="UTF-8"?>
<presets xmlns="http://josm.openstreetmap.de/tagging-preset-1.0">
<chunk id="gnis_cleaner">
<key key="ele" />
<key key="import_uuid" />
<key key="gnis:county_id" />
<key key="gnis:county_name" />
<key key="gnis:created" />
<key key="gnis:edited" />
<key key="gnis:feature_type" />
193
144
Memorial Healthcare
826 West King Street Owosso 48867
Emergency Mismatch (CMS:no)
Memorial Healthcare
1. The Behavioral Center Of Michigan
4050 E 12 Mile Road Warren 48092 (CMS:no)
2.38 Saint John Macomb-Oakland Hospital, Warren
11800 East 12 Mile Road Warren 48093
@maxerickson
maxerickson / formatphone.sh
Last active February 21, 2022 22:12
Format Phone Number
#!/bin/bash
# use with Clipman
# Pattern: (?!\+1 \d{3} \d{3} \d{4}).{0,9}(\d{3}).{0,5}(\d{3}).{0,5}(\d{4}).{0,5}
# Command: /opt/formatphone.sh "+1 \1 \2 \3"
echo -n $1 | xclip -in -selection clipboard