Geotype is a cli tool for rendering GeoJSON from the command line. While this might seem fairly ridiculous/pointless, it can actually be quite useful for quickly seeing what sort of geography is lurking inside a GeoJSON file. While tools like geojson.io and geojson-cli provide a quick way to do this in the browser, a faster feedback loop is often helpful.
Here's what it looks like in action. Given a GeoJSON file that contains something like this:
...we can use geotype to render it like this:
Let's say we want something higher resolution, we can overzoom using the
geotype world.geojson -m 4
Don't want color? Use the
--no-color flag to render to plain old acii.
geotype world.geojson -m 4 --no-color
geotype can also distinguish between points, lines, and polygons. Here's how it renders a GeoJSON FeatureCollection containing all Vermont libraries (points), highways (lines), and zipcodes (polygons) with and without color.
--zoom -z flag allows a pixel zoom to be specified. Each pixel is equivalent to one tile at the given zoom. Let's zoom in on our Vermont file with a simple bash for loop.
for i in `seq 6 12`; do geotype vermont.geojson -z $i; done
--bbox flag to fit the ascii "image" to a specific bounding box, or use the
--tile flag to fit the render to an x/y/z map tile. Let's cycle vertically across a column of tiles against our world.geojson file to try it out.
for i in `seq 0 11`; do geotype world.geojson -t 4/$i/4 -z 9; done
...at a higher zoom
for i in `seq 0 11`; do geotype world.geojson -t 4/$i/4 -z 11; done
##how it works
Keep in mind, this is a mad science hack. Aside from using geotype as a test diff renderer or a repl tool, I would not recommend geotype for "real" map rendering. WebGL has the ability to highly parallelize work across the GPU, so geotype is never going to compete with rendering times close to those of Mapnik or WebGL.
Now that that's out of the way, let's render a bunch of shit in ascii.