Newsrooms have been publishing maps for a long time. However, mapping on the web is very difficult due to the sheer amount of data involved. Some of the largest datasets available to journalists are geospatial. The U.S. TIGER/Line roads database, for example, tips the scale at 9.2 gigabytes, and the USGS’s national hydrography data set is 17 gigabytes compressed.
The data needed to analyze legislative redistricting is similarly huge. In California alone there are 700,000 Census blocks. When we started covering redistricting last year, we knew we would need an easy way to present vast amounts data quickly. We took a serious look at both Mapnik and Mapserver — who are still leaders in the field — but the Ruby bindings support in both, at the time, weren’t as robust and stable as we needed them to be.
So we wrote a mapping framework of our own called Simple Tiles, which we are open sourcing today.
How it Works
Maps on the web are made up of thousands of square images, which are dynamically loaded into your browser as you drag around a map or zoom to different zoom levels. By chopping up a big map into a grid, servers can parallelize rendering, which would be impossible with a single large image.
At its base, Simple Tiles, which is written in C, is a wrapper around the OGR Simple Feature Library, which handles geospatial sources, and Cairo, which produces the final images for the web. Both libraries are fantastic to work with and have deep APIs, which keeps Simple Tiles very small.
Simple Tiles is designed to be very lightweight, and will continue to be so. It won’t do any fancy translation (outside of projection) or analysis of spatial data, and it also does not include a separate stylesheet language or a server for serving images. It is meant to be embedded in dynamic languages like Ruby through language bindings.
The Simple Tiles API is small and easy to use. Here’s an example, from the repository’s
which produces this map:
How to Get Simple Tiles
Go ahead and kick the tires over on GitHub. We’ll be releasing the Ruby bindings in the coming weeks. If you want to help us cross the finish line on the Ruby bindings, or if you might be interested in writing Python bindings, send us an e-mail.
As with all new projects there are bound to be bugs and things that will make Simple Tiles work better, so please post any you notice in our issue tracker — and if you use it in a project, please let us know!