Skip to content

Instantly share code, notes, and snippets.

View springmeyer's full-sized avatar

Dane Springmeyer springmeyer

View GitHub Profile
$ otool -L _mapnik.node
_mapnik.node:
/usr/lib/libexpat.1.dylib (compatibility version 7.0.0, current version 7.2.0)
/usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
/usr/lib/libltdl.7.dylib (compatibility version 9.0.0, current version 9.2.0)
/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.3)
/usr/lib/libxml2.2.dylib (compatibility version 10.0.0, current version 10.3.0)
/usr/lib/libicucore.A.dylib (compatibility version 1.0.0, current version 40.0.0)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.9.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.0)
@springmeyer
springmeyer / create_index.js
Created August 10, 2011 23:41
create an sqlite rtree spatial index using node-sqlite3 and node-mapnik
/*
wget http://dl.dropbox.com/u/342088/10m-us-parks-area.sqlite
ogr2ogr -f SQLite parks.sqlite ParkPly_900913.shp
dane$ ogr2ogr -f SQLite parks.sqlite ~/Documents/MapBox/cache/2976a0c1-10m-us-parks-area/2976a0c1-10m-us-parks-area.shp
*/
// attachdb usage
> ds.featureset().next().attributes()
{ '"1995"': 0,
'"1996"': 0,
'"1997"': 0,
'"1998"': 0,
'"1999"': 0,
'"2000"': 0,
'"2001"': 0,
'"2002"': 0,
Index: utils/shapeindex/shapeindex.cpp
===================================================================
--- utils/shapeindex/shapeindex.cpp (revision 3106)
+++ utils/shapeindex/shapeindex.cpp (working copy)
@@ -23,6 +23,7 @@
#include <iostream>
+#include <fstream>
#include <vector>
Process: Xcode [76148]
Path: /Developer-old/Applications/Xcode.app/Contents/MacOS/Xcode
Identifier: com.apple.Xcode
Version: 3.2.6 (1761)
Build Info: DevToolsIDE-18070000~38
Code Type: X86-64 (Native)
Parent Process: launchd [195]
Date/Time: 2011-08-15 11:39:56.406 -0700
OS Version: Mac OS X 10.6.8 (10K549)
> feature.attributes()
{ 'abbrev\u0002': 'Aruba',
adm0_a3: 'ABW',
adm0_dif: 1,
admin: 'Aruba',
featurecla: 'Adm-0 country',
fips_10_: 0,
gdp_md_est: 2258,
geou_dif: 0,
iso_a2: 'AW',
TypeError: Use the new operator to create new Database objects
at /Users/dane/projects/tilemill_master/node_modules/millstone/lib/millstone.js:347:26
at Array.forEach (native)
at Function.processSql (/Users/dane/projects/tilemill_master/node_modules/millstone/lib/millstone.js:343:24)
at next (/Users/dane/projects/tilemill_master/node_modules/millstone/node_modules/step/lib/step.js:51:23)
at Function.<anonymous> (/Users/dane/projects/tilemill_master/node_modules/millstone/lib/millstone.js:244:29)
at native
at /Users/dane/projects/tilemill_master/node_modules/millstone/lib/millstone.js:314:44
at path.js:292:19
{ grid:
[ ' ',
' ',
' ',
' ',
' ',
' ',
' ',
' ',
' ',
{ grid:
[ ' !!##!###############$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$',
' ####################$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$',
' ! !!###################$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$',
'!!! !!!!##################$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$',
'!!!!! !!!!!!!!##############$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$',
'!!!!!!###!!#################$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$',
'!!!!!!!#!!!#################$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$',
'!!!!!!!!!!##################$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$!',
'!!!!!!!!!!##################$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$!!',
var wgs2merc = function(lon,lat) {
lon = parseFloat(lon);
lat = parseFloat(lat);
var x = lon * 20037508.34 / 180;
var y = Math.log(Math.tan((90 + lat) * Math.PI / 360)) / (Math.PI / 180);
y = y * 20037508.34 / 180;
return [x,y];
}