Support for TileStache's 'safe' layout

This adds support for [TileStache's 'safe' directory layout](http://tilestache.org/doc/#caches) by using a URL similar to `file:///tmp/foo?safe=true`.

This also corrects grid filenames (to `*.json`) when writing.