Skip to content

Instantly share code, notes, and snippets.

View pnorman's full-sized avatar

Paul Norman pnorman

View GitHub Profile
@pnorman
pnorman / disableheals.lua
Created February 20, 2014 11:50
from Semlar on IRC
local oCombatText_AddMessage = CombatText_AddMessage
CombatText_AddMessage = function(message, ...)
if not message:find('%[') then
oCombatText_AddMessage(message, ...)
end
end
@pnorman
pnorman / addresses.style
Last active August 29, 2015 13:56
address nodes near buildings of the same address but not inside
node,way addr:unit text polygon
node,way addr:housenumber text polygon
node,way addr:street text polygon
node,way addr:city text polygon
node,way building text polygon
node,way z_order int4 linear # This is calculated during import
way way_area real # This is calculated during import
@pnorman
pnorman / toast.md
Created March 5, 2014 09:24
toast query snippet

We can use a varient of the pg_class disk usage queries to find how much space is used by the toast tables for each of the rendering tables.

SELECT mains.relname, 
    toasts.relpages::bigint*8192 AS "toast size", toasts.reltuples AS "toast tuples", indexes.relpages::bigint*8192 AS "toast index size"
  FROM pg_class toasts
    JOIN pg_class mains ON (toasts.oid = mains.reltoastrelid)
    LEFT JOIN pg_class indexes ON (indexes.oid = toasts.reltoastidxid)
  WHERE 
 mains.relname IN ('planet_osm_point', 'planet_osm_line', 'planet_osm_polygon');
@pnorman
pnorman / clc_cleanup.sql
Created March 23, 2014 01:21
SQL queries for finding CLC meadows for cleanup
CREATE TEMPORARY TABLE clc_ways AS SELECT id AS way_id,nodes
FROM ways w
LEFT JOIN relation_members rm ON (w.id = rm.member_id AND rm.member_type='W')
WHERE tags ? 'CLC:id'
AND tags @> hstore('landuse','meadow')
AND version=1
AND rm.relation_id IS NULL;
CREATE INDEX ON clc_ways (way_id) WITH (fillfactor=100);
ANALYZE clc_ways;
#placenames-medium {
[capital = 'yes'] {
[zoom >= 5][zoom < 15] {
text-name: "[name]";
text-size: 10;
text-fill: @placenames;
text-face-name: @book-fonts;
text-halo-radius: 1.5;
text-min-distance: 10;
[zoom >= 6] {
@pnorman
pnorman / index.html
Last active August 29, 2015 14:01 — forked from tyrasd/index.html
<!DOCTYPE html>
<html>
<head>
<script src='http://api.tiles.mapbox.com/mapbox.js/v0.6.7/mapbox.js'></script>
<link href='http://api.tiles.mapbox.com/mapbox.js/v0.6.7/mapbox.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
#map { position:absolute; top:0; bottom:0; width:100%; }
</style>
</head>
@pnorman
pnorman / index.html
Last active August 29, 2015 14:02
crossroad-names demo
<!DOCTYPE html>
<html>
<head>
<script src='http://api.tiles.mapbox.com/mapbox.js/v0.6.7/mapbox.js'></script>
<link href='http://api.tiles.mapbox.com/mapbox.js/v0.6.7/mapbox.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
#map { position:absolute; top:0; bottom:0; width:100%; }
</style>
</head>
@pnorman
pnorman / distinct outer tags.sql
Last active August 29, 2015 14:02
SQL queries used for determining old-style multipolygon member information
SELECT count(*), n_tags
FROM (SELECT count(DISTINCT w.tags) AS n_tags
FROM relations r
JOIN relation_members rm ON (r.id=rm.relation_id)
JOIN ways w ON (rm.member_type='W' AND rm.member_role='outer' AND rm.member_id=w.id)
WHERE r.tags=hstore('type','multipolygon')
GROUP BY r.id) AS s
GROUP BY n_tags
ORDER BY n_tags;
@pnorman
pnorman / install.sh
Created June 20, 2014 21:58
Shell commands for postgres on 12.04
sudo -i
cat > /etc/apt/sources.list.d/pgdg.list <<EOF
deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main
#deb-src http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main
EOF
wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | apt-key add -
apt-get update
apt-get --no-install-recommends install -y postgresql-9.3-postgis-2.1 postgresql-contrib-9.3 proj-bin
@pnorman
pnorman / arizona.geojson
Last active August 29, 2015 14:03
States with IRs cut
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.