This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This code snippet, modifed from Mpanik's rundemo.cpp (r727, license LGPL), | |
renders the State of California using USGS state boundaries data. | |
Here's a play-by-play (via https://lists.berlios.de/pipermail/mapnik-devel/2008-August/000679.html) | |
rundemo.cpp renders a map of Ontario/Quebec, and instead I wanted to draw a | |
map of California and its surrounding states. | |
I grabbed the data from the USGS in the form of "statesp020" (google it, or | |
browse through nationalatlas.gov) and first wanted to modify rundemo.py |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
128.12.16.0/255 Stanford.Res.Mirrielees | |
128.12.21.0/255 Stanford.Res.Manzanita.Lantana | |
128.12.22.0/255 Stanford.Res.Manzanita.KimballRF | |
128.12.23.0/255 Stanford.Res.Manzanita.Kimball | |
128.12.42.0/255 Stanford.Res.Fraternity.KappaAlphaTheta | |
128.12.43.0/255 Stanford.Res.Sorority.DeltaDeltaDelta | |
128.12.45.0/255 Stanford.Res.Wilbur.Soto | |
128.12.47.0/255 Stanford.Res.Wilbur.Otero | |
128.12.48.0/255 Stanford.Res.Wilbur.Okada | |
128.12.49.0/255 Stanford.Res.Wilbur.Junipero |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; lwu .emacs 2008 (CarbonEmacs) | |
;; paths and directories | |
(add-to-list 'load-path "~/src/elisp") | |
(custom-set-variables) | |
(custom-set-faces) | |
; (require 'tramp) | |
(setq tramp-default-method "ssh") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This class implements a simple way of displaying point-based data in Mapnik | |
// (It has yet to be tested as Mapnik r729's memory_featureset is commented out now.) | |
// | |
class point_datasource : public mapnik::memory_datasource { | |
public: | |
point_datasource() : feat_id(0) {} | |
void add_point(double x, double y, const char* key, const char* value); | |
int type() const { return mapnik::datasource::Raster; } | |
private: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Shoes got you down? DebugShoes won't fail silently on ya... | |
# | |
class DebugShoes < Shoes | |
def self.app(*args, &blk) | |
super(*args) do | |
begin | |
self.instance_eval(&blk) | |
rescue => e | |
error(e) # log the error and inform the user! | |
@err_bar = flow :width => 1.0, :height => 32, :top => self.height-32, :left => 0 do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
My first Shoes app! Shoes is a "Tiny Toolkit" for informal graphics and windowing: | |
http://code.whytheluckystiff.net/shoes/ | |
I wanted to be able to easily edit Mapnik stylesheets, hit render, and see the result | |
right away. While this isn't a great solution -- the prototype shells out to a C++ binary to | |
re-render the map -- it works for the time being. | |
A screenshot of the resulting application can be seen here: | |
http://farm4.static.flickr.com/3095/2801694916_1a051349b4_b.jpg | |
(http://flickr.com/photos/wu_135/2801694916/sizes/l/) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This Python code snippet demonstrates basic use of the proposed "PointDatasource" | |
object exposed by the Mapnik patch attached here: http://trac.mapnik.org/ticket/113 | |
To run this code, you will need to grab a copy of Mapnik from trunk, apply this patch, | |
and also download the style.xml file below. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
%w[open-uri hpricot].each {|lib| require lib } | |
YAHOO_APP_ID = "[yourappidhere]" | |
FLICKR_KEY = "[yourapikeyhere]" | |
raise "alarms" if YAHOO_APP_ID =~ /here/ | |
raise "no query arg specified" if ARGV.empty? | |
# command line query => Y! where query => Flickr getInfo query => wget shapefile => ogr2ogr to KML |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
%w[open-uri hpricot].each {|lib| require lib } | |
# get KML bbox and grab OSM XML | |
raise "no query arg specified" if ARGV.empty? | |
kml_filename = ARGV[0] | |
doc = Hpricot(open(kml_filename)) | |
coords = (doc/"coordinates")[0].inner_html.split.map { |x| x.split(',').map {|s| s.to_f } } | |
longs = coords.transpose[0] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" | |
layout="vertical" | |
title="ZlibCompressor" | |
nativeDragDrop="onDrop(event)" | |
nativeDragEnter="onDragIn(event)" | |
> | |
<mx:Script> | |
<![CDATA[ | |
OlderNewer