Skip to content

Instantly share code, notes, and snippets.

View mvexel's full-sized avatar

Martijn van Exel mvexel

View GitHub Profile
@mvexel
mvexel / WELCOME.md
Created March 7, 2013 16:01 — forked from tmcw/WELCOME.md

Welcome to OpenStreetMap You have just joined an international volunteer organization whose goal is nothing less than a rich, detail map of the whole world that is open-source. What does that mean? It means that this is a map whose data is available to everyone for free. OpenStreetMap is an important effort that will have impact around the globe. Millions who never have had access to geographical information now will have access to

@mvexel
mvexel / gist:4355365
Created December 21, 2012 19:59
test learnosm to md
![image](data:image/*;base64,iVBORw0KGgoAAAANSUhEUgAAAHgAAAB4CAYAAAA5ZDbSAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAAbrwAAG68BXhqRHAAAAAd0SU1FB9sFFhAQAF9bcF4AACAASURBVHjatL15kG3ZVeb3W3vvM9whp/fyDTXPr+aSqlSDJCQ0CyRwC2iBJNqYhibAYGNoBw43YbojsN3dduAIsKE7jA1uYwculTCIQSOaWkNJqlEqqWaVVHO9Mee8955h7738xz7nZj5VISRVO19lvFeZ+e4956y91vrWt761ngDct3YHrzr4Hu478wFR4ZAoyypEUVVVCYq2gnoVaUErqWR68/nv4ds/7jn1focASrjl8HuV/x8/Ht38JFacBI3WK3rdyptD/71PPPun12/XG0uVTE8tLC3Ntk+t188/8M3qULk8/fkf/5/8t7/WP//Af2IuvvwyOxgNwrAYxB+7+FcBuPP4/80PnPMz/8Gu+bOP/iVHjiwAYkVErlx+01nX8ujGZw4ANyH8vChXKvrzV628+YGX854CcO/aHdx8MBnsvjN3/JqK/A+CtqjUqjpT2BLRbUU2QJ8X5SlFngZ9UlROKrpxy+H3bpxt7NudqkRVjbcdfR93H38/WOXWw+97GUb9FIIxIggIx5beODfqF0/ens28XITKu8SYX95tti/ZnJ7e9W1zMjThePTxeDEun8yL7EFV/abNs7WFxfHWOw/8x+siw/mDjtVX5QtrD9jC5QFFbzv6Pu46eTu3Hfn+rltVuevJP5cYoywsLpnzl9/uV3KZf/+xzU8dUJXLQd4swrtU5XqEkagC/JdXrrzpdwEe2fgEV6+87fsz8H1nPgBgXrX6U/HetQ/8gKj+NcgBVVAUUEQAFRBQIF2AeFV9SpH7Ef2yqN6D8OQth973/NzQp98vMagxz0zCLbf+QjpEd/wer3rPr/+9F/fY5mdAEEAEMWOO+nOXrpp//yf
@mvexel
mvexel / gist:3703142
Created September 12, 2012 00:03
10 shortest osm ways in Utah
id | len
-----------+-------------------
10086055 | 0.31805243453502
10163052 | 0.779236434027553
148346396 | 0.796935186703433
150809275 | 0.984805582524682
135488964 | 0.994712842046126
10242974 | 1.105460030193
10113886 | 1.12411794159561
159095055 | 1.15479053716816
@mvexel
mvexel / gist:3641217
Created September 5, 2012 17:53
valgrind shp2pgsql
mvexel@lima$ valgrind /usr/lib/postgresql/9.1/bin/shp2pgsql -c -D -I -i -s 4326 /osm/externaldata/census/tl_2012_us_states_dissolved.shp tl_2012_us_states_dissolved usboundary > /osm/tmp/us.sql
==5501== Memcheck, a memory error detector
==5501== Copyright (C) 2002-2009, and GNU GPL'd, by Julian Seward et al.
==5501== Using Valgrind-3.6.0.SVN-Debian and LibVEX; rerun with -h for copyright info
==5501== Command: /usr/lib/postgresql/9.1/bin/shp2pgsql -c -D -I -i -s 4326 /osm/externaldata/census/tl_2012_us_states_dissolved.shp tl_2012_us_states_dissolved usboundary
==5501==
Shapefile type: Polygon
Postgis type: MULTIPOLYGON[2]
==5501==
==5501== HEAP SUMMARY:
@mvexel
mvexel / gist:3640577
Created September 5, 2012 17:27
faulty SQL from shp2pgsql
This file has been truncated, but you can view the full file.
SET CLIENT_ENCODING TO UTF8;
SET STANDARD_CONFORMING_STRINGS TO ON;
BEGIN;
CREATE TABLE "tl_2012_us_states_dissolved" (gid serial,
"id" int4);
ALTER TABLE "tl_2012_us_states_dissolved" ADD PRIMARY KEY (gid);
SELECT AddGeometryColumn('','tl_2012_us_states_dissolved','geom','4326','MULTIPOLYGON',2);
COPY "tl_2012_us_states_dissolved" ("id",geom) FROM stdin;
0 0106000020E610000061000000010300000001000000390000005C76887F580465C01A323A2009332DC07533A31F0D0565C0729D62D520342DC0A053909F8D0565C0669E95B4E2332DC038DC476ECD0565C07C6934B918332DC0BC1FB75F3E0665C0B6C7444AB3312DC00327DBC09D0665C02043E389202E2DC07F7EDFBFF90665C0B6E5797077262DC0EC6987BF260765C04CAD8559681F2DC080828B15350765C01C92AF04521A2DC0AD1C5A643B0765C05A67D13B15182DC080F5B86F350765C0EE756F4562122DC01E0071572F0765C09ED920938C0C2DC0AAE28DCC230765C006B1FA230C0B2DC0E9BD3104000765C01683F92B64062DC0D6DF1280FF0665C0F23A8DB454062DC09424CFF5FD0665C08662484E26062DC07825C973FD0665C0301ADCD616062DC0263E7782FD0665C048E3344415062DC01E679AB0FD0665C0B40BE9F010062DC0C05E
@mvexel
mvexel / gist:3257796
Created August 4, 2012 13:32
script used to periodically update data for http://lima.schaaltreinen.nl/redaction/#
#!/bin/sh
cd /osm/planet/us/uptodate/
mv us-new.o5m us.o5m
mv redaction-ways-new.o5m redaction-ways.o5m
/osm/software/osmupdate us.o5m us-new.o5m -t=tmp/ --planet-url=http://planet.openstreetmap.org/redaction-period/ -B=/osm/poly/us/us.poly
/osm/software/osmfilter us-new.o5m --keep-ways="@uid=722137" --keep-nodes= --keep-relations= -o=redaction-ways-new.o5m
/osm/software/osmconvert redaction-ways.o5m redaction-ways-new.o5m --diff --fake-lonlat -o=redaction-ways-change.osc
/osm/software/osmosis-latest/bin/osmosis --rxc redaction-ways-change.osc --wpc database=redaction user=osm password=osm
@mvexel
mvexel / gist:3254632
Created August 4, 2012 04:57
osmosis error
Aug 3, 2012 10:57:25 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Osmosis Version 0.40.1
Aug 3, 2012 10:57:25 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Preparing pipeline.
Aug 3, 2012 10:57:25 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Launching pipeline execution.
Aug 3, 2012 10:57:25 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Pipeline executing, waiting for completion.
Aug 3, 2012 10:57:25 PM org.openstreetmap.osmosis.core.pipeline.common.ActiveTaskManager waitForCompletion
SEVERE: Thread for task 1-rxc failed
@mvexel
mvexel / gist:3254628
Created August 4, 2012 04:57
osm change file
<?xml version='1.0' encoding='UTF-8'?>
<osmChange version="0.6" generator="osmconvert 0.7A">
<bounds minlat="18.70231" minlon="-179.7538999" maxlat="71.46277" maxlon="-66.9069899"/>
<delete>
<node id="39119187" version="4" timestamp="2010-12-13T22:39:45Z" changeset="6653839" uid="28237" user="lyx"/>
<node id="39140353" version="3" timestamp="2009-10-10T21:36:34Z" changeset="2808342" uid="175186" user="the_winch_tiger"/>
<node id="39140358" version="3" timestamp="2009-10-10T21:36:34Z" changeset="2808342" uid="175186" user="the_winch_tiger"/>
<node id="39140360" version="3" timestamp="2009-10-10T21:36:34Z" changeset="2808342" uid="175186" user="the_winch_tiger"/>
<node id="39140363" version="3" timestamp="2009-10-10T21:36:34Z" changeset="2808342" uid="175186" user="the_winch_tiger"/>
<node id="39140365" version="3" timestamp="2009-10-10T21:36:34Z" changeset="2808342" uid="175186" user="the_winch_tiger"/>
@mvexel
mvexel / gist:3186208
Created July 27, 2012 04:39
graph builder java runtime error.
2012-07-26 22:36:46,931 DEBUG [MapBuilder.java:62] : Matching: RouteVariant(811 from CANYON RD @ 1195 N (UTA_19144)) ncoords = 314
2012-07-26 22:36:47,224 DEBUG [StreetMatcher.java:114] : seen / total: 13179 / 50000
2012-07-26 22:36:47,382 DEBUG [StreetMatcher.java:114] : seen / total: 13486 / 100000
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00007f4c0a42e0b7, pid=564, tid=139964451636992
#
# JRE version: 6.0_24-b24
# Java VM: OpenJDK 64-Bit Server VM (20.0-b12 mixed mode linux-amd64 compressed oops)
@mvexel
mvexel / tiger.py
Created May 12, 2012 18:19 — forked from emacsen/pyxbot.py
OSM Tiger expansion code
#!/usr/bin/env python
"""This is the base library that can used to run various OSM bots
which are implemented as plugins"""
import sys
import os
from xml.sax.handler import ContentHandler
from xml.sax import make_parser
import codecs