start new:
tmux
start new with session name:
tmux new -s myname
#include <mapnik/map.hpp> | |
#include <mapnik/load_map.hpp> | |
#include <mapnik/agg_renderer.hpp> | |
#include <mapnik/image.hpp> | |
#include <mapnik/image_util.hpp> | |
main() { | |
mapnik::Map m(256,256); | |
mapnik::load_map(m, ‘path/to/file.xml’); | |
m.zoom_all(); |
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
Mapnik is very smart about converting map scale to zoom level. As a secret/power user feature, Mapnik exposes a !scale_denominator!
variable that changes according to the zoom level and + latitude of the vector tile being rendered. Read about the Mapnik's !scale_denominator!
variable here.
With some postgres magic, the !scale_denominator
lets us control which features appear and disappear, within a layer.
Concretely this is a two-part process. First you will need to load the following z()
function into your PostGIS database:
CREATE OR REPLACE FUNCTION public.z(scaledenominator numeric)
# Some good references are: | |
# http://russbrooks.com/2010/11/25/install-postgresql-9-on-os-x | |
# http://www.paolocorti.net/2008/01/30/installing-postgis-on-ubuntu/ | |
# http://postgis.refractions.net/documentation/manual-1.5/ch02.html#id2630392 | |
#1. Install PostgreSQL postgis and postgres | |
brew install postgis | |
initdb /usr/local/var/postgres | |
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start |