Skip to content

Instantly share code, notes, and snippets.

View springmeyer's full-sized avatar

Dane Springmeyer springmeyer

View GitHub Profile
#!/bin/sh
echo '' >> ~/.bash_profile
echo '# Settings for Mapnik.framework Installer to enable Mapnik programs and python bindings' >> ~/.bash_profile
echo 'export PATH=/Library/Frameworks/Mapnik.framework/Programs:$PATH' >> ~/.bash_profile
echo 'export PYTHONPATH=/Library/Frameworks/Mapnik.framework/Python:$PYTHONPATH' >> ~/.bash_profile
import sqlite3
db = '<db.sqlite>'
sql = 'select tile_data from tiles limit 1'
con = sqlite3.connect(db)
cur = con.cursor()
tiles = con.execute()
f = open('test.png','wb')
t = tiles.fetchone()
f.write(t[0])
f.close()
ERROR 1: Invalid Feature object. Missing 'properties' member.
ERROR 1: Layer schema generation failed.
ERROR 4: Failed to read GeoJSON data
ERROR 1: Invalid Feature object. Missing 'properties' member.
ERROR 1: Layer schema generation failed.
ERROR 4: Failed to read GeoJSON data
FAILURE:
Unable to open datasource `files/data/untitled.geojson' with the following drivers.
@springmeyer
springmeyer / elastic_geo_query
Created April 12, 2011 01:32
testing geo_bounding_box functionality in elastic search
# remove index
curl -XDELETE 'http://localhost:9200/geo/'
# {"ok":true,"acknowledged":true}
# add some data
curl -XPOST http://localhost:9200/geo/1 -d '{
"pin" : {
"location" : {
"lat" : 1.1,
Thread 5 (process 46611):
#0 0x00007fff86f9ffca in __semwait_signal ()
#1 0x00007fff86fa3de1 in _pthread_cond_wait ()
#2 0x000000010002c657 in etp_proc (thr_arg=<value temporarily unavailable, due to optimizations>) at ../deps/libeio/eio.c:1490
#3 0x00007fff86f9e536 in _pthread_start ()
#4 0x00007fff86f9e3e9 in thread_start ()
Thread 4 (process 46611):
#0 0x00000001262ff900 in pj_datum_transform ()
#1 0x0000000126300192 in pj_transform ()
Thread 5 (process 46611):
#0 0x00007fffffe007db in __memcpy ()
#1 0x00007fff844801a2 in std::string::_S_construct<char const*> ()
#2 0x00007fff844801f0 in std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string ()
#3 0x0000000127f9fdf5 in dbf_file::add_attribute ()
#4 0x0000000127fb372e in shape_featureset<mapnik::filter_in_box>::next ()
#5 0x00000001258b1a9b in mapnik::feature_style_processor<mapnik::agg_renderer<mapnik::image_32> >::apply_to_layer (this=0x12a45bcc0, lay=@0x12550afd0, p=@0x12a45bcc0, proj0=<value temporarily unavailable, due to optimizations>, scale_denom=34942641.501794897) at feature_style_processor.hpp:358
#6 0x00000001258b25c0 in mapnik::feature_style_processor<mapnik::agg_renderer<mapnik::image_32> >::apply (this=<value temporarily unavailable, due to optimizations>) at feature_style_processor.hpp:114
#7 0x000000012586bf70 in Map::EIO_Render (req=<value temporarily unavailable, due to optimizations>) at ../src/mapnik_map.cpp:679
#8 0x000000010002ca1
Thread 5 (process 46581):
#0 0x00007fff86f9ffca in __semwait_signal ()
#1 0x00007fff86fa3de1 in _pthread_cond_wait ()
#2 0x000000010002c657 in etp_proc (thr_arg=<value temporarily unavailable, due to optimizations>) at ../deps/libeio/eio.c:1490
#3 0x00007fff86f9e536 in _pthread_start ()
#4 0x00007fff86f9e3e9 in thread_start ()
Thread 4 (process 46581):
#0 0x00007fff86f9ffca in __semwait_signal ()
#1 0x00007fff86fa3de1 in _pthread_cond_wait ()
@springmeyer
springmeyer / degress2meters.js
Last active August 22, 2024 14:22
convert from long/lat to google mercator (or EPSG:4326 to EPSG:900913)
// See https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames for more details.
var degrees2meters = function(lon,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]
}
x= -77.035974
{
"type": "FeatureCollection",
"features": [
{ "type": "Feature",
"properties": { "name": "whitehouse" },
"geometry" : { "type": "Point", "coordinates": [ -8575605.398444, 4707174.018280 ] }
}
]
}
@springmeyer
springmeyer / gdb backtrac
Created March 15, 2011 20:38
ubuntu backtraces of hung threads
Program received signal SIGSEGV, Segmentation fault.
0x00000000005e30f2 in v8::internal::HeapObject::map_word (this=0xcf11) at /home/ubuntu/src/tilemill/src/node-0.2.6/deps/v8/src/objects-inl.h:1056
1056 return MapWord(reinterpret_cast<uintptr_t>(READ_FIELD(this, kMapOffset)));
(gdb) thread apply all bt
Thread 6 (Thread 0x7fffc439a700 (LWP 15259)):
#0 pthread_cond_timedwait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:211
#1 0x00000000005b4800 in etp_proc (thr_arg=0xd873c0) at ../deps/libeio/eio.c:1490
#2 0x00007ffff6a2a9ca in start_thread (arg=<value optimized out>) at pthread_create.c:300
#3 0x00007ffff678770d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112