Skip to content

Instantly share code, notes, and snippets.

@erjiang
erjiang / merge-building-addrs.py
Last active October 15, 2015 21:44 — forked from balrog-kun/merge-building-addrs.py
Merge two .osm files, one with building footprints, one with address nodes. Write output.osm.
#! /usr/bin/python2
# vim: fileencoding=utf-8 encoding=utf-8 et sw=4
import sys
import os
import xml.etree.cElementTree as ElementTree
import string
outroot = ElementTree.Element("osm", { "version": "0.6" })
bldgroot = ElementTree.parse(sys.argv[1]).getroot()
@erjiang
erjiang / dp.py
Created April 22, 2013 03:32 — forked from xarg/dp.py
# pure-Python Douglas-Peucker line simplification/generalization
#
# this code was written by Schuyler Erle <schuyler@nocat.net> and is
# made available in the public domain.
#
# the code was ported from a freely-licensed example at
# http://www.3dsoftware.com/Cartography/Programming/PolyLineReduction/
#
# the original page is no longer available, but is mirrored at
# http://www.mappinghacks.com/code/PolyLineReduction/