Skip to content

Instantly share code, notes, and snippets.

View springmeyer's full-sized avatar

Dane Springmeyer springmeyer

View GitHub Profile
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import mapnik2
print mapnik2.Expression("[NOM_FR] = 'Québec'")
f = mapnik2.Feature(0)
print 'Québec'
f["name"] = 'Québec'
on osx with g++ i686-apple-darwin10-g++-4.2.1 I get:
lots of:
In file included from ../src/sqlite3.cc:8:
../src/database.h:48: error: a storage class can only be specified for objects and functions
../src/database.h:55: error: a storage class can only be specified for objects and functions
which can be fixed with:
@springmeyer
springmeyer / world_borders.grid
Created February 17, 2011 21:15
like the old days
[
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000000",
@springmeyer
springmeyer / grid_renderer
Created February 16, 2011 21:33
polygon's rasterized as chars
{ "grid":
[
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
Map {
background-color: #43a4d1;
}
/* grey outline */
#world::big_glow [POP2005 > 1000000]{
line-color: #ddd;
line-width: 4;
}
Index: include/mapnik/feature_style_processor.hpp
===================================================================
--- include/mapnik/feature_style_processor.hpp (revision 2548)
+++ include/mapnik/feature_style_processor.hpp (working copy)
@@ -323,6 +323,7 @@
boost::apply_visitor(symbol_dispatch(p,*feature,prj_trans),sym);
}
}
+ break;
}
diff --git a/bin/ndistro b/bin/ndistro
index 537261f..a155ebf 100755
--- a/bin/ndistro
+++ b/bin/ndistro
@@ -11,8 +11,9 @@
VERSION="0.4.0"
DIR=${0%/*}
-ROOT=$(pwd)
+ROOT="$(pwd)"
// command line test:
#!/usr/bin/env node
var SphericalMercator = require('./lib/tilelive/sphericalmercator.js')
var merc = new SphericalMercator({})
min_zoom = 1;
max_zoom = 2;
// if we have a merc extent
extent = [-20037508.34,-20037508.34,20037508.34,20037508.34];
@springmeyer
springmeyer / zoom_to_scale.py
Created January 21, 2011 17:31
convert from zoom level to mapnik scale
def getScale(zoom):
return 279541132.014 / (2 ** (zoom-1))
It appears that node REPL is calling the functions on a c++ addon as part of inspection, of of course this fails if the functions need arguments. Is this intended?
$ node -e "require('srs')"
util.js:91
return value.inspect(recurseTimes);
^
TypeError: first argument must be srs string in any form readable by OGR, like WKT (.prj file) or a proj4 string
at format (util.js:91:20)
at Object.inspect (util.js:254:10)