Skip to content

Instantly share code, notes, and snippets.

View springmeyer's full-sized avatar

Dane Springmeyer springmeyer

View GitHub Profile
@springmeyer
springmeyer / up.sh
Created September 11, 2011 23:53
upgrade tilemill on foss4g workshop machines as sudo
cd ~/src/mapnik2
make uninstall
stop tilemill
apt-add-repository ppa:developmentseed/mapbox
apt-add-repository ppa:chris-lea/node.js
apt-get update -y
apt-get install -y tilemill
apt-get install -y python-mapnik2
@springmeyer
springmeyer / gist:1220551
Created September 15, 2011 21:38
interaction of linejoin/linecap/approximation_scale on rendering perf in mapnik when drawing lines
# line symbolizer on 10m-admin-0-countries.shp
* linejoin can double line rendering times
* approximation scale can mostly avoid, but ideally don't use linejoin unless absolutely necessary
## default line symbolizer
$ howfast.py world_merc.xml 10
min: 0.2484 | avg: 0.2500 | total: 2.4999
## additional impact of "round" linejoin
min: 0.3711 | avg: 0.3736 | total: 3.7358
@springmeyer
springmeyer / gdalinfo.sh
Created October 4, 2011 19:42
gdalinfo on foss4g 2011 benchmark rasters
$ for i in $(ls ../benchmarking/wms/2011/data/*.bil); do gdalinfo $i;done
Driver: EHdr/ESRI .hdr Labelled
Files: ../benchmarking/wms/2011/data/NED_17672037.bil
../benchmarking/wms/2011/data/NED_17672037.bil.ovr
../benchmarking/wms/2011/data/NED_17672037.blw
../benchmarking/wms/2011/data/NED_17672037.bil.aux.xml
../benchmarking/wms/2011/data/NED_17672037.hdr
../benchmarking/wms/2011/data/NED_17672037.stx
../benchmarking/wms/2011/data/NED_17672037.prj
@springmeyer
springmeyer / ruby-mapnik.sh
Created October 9, 2011 04:11
compile ruby-mapnik against mapnik trunk on ubuntu 11.04
## install mapnik 2.x (trunk) from nightlies
# be careful with this because these change nightly
# and may require you re-compile apps using mapnik
# after you run `apt-get upgrade` post installation of mapnik
apt-get install python-software-properties
apt-add-repository ppa:mapnik/nightly-trunk
sudo apt-get update
sudo apt-get install libmapnik2 libmapnik2-dev mapnik2-utils python-mapnik2
## install ruby
@springmeyer
springmeyer / mapnik-static-lto.sh
Created October 13, 2011 00:40
Building a complete mapnik stack, statically linked, using clang++ 3.x on ubuntu with the gold-linker and -O4: llvm LTO (link time optimization)
# build mapnik with -O4
# notes for Ubuntu desktop 11.04 running with 4 GB
# as guest within VirtualBox using OSX 10.7 Host
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 11.04
Release: 11.04
Codename: natty
@springmeyer
springmeyer / test-llvm-gold.sh
Created October 13, 2011 01:38
test clang++ and gold ld with LTO
echo '#include <string>' > lib.hpp
echo 'std::string hello();' >> lib.hpp
echo '#include "lib.hpp"' > lib.cpp
echo 'std::string hello() { return "hello world\n"; }' >> lib.cpp
echo '#include <iostream>' > test.cpp
echo '#include "lib.hpp"' >> test.cpp
echo 'int main(void) { std::cout << hello();return 0; }' >> test.cpp
clang++ -o test -O4 test.cpp lib.cpp -use-gold-plugin
./test
clang++ -o src/datasource_cache.os -c -arch x86_64 -arch i386 -mmacosx-version-min=10.6 -isysroot /Developer/SDKs/MacOSX10.6.sdk -isystem osx/sources/include -DU_HIDE_DRAFT_API -DUDISABLE_RENAMING -DHAVE_JPEG -ansi -Wall -ftemplate-depth-300 -DDARWIN -DBOOST_SPIRIT_THREADSAFE -DMAPNIK_THREADSAFE -O3 -finline-functions -Wno-inline -Wno-parentheses -Wno-char-subscripts -DNDEBUG -DHAVE_CAIRO -DLIBTOOL_SUPPORTS_ADVISE -fPIC -I./osx/sources/include/cairomm-1.0 -I./osx/sources/lib/cairomm-1.0/include -I./osx/sources/include/cairo -I./osx/sources/include/sigc++-2.0 -I./osx/sources/lib/sigc++-2.0/include -I./osx/sources/include/pixman-1 -I./osx/sources/include/libpng15 -Ideps/agg/include -I. -Iinclude -Iosx/sources/include -I/Users/dane/projects/mapnik-dev/macbinary/osx/sources/include/freetype2 -I/Users/dane/projects/mapnik-dev/macbinary/osx/sources/include -Isrc/osx/sources/include -I/usr/include/libxml2 -I/usr/include src/datasource_cache.cpp
ubuntu@ubuntu-VirtualBox:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 11.04
Release: 11.04
Codename: natty
ubuntu@ubuntu-VirtualBox:~$ sudo apt-get update
[sudo] password for ubuntu:
Ign http://extras.ubuntu.com natty InRelease
@springmeyer
springmeyer / ogr_test.sh
Created October 27, 2011 20:54
ogrinfo detecting geojson
$ ogrinfo --version
GDAL 1.8.1, released 2011/07/09
# create a normal json file with an ext
$ echo '{ "type": "FeatureCollection", "features": [ { "type": "Feature", "geometry": {"type": "Point", "coordinates": [102.0, 0.5]}, "properties": {"prop0": "value0"} } ]}' > file.json
# this works as expected
$ ogrinfo file.json
ERROR 4: GeoJSON Driver doesn't support update.
Had to open data source read-only.
Index: apps/gdal_rasterize.cpp
===================================================================
--- apps/gdal_rasterize.cpp (revision 23283)
+++ apps/gdal_rasterize.cpp (working copy)
@@ -281,7 +281,7 @@
/* -------------------------------------------------------------------- */
/* If we are in inverse mode, we add one extra ring around the */
/* whole dataset to invert the concept of insideness and then */
-/* merge everything into one geomtry collection. */
+/* merge everything into one geometry collection. */