Skip to content

Instantly share code, notes, and snippets.

View springmeyer's full-sized avatar

Dane Springmeyer springmeyer

View GitHub Profile
$ cd node-mapnik
$ for VER in {"0.2.4","0.2.5","0.2.6","0.3.0","0.3.1","0.3.2","0.3.3","0.3.4"}
> do ../../sources/node$VER/bin/node test.js
> done
importing ./0.2.4/_mapnik.node
All tests pass...
importing ./0.2.5/_mapnik.node
All tests pass...
importing ./0.2.6/_mapnik.node
All tests pass...
@springmeyer
springmeyer / node-mapnik json.js
Created January 7, 2011 19:35
node-mapnik inspection outputs
map.layers() // all layers
[ { name: 'world',
srs: '+proj=merc +lon_0=0 +lat_ts=0 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs',
styles: [ 'style' ],
datasource:
{ file: './examples/data/world_merc.shp',
type: 'shape' } } ]
map.describe_data()
{ world:
{ type: 'vector',
extent:
[ -20037508.342789248,
-8283343.693882697,
20037508.342789244,
18365151.363070473 ],
encoding: 'utf-8',
@springmeyer
springmeyer / mapnik_pg_test.sql
Created January 8, 2011 00:47
benefit to having !bbox! query manually placed inside subselect beside other WHERE?
/* (SELECT * FROM polygons9 WHERE iucn_category_id = 2) AS GEOM */
tiledb=# explain analyze SELECT AsBinary("the_geom") AS geom from
(SELECT * FROM polygons9 WHERE iucn_category_id = 2) AS GEOM
WHERE "the_geom" && SetSRID('BOX3D(-20037510 2505758.018505042,60267.60323439911 8276874.507094959)'::box3d, 900913);
QUERY PLAN
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Bitmap Heap Scan on polygons9 (cost=19.85..264.07 rows=8 width=93117) (actual time=1.173..2.883 rows=21 loops=1)
Recheck Cond: (the_geom && '010300002031BF0D00010000000500000000000060F81B73C18B5F5E020F1E434100000060F81B
@springmeyer
springmeyer / osr_osx.diff
Created January 17, 2011 20:33
patch to compile libosr on os x
Index: ogr/GNUmakefile
===================================================================
--- ogr/GNUmakefile (revision 21433)
+++ ogr/GNUmakefile (working copy)
@@ -18,4 +18,5 @@
$(LIB): $(OBJ)
rm -f $(LIB)
$(AR) rc $(LIB) $(OBJ)
+ ranlib $(LIB)
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)
@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))
// 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];
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)"
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;
}