Skip to content

Instantly share code, notes, and snippets.

View springmeyer's full-sized avatar

Dane Springmeyer springmeyer

View GitHub Profile
0: (0/65536/425529295.36597) (169 167 58 255)
8: (0/3882/2858575.32094) (107 116 46 255)
8: (+15/15/24780.89266) (54 49 23 255)
14: (0/7/601.31393) (49 37 5 255)
8: (0/4/35.52377) (45 34 5 255)
12: (0/4/35.51977) (45 34 5 255)
9: (0/1/0.00100) (42 32 4 255)
13: (0/3/0.00300) (46 35 5 255)
12: (0/3/168.21615) (55 41 6 255)
8: (0/1/0.00200) (49 37 5 255)
@springmeyer
springmeyer / unique-colors.py
Created November 30, 2012 21:15
use mapnik.Image to dump out all rgba colors in an image
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import mapnik
import sys
def pixel2channels(pixel):
alpha = (pixel >> 24) & 0xff
red = pixel & 0xff
green = (pixel >> 8) & 0xff
@springmeyer
springmeyer / instances.css
Created November 29, 2012 22:46
carto instances with marker example
#crashes_2007_2009_intensity {
first/marker-fill:#2136E8;
first/marker-width: 100;
first/marker-opacity: 0.01;
first/marker-line-width: 0;
first/marker-allow-overlap: true;
second/marker-fill:#17ACCE;
second/marker-width: 50;
second/marker-opacity: 0.01;
second/marker-line-width: 0;
@springmeyer
springmeyer / print-shapefile-feature.py
Created November 29, 2012 00:58
mapnik natural earth field parsing bug
import mapnik
# wget http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/cultural/ne_10m_populated_places.zip
ds = mapnik.Shapefile(file='ne_10m_populated_places.shp',row_limit=1)
# fixes the shape:
# ogr2ogr ne_10m_populated_places_fixed.shp ne_10m_populated_places.shp
#ds = mapnik.Shapefile(file='ne_10m_populated_places_fixed.shp',row_limit=1)
feats = ds.all_features()
print feats[0]
@springmeyer
springmeyer / mapnik-2.0.x-arrow.svg
Created November 28, 2012 01:45
svg arrow that matches Mapnik 2.0.x default arrow marker
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
diff --git a/js/site.js b/js/site.js
index df5fbb6..672ff5b 100644
--- a/js/site.js
+++ b/js/site.js
@@ -1,4 +1,4 @@
-var mm = com.modestmaps, map;
+var mm = com.modestmaps, map, glow;
$.domReady(function() {
function mapMM() {
$('#map')[0].innerHTML = '';
@springmeyer
springmeyer / mapnik-linux-fonts.txt
Created November 27, 2012 21:25
default fonts available on stock ubuntu
$ node
> require('mapnik').fonts()
[ 'DejaVu Sans Bold',
'DejaVu Sans Bold Oblique',
'DejaVu Sans Book',
'DejaVu Sans Condensed',
'DejaVu Sans Condensed Bold',
'DejaVu Sans Condensed Bold Oblique',
'DejaVu Sans Condensed Oblique',
'DejaVu Sans ExtraLight',
@springmeyer
springmeyer / agg-svg.diff
Created November 22, 2012 03:50
svg patch against agg from http://pastebin.com/CtysNL14
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt (revision 50)
+++ CMakeLists.txt (working copy)
@@ -302,6 +302,8 @@
./svg_viewer/agg_svg_path_renderer.h
./svg_viewer/agg_svg_path_tokenizer.cpp
./svg_viewer/agg_svg_path_tokenizer.h
+ ./svg_viewer/agg_svg_gradient.cpp
+ ./svg_viewer/agg_svg_gradient.h
@springmeyer
springmeyer / osmpgsql.txt
Created November 20, 2012 02:26
ansi + pedantic osm2pgsql compile
clang '-DDARWIN' '-D_THREAD_SAFE' '-DVERSION="0.80.0"' '-DBUILD_READER_PBF' '-DPLATFORM="mac"' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DOSM2PGSQL_DATADIR="/usr/local/share/osm2pgsql"' -I../include -I/usr/local/include -I/usr/include/libxml2 -I../. -g -O0 -pedantic -Wall -ansi -MMD -MF out/Debug/.deps/out/Debug/obj.target/osm2pgsql/UTF8sanitizer.o.d.raw -c -o out/Debug/obj.target/osm2pgsql/UTF8sanitizer.o ../UTF8sanitizer.c
/Debug/obj.target/osm2pgsql/UTF8sanitizer.o.d.raw -c -o out/Debug/obj.target/osm2pgsql/UTF8sanitizer.o ../UTF8sanitizer.c
../UTF8sanitizer.c:34:5: warning: 'long long' is an extension when C99 mode is not enabled [-pedantic,-Wlong-long]
long long line;
^
../UTF8sanitizer.c:35:5: warning: 'long long' is an extension when C99 mode is not enabled [-pedantic,-Wlong-long]
long long chars1, chars2, chars3, chars4, chars5, chars6;
^
../UTF8sanitizer.c:35:5: warning: 'long long' is an extension when C99 mode is not enabled [-pedantic,-Wlong-long]
../UTF8sanitizer.c:35
@springmeyer
springmeyer / osmpgsql.txt
Created November 20, 2012 02:22
osm2pgsql pedantic warnings (errors on windows)
../node-ram-cache.c:122:9: warning: extension used [-pedantic,-Wlanguage-extension-token]
Swap( queue[i], queue[parent] );
^
../node-ram-cache.c:112:21: note: expanded from macro 'Swap'
#define Swap(a,b) { typeof(a) __tmp = a; a = b; b = __tmp; }
^
../node-ram-cache.c:135:29: warning: arithmetic on a pointer to void is a GNU extension [-pedantic,-Wpointer-arith]
result = blockCache + cacheSize - pos + SAFETY_MARGIN;
~~~~~~~~~~ ^
../node-ram-cache.c:135:41: warning: arithmetic on a pointer to void is a GNU extension [-pedantic,-Wpointer-arith]