Smathermather's Weblog

Remote Sensing, GIS, Ecology, and Oddball Techniques

Posts Tagged ‘cartography’

Parks Data Cake, part deux

Posted by smathermather on April 2, 2014

Following up on my previous post, I have started to detail the how of our parks map rendering works, including a GitHub repository with all the code and data to build your own in TileStache. One of these days, we’ll port this to TileMill, but in the mean time, it works and works wonderfully.

Screenshot of trailsforthepeople-styles github


— Addendum —

Truth in advertising– the contours data were not included in the repository as they are 1.3 GB all by themselves

— End Addendum —


Posted in Cartography, Recreation, TileStache, Trail Curation, Trails | Tagged: , | Leave a Comment »

Parks Data Cake

Posted by smathermather on March 24, 2014

Stamen has a great blog entry on mapping for parks on their blog. It’s a teaser for a deeper dive in mapping parks, and I’m staying tuned, as their write-ups tend to be detailed, thoughtful, and complete.

I thought I’d offer my own teaser– a bit of work done collaboratively with GreenInfo Network.  It started with their basemap– something they spent a few person-years refining from OSM data.

Example of GIN basemap

Example of GIN custom basemap

Custom basemap

We took it a little further by creating custom placed labels where the labels gave us some extra bang for the buck.

Custom text placement example

Custom text placement

And then we started to really play with the zoomed in versions, using nicely detailed streams, contours, and canopy boundaries (derived from LiDAR) to enrich the map, labeling natural features and major facilities with custom labels as well:

Image showing labeling, contours, vegetation, etc.

Detailed view of map

A couple of tricks we used here– first, the custom labels have shadows (convex hull) masks which match the background, ala this write up:

Example of masked text

Also, compositing is used heavily– the hillshade background is flattened significantly, and then overlayed with multiplied composites of park green, canopy green on top, contours, with all other layers being simple overlays. This results in a brightness and clarity to the information that allows for complexity without either muddling the map, or overwhelming the map reader.

Finally, since many of the parks are urban, major buildings are highlighted for context. In future revisions, we’ll add more (but still subdued) detail to the areas outside the parks, but this was a good start:

Example of major buildings showing on map near a park

In case you are wondering about technology, this is all done in TileStache (edit: and GeoServer).  In the future, this may well be replicated in Tilemill. More to come… .

Posted in Cartography, Recreation, TileStache, Trail Curation, Trails | Tagged: , | 4 Comments »

North American Cartographic Information Society (NACIS) Conference (yay #NACIS!)

Posted by smathermather on October 14, 2013

In a short blog post, I won’t be able to do the NACIS conference justice, but if you haven’t gone and you are a map geek, then I recommend you attend next year’s conference in Pittsburg.  First:

The People:

What a collegial and warm group of people.  NACIS was a very welcoming community, an interesting mix of private industry geniuses (ahem, Mapbox, Stamen, Vizzuality etc.), academics, students, National Geographic cartographers, and typically some serious Federal representation (although largely absent this year, a notable exception being Mamata Akella from NPSMaps who is technically not directly employed by the Feds and so was allowed to attend anyway).  As someone who spent the better part of a decade in the academic sector, it was fascinating (and comforting) to be back among (largely) introverts.  I would, however, argue the Nat Geo Cartographers were generally an exception to the introversion, but really pleasant and interesting folks as well.

Also, Andrew Hill from Vizzuality was there, so I picked his brain on features coming down the pike (including better Torque support, including a GUI soon), and bugged him to add pgRouting to the back end of CartoDB… .  He seemed receptive to this, and suggested following up under CartoDB support.


All the presentations were great.  From a very tech-practical standpoint, I enjoyed Carl Sack’s presentation on D3.  It was a great intro to D3js, and really got me over the basic barrier to using D3– getting the data in.  The TL;DR– order matters in the use of the API, queue.js is mighty useful, and all the data manipulation needs to go in the callback function to ensure your D3 goodness isn’t sunk by asynchronous execution.

The Maps:

Oh, boy there were some nice maps in the map gallery.  One trail map was an excellent theft of Swiss cartographic techniques, all the maps were interesting and well polished, and it was fun to look around at the diversity of approaches and topics.  Two maps of note that I really enjoyed– one is a map/infographic of wool exports from New Zeland, knitted in wool on a maker space constructed knitting machine:

Wool map

Also a really nice alternative piece was a bathymetry map by Carolyn Rose, which can be viewed at her blog:


My presentation went well.  There were lots of questions about a project we’ve been working on for our public web interface to help people find trails, parks, picnic areas and other parky amenities.  We just posted the code for the project to GitHub ( and I’ll have my slides posted from the presentation shortly.  It was really great to connect with others working and starting to work in similar spaces of parks and recreation mapping.  I am already enjoying the follow-up and hope this builds in to a large spatial/web community servicing this sector.


Posted in Cartography, Conference, NACIS | Tagged: , | Leave a Comment »

Cartographic tricks and tips– making text readable, PostGIS edition, take 3

Posted by smathermather on July 6, 2013

A little more refinement to the SQL for building masking fill for hand-placed text on maps.

CREATE TABLE use_area_mask AS

-- We'll use the "WITH" Common Table Expression (CTE) here
WITH exploded AS (

-- we want each individual letter to get it's own mask, so we Union and Dump them to break them out
SELECT (ST_Dump(ST_Union(geom))).geom FROM use_area_labels

-- now we can create a temporary table that is a 5-unit buffer of the convex hull
,buffer_cvx AS (
    SELECT ST_Buffer(ST_ConvexHull(geom), 5) AS geom FROM exploded

-- finally, we Dump these out to their own records
SELECT (ST_Dump(ST_Union(geom))).geom FROM buffer_cvx

Posted in PostGIS | Tagged: , , | Leave a Comment »

Cartographic tricks and tips– making text readable, PostGIS edition part 2

Posted by smathermather on July 2, 2013

I have a couple of posts number 1 and number 2 about masking for text.  One more from the actual implementation:



Posted in PostGIS | Tagged: , , | Leave a Comment »

Cartographic tricks and tips– making text readable, PostGIS edition

Posted by smathermather on June 29, 2013

Recall from previous post, I played a bit with using convex polygons and buffers to control noisy backgrounds behind text, ala:


golf_orig ——–>golf_final

I was tired of doing this in the GUI in QGIS, so I wrote some simple code to do it in PostGIS.

CREATE TABLE cm_label_cvx AS
WITH buffer_cvx AS (
    SELECT ST_Buffer(ST_ConvexHull(geom), 250) AS geom FROM cm_label_med)
    SELECT ST_Union(geom) FROM buffer_cvx;

Posted in PostGIS | Tagged: , , | 1 Comment »

QGIS Compositing, credits where due

Posted by smathermather on April 15, 2013

Credit where credit’s due on the great QGIS Compositing (as well as some stellar forthcoming raster tools):

I thought I had seen an unusually large spike in my Aussie traffic… .

Posted in Cartography, QGIS | Tagged: , , | Leave a Comment »

QGIS Compositing, more comparisons

Posted by smathermather on April 10, 2013

QGIS Compositing, more comparisons… .  You guess which is QGIS and which is TileStache… .


Posted in Cartography, QGIS, TileStache | Tagged: , , | Leave a Comment »

QGIS Compositing, more gushing yet…

Posted by smathermather on April 9, 2013

Ever had a workflow on the web that resulted in stuff so nice, you wanted to replicate on the desktop?  Ya, me neither until recently.  I love the cartography a particular website, know all the bits and pieces of color and effects that go into, but had no desktop application that could do the same.   Until now.  On the left, QGIS, on the right, TileStache (i.e. mapnik).  There were a few practical differences in application which result in most of the differences you do see, but now we can wrap great cartography into all our products, printed or web.  And no, print is not dead yet, whatever the declaration.


Posted in Cartography, QGIS, TileStache | Tagged: , , | Leave a Comment »

Compositing lands on the desktop– QGIS

Posted by smathermather on April 5, 2013

Ok, how come no one told me this?  Blending modes in QGIS?  I’m running the nightly build for 1.9, so I have no idea if this is new or old, but a little compositing in QGIS is very welcome… :


Now, how the heck do I set transparency?

Posted in Cartography, QGIS | Tagged: , , | 2 Comments »