Skip to content

Instantly share code, notes, and snippets.

View pnorman's full-sized avatar

Paul Norman pnorman

View GitHub Profile
@pnorman
pnorman / routerelation.sql
Created June 27, 2014 09:06
Finds route relations and ways where refs disagree on usage of -
SELECT r.id as rid, w.id as wid, r.tags->'ref' as rref, w.tags->'ref' as wref
FROM relations r JOIN relation_members rm on (r.id=rm.relation_id) JOIN ways w on (rm.member_id = w.id and rm.member_type='W')
WHERE r.tags@>hstore('type','route')
AND r.tags@>hstore('route','road')
AND r.tags?'ref'
AND (r.tags->'ref') LIKE '%-%'
AND w.tags?'ref'
AND w.tags?'highway'
AND NOT (w.tags->'ref') LIKE '%-%'
@pnorman
pnorman / geotag.sh
Last active August 29, 2015 14:03
Toolchain for geotagging photos
# Copy images into suitable named directory indicating date and trip
export GEM_HOME=/home/pnorman/osm/gpx2exif
# Sharpen and fix colours
mogrify -unsharp 8x1.7 -normalize *-*/IMG_*.JPG
# Adjust times. Reverse sign from JOSM. My camera drifts so that I need a positive time in JOSM, so this tends to be -= for me.
exiftool "-DateTimeOriginal-=0:0:2" "-CreateDate-=0:0:2" *-*/*.JPG
# Geotag
(
SELECT
w.way, string_agg(COALESCE(r.ref, w.ref),';') AS ref,
w.highway, char_length(string_agg(COALESCE(r.ref, w.ref),';')) AS length
FROM (
SELECT
ctid, way, highway, ref
FROM planet_osm_roads r
WHERE r.highway in ('motorway','trunk','primary','secondary')
AND r.way && !bbox!) AS w
@pnorman
pnorman / 01_results.txt
Last active August 29, 2015 14:07
Analysis of OpenStreetMap US board candidate edits
Name │ First edit │ Changes │ Changesets │ US changes │ US changesets │ Changes │ Changesets │ Weeks where US edit │ "Average" state[1]
│ │ │ │ │ │ in last year │ in last year │ made in last year │
Martijn van Exel │ 2007-06-10 │ 216635 │ 3485 │ 166989 │ 2545 │ 58763 │ 1179 │ 52 │ Illinois
Andrew Wiseman │ 2011-02-12 │ 82543 │ 1222 │ 5200 │ 198 │ 34643 │ 582 │ 19 │ Cape Verde[2]
Richard Welty │ 2009-04-04 │ 382843 │ 8831 │ 382589 │ 8720 │ 76168 │ 838 │ 45 │ New York
Dale Kunce │ 2013-05-30 │ 63770 │ 201 │ 18432 │ 92 │ 53055 │ 147 │ 13 │ Cape Verde
Alex Barth │ 2012-02-10 │ 82565 │ 1192 │ 33266 │ 633 │ 31436
@pnorman
pnorman / announce.md
Last active August 29, 2015 14:07
OpenStreetMap Carto v2.22.0 Announcement

OpenStreetMap Carto v2.22.0

Labels on Shelf

OpenStreetMap Carto v2.22.0 has been released. This release focuses on labels.

The biggest change is a rewrite of landcover labelling. A landcover label is text connected to a background colour or pattern rendering, and not connected to an icon. This has been demoed extensively, and well received. It was also sent to the mailing list. The big changes are making colours better connected to the background, rendering labels on some features where they weren't before, and sizing labels based on area.

The last deserves a better explanation. Previously, the selection and choice of what labels to render didn't include area. It now does, avoiding placing labels on features that are only a few pixels in area at low and middle zooms, and selecting font size based on feature area. This results in a much

@pnorman
pnorman / multitest.json
Created January 28, 2015 18:02
osm2pgsql #267 testcase that does not reproduce
[
{
"name": "foo",
"type": "point",
"tagtransform": "multitest.lua",
"tagtransform-node-function": "foo_nodes",
"tagtransform-way-function": "drop_all",
"tagtransform-relation-function": "drop_all",
"tagtransform-relation-member-function": "drop_all",
"tags": [
@pnorman
pnorman / CHANGELOG.md
Last active August 29, 2015 14:26
openstreetmap carto changelog
@pnorman
pnorman / notes.md
Last active August 29, 2015 14:27
v2.33.0 openstreetmap carto release notes

OpenStreetMap Carto 2.33.0 has been released. This release focuses on cartographic style improvements, but the release notes also include 2.32.0.

The biggest changes are

  • A randomized symbology for forests for natural=wood and landuse=forest #1728 #1242

A long time in the works, this improvement has finally landed. The two tags were merged - they are indistinguishable to the data consumer. A randomized symbology was first suggested by SK53 at SOTM-EU 2014, and this feature would not have happened without his extensive research, or imagico tools for creating an [irregular but uniformly distributed and periodic dot pat

@pnorman
pnorman / initial.sh
Last active December 4, 2015 19:04
zfs setup
gpart create -s GPT da8
gpart create -s GPT da9
gpart add -s 222 -a 4k -t freebsd-boot -l boot0 da8
gpart add -a 4k -t freebsd-zfs -l disk0 -s 650GB da8
gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 da8
gpart add -s 222 -a 4k -t freebsd-boot -l boot1 da9
gpart add -a 4k -t freebsd-zfs -l disk1 -s 650GB da9
gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 da9