Skip to content

Instantly share code, notes, and snippets.

View gist:32231
<Map bgcolor="#8cb6d3" srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs +over">
<Style name="line style 1">
<Rule><MaxScaleDenominator>99999</MaxScaleDenominator><LineSymbolizer><CssParameter name="stroke-width">13.0</CssParameter><CssParameter name="stroke">#a1cbea</CssParameter><CssParameter name="stroke-linejoin">round</CssParameter></LineSymbolizer></Rule>
<Rule><MinScaleDenominator>100000</MinScaleDenominator><LineSymbolizer><CssParameter name="stroke-width">9.0</CssParameter><CssParameter name="stroke">#a1cbea</CssParameter><CssParameter name="stroke-linejoin">round</CssParameter></LineSymbolizer></Rule>
<Layer name="layer 2" srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs +over" status="on">
<StyleName>line style 1</StyleName>
<Parameter name="type">shape</Parameter>
View gist:32252
<Parameter name="table"><![CDATA[
(CASE WHEN round(way_area * 1000000) >= 20 THEN 'large'
WHEN round(way_area * 1000000) >= 1 THEN 'medium'
ELSE 'small' END) AS size,
REGEXP_REPLACE(UPPER(name), '(.)', E'\\1\xC2\xA0\xC2\xA0', 'g') AS name_stretched
FROM planet_osm_polygon
ORDER BY z_order ASC, way_area DESC) AS citylike]]></Parameter>
View gist:227536
# turn a django model into a mapnik datasource
def model_to_mapnik_ds(model,geom_name=None):
params = {'user':settings.DATABASE_USER,
if geom_name:
geom_field = [f for f in model._meta.fields if == geom_name][0]
#!/usr/bin/env python
import os
import sys
from lxml import etree
from lxml import objectify
keys = []
if __name__ == "__main__":
View gist:497172
// pull layers from query string
boost::optional<std::string> layer_string = get_layer_string():
if (layer_string)
std::clog << "filtering layers...\n";
// convert comma separated layers to vector
std::vector<std::string> layer_names = parse_layer_string(*layer_string);
// for each map layer object
BOOST_FOREACH ( layer const& lyr, map_.layers() )
View osm tags stats for Port-au-prince against kiosk preset xml
$ ./ --osm pap.osm --preset kiosk_presets.xml --meta > pap_kiosk_stats.txt
AttributeSource date --> 'osm(9)'
AttributeSourceType --> 'osm(8)'
Attribute_Source_Type --> 'osm(159)'
Attribute_source_date --> 'osm(2602)'
Attribute_source_type --> 'osm(2447)'
Beds --> 'osm(1)'
Damage --> 'osm(1)'
Date --> 'osm(301)'
View gist:579264
Index: plugins/input/shape/dbffile.hpp
--- plugins/input/shape/dbffile.hpp (revision 2199)
+++ plugins/input/shape/dbffile.hpp (working copy)
@@ -36,6 +36,7 @@
using mapnik::transcoder;
using mapnik::Feature;
+using namespace boost::iostreams;
View gist:588304
<?xml version="1.0" ?>
<Map bgcolor="rgb(255,255,255)" srs="+init=epsg:4326">
<Style name="NYC_Structures4326_style">
<CssParameter name="fill">rgb(78,110,187)</CssParameter>
<CssParameter name="gamma">0.7</CssParameter>
<CssParameter name="stroke-width">0.96</CssParameter>
springmeyer / osm.pbf to postgis
Created Nov 1, 2010
import a pbf file into postgis from geofabrik using osmosis and osm2pgsql
View osm.pbf to postgis
# note: there is work afoot to load pbf directly with osm2pgsql
# but for now osmosis >= 0.37 works best
# install java/osmosis if you don't already have it
sudo apt-get install sun-java6-jre
cd osmosis-0.37
chmod +x bin/osmosis