Command-Line Geography

Hi, I'm Erik :) 👋

github, twitter: @nerik

I live in Madrid and I'm an engineer at Vizzuality.

Vizzuality builds amazing mapping and dataviz projects., most of them for NGOs.

We are about great user experiences and telling stories with complex datasets.

We mostly have a web-based approach to GIS.

Leaflet, Google Maps, D3, Carto(DB).js, PostGIS...

React, Redux, Backbone, Webpack...

Ruby on Rails, Python, Postgre...

Aaaaaand we are recruiting !

So, I'm a front-end engineer

This talk is about developer-friendly tools to do GIS web mapping
xkcd

Summary:

  • tools of the trade
  • a starter kit
  • CARTO on the command line
  • Atom for webmapping
  • geocoding
  • bonus track: emoji maps

Tools of the trade

Carto(DB)

Define Carto:

Empower organizations to optimize operational performance, strategic investments, and everyday decisions with CARTO Engine
Improve customer satisfaction by 15%

CARTO is brilliant

Carto is basically:

  • a PaaS Postgres/PostGIS instance
  • a supercharged Postgres/PostGIS instance: geocoding, routing, basemaps, curated open datasets...
  • a set of REST APIs
  • a semi-WYSIWYG GIS piece of software (the Builder)

Why Carto?

  • kind learning curve
  • serves as a cheap and convenient back-office (downside: you need connectivity)
  • the Builder is amazing for prototyping

Disclaimer: I previously worked at Carto

Disclaimer 2 / fun fact: Carto(DB) is originally a Vizzuality spin-off

Tools of the trade: Atom

Chrome + Electron

Chrome + Electron

Tools of the trade: a shell and a terminal

Namely:

  • zsh
  • oh-my-zsh
  • iTerm 2
  • node.js, npm, python, etc...
  • bonus: the Input Mono font

a starter kit

«A beginning is a very delicate time»
Vizzuality strong suit:
  • dedicated exploration phase for each project:
    data + interactivity
  • client is heavily involved in it (co-creation)

We need an efficient tool for bootstrapping prototypes/projects.

Enter

Yeoman + Carto


$ npm i -g yo generator-cartodb
$ yo cartodb
          

$ sudo npm i -g yo generator-cartodb
$ sudo yo cartodb
          

local server

liveReload

eslint

yo cartodb

Uses NPM as a task runner
(add gulp, grunt when needed)

Uses cat to bundle JS
(use webpack, browserify when needed)

Tries to be a compromise between too simple and overly complicated toolchains (1000 lines gulpfiles, obscure webpack config, etc)

CARTO on the command line

CARTO API clients

  • Python
  • Ruby
  • Node.js

Python

  • SQL and Import APIs
  • The "official" client
  • Has one contributor inside CARTO (Dani Carrion)

Ruby

  • Deprecated ¯\_(ツ)_/¯

Node.js

  • SQL and Import APIs
  • Named maps API
  • CLI access

SQL API

a simple select (JSON)

CSV + CSVKit

the -f (--format) option

CSVKIT: csvlook

CSVKIT: csvcut, csvstat

GeoJSON + geojson.io

GeoJSON output

piping to geojsonio

Authenticated queries

username (-u) not enough for write ops

specify api key (-a / --api_key)

Import API

shapefile -> carto

--url

Improve customer satisfaction by 15% !

Atom for GIS

Atom for GIS
Atom for webmapping

APM

Yay! An integrated package manager! (merely an NPM wrapper, actually)


$ apm install linter
$ apm install highlight-selected
$ apm install emmet
$ apm install pretty-json
$ apm install pigments
$ apm install color-picker
$ apm install language-carto
$ apm install carto-api
          

linter

highlight-selected

emmet

color-picker

pigments

language-carto

Remember CARTO APIS? Now in Atom!

run a SQL query, get some CSV

let's feed some GeoJSON to L

and some SVG, because why not

file import from the tree view

Some heavy customer satisfaction going on here !

apm install carto-api

PRs and insults -> @nerik

geocoding

CARTO provides geocoding
for various entities, points and polys

:heart: Mapzen

CARTO provides geocoding and routing
at SQL level

which means, also in your beloved terminal - here, a named place

street-level

carto-geocode-sql
turns location strings to SQL queries

using it in a subshell, for the carto cli

mötley crüe geocoding

geocoding in Atom

bonus track: emoji maps

gj2ascii

"Render spatial vector data as ASCII or emoji with Python on the commandline."

cartodb | gj2ascii (heed the "-" !)

Remember

Thanks!

@nerik

soundtrack: Ibrahim Ferrer, Ólafur Arnalds, Jordi Savall, The Cure, Bill Withers