Skip to content

Instantly share code, notes, and snippets.

@andrewxhill
Created June 17, 2015 17:00
Show Gist options
  • Save andrewxhill/d7a736227751a4a49072 to your computer and use it in GitHub Desktop.
Save andrewxhill/d7a736227751a4a49072 to your computer and use it in GitHub Desktop.

The Torque CartoCSS compiler (not sure that is the right terminology, maybe interpreter) can do anything for points that Mapnik could do on the server. But really really responsive since the data is already on the client. It does it by turning CartoCSS into html canvas rendering instructions.

Static torque

http://bl.ocks.org/andrewxhill/94688372b76060f7a6e8

http://bl.ocks.org/andrewxhill/c86225894313e4184829

http://bl.ocks.org/andrewxhill/020636499dde84b90f0a

Torque differently

Animated bubble maps http://gis.stackexchange.com/questions/129838/show-change-in-size-over-time/130114#130114

Not a map http://bl.ocks.org/andrewxhill/8544392

CartoCSS that responds to input http://bl.ocks.org/andrewxhill/adb44dcdcf30ee449e87

Torque internals

The CartoCSS reference, https://github.com/CartoDB/torque/blob/master/lib/torque/cartocss_reference.js

The Shader, https://github.com/CartoDB/torque/blob/master/lib/torque/renderer/point.js#L95

CartoCSS uses Sprites to render the same marker many times on canvas really efficiently. A really neat trick it does is that it generates a Sprite at runtime!!! Then uses that sprite to keep re-rendering the same things. It is pretty damn clever.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment