Skip to content

Instantly share code, notes, and snippets.

View mvexel's full-sized avatar

Martijn van Exel mvexel

View GitHub Profile
@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
@mvexel
mvexel / gist:2646988
Created May 9, 2012 17:31
Angle calculation in PostGIS
DROP TABLE IF EXISTS angletmp;
CREATE TABLE angletmp AS
WITH
intersections AS
(
SELECT
ST_Transform
(
(ST_Dump
(
@mvexel
mvexel / gist:2356599
Created April 11, 2012 03:09
problematic postgis query
SET search_path TO us,postgis,hstore;
DROP TABLE IF EXISTS candidates;
CREATE TABLE candidates AS
WITH agg_intersections AS
(
WITH intersection_nodes_wayrefs AS
(
WITH intersection_nodes AS
(
SELECT
@mvexel
mvexel / gist:2185839
Created March 24, 2012 18:19
osmosis JRE crash log
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00007fba2048fa3f, pid=24448, tid=140437278418688
#
# JRE version: 6.0_20-b20
# Java VM: OpenJDK 64-Bit Server VM (19.0-b09 mixed mode linux-amd64 compressed oops)
# Derivative: IcedTea6 1.9.13
# Distribution: Ubuntu 10.04.1 LTS, package 6b20-1.9.13-0ubuntu1~10.04.1
# Problematic frame:
@mvexel
mvexel / gist:2185826
Created March 24, 2012 18:17
osmosis crashes JRE
mvexel@lima$ osmosis --rb us.osm.pbf --wpd directory=/osm/tmp
Mar 24, 2012 12:11:51 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Osmosis Version 0.40.1
Mar 24, 2012 12:11:51 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Preparing pipeline.
Mar 24, 2012 12:11:51 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Launching pipeline execution.
Mar 24, 2012 12:11:51 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Pipeline executing, waiting for completion.
#