Skip to content

Instantly share code, notes, and snippets.

@rochoa
rochoa / README.md
Last active August 4, 2017 04:59
[CARTO] turbo-cartocss examples

Color ramps: *-fill

Basic usage

marker-fill: ramp([column_name], colorbrewer(Greens));
                  |                    |
                  v                    |
      column to calculate ramp         |
                                       v
@rochoa
rochoa / cdb_delayed_invalidate.sql
Created January 22, 2016 14:21 — forked from pramsey/cdb_delayed_invalidate.sql
Delayed Invalidation Trigger
CREATE OR REPLACE FUNCTION public.CDB_Delayed_TableMetadata_Trigger()
RETURNS trigger AS $$
DECLARE upd timestamp;
BEGIN
IF TG_RELID = 'cartodb.CDB_TableMetadata'::regclass::oid THEN
RETURN NULL;
END IF;
SELECT updated_at INTO upd
FROM cartodb.CDB_TableMetadata WHERE tabname = TG_RELID::regclass;
IF upd IS NOT NULL AND (now() - upd) > '20m'::interval THEN
@rochoa
rochoa / almost-equal.js
Last active January 13, 2016 15:11
almost-equal.js
// Following code was extracted from almost-equal
// (c) 2013 Mikola Lysenko. MIT License
// MIT License (MIT)
// See https://github.com/scijs/almost-equal/blob/93af191fe4075ee2dea94d29a26c796c26bb9cb6/almost_equal.js
var PRECISION_FLOAT_EPSILON = 1.19209290e-7;
var PRECISION_DOUBLE_EPSILON = 2.2204460492503131e-16;
function almostEqual(a, b, absoluteError, relativeError) {
absoluteError = absoluteError || PRECISION_DOUBLE_EPSILON;
@rochoa
rochoa / index.html
Last active March 16, 2017 13:02
[CARTO] CartoCSS example – line-simplify
<!DOCTYPE html>
<html>
<head>
<title>CartoDB: CartoCSS example – line-simplify</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<link rel="shortcut icon" href="http://cartodb.com/assets/favicon.ico" />
<style>
html, body, #map {
height: 100%;
@rochoa
rochoa / index.html
Last active January 5, 2018 22:11
[CARTO] CartoCSS example – polygon-simplify
<!DOCTYPE html>
<html>
<head>
<title>CartoDB: CartoCSS example – polygon-simplify</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<link rel="shortcut icon" href="http://cartodb.com/assets/favicon.ico" />
<style>
html, body, #map {
height: 100%;
@rochoa
rochoa / index.html
Last active March 16, 2017 13:02
[CARTO] CartoCSS example – polygon-pattern-comp-op
<!DOCTYPE html>
<html>
<head>
<title>CartoDB: CartoCSS example – polygon-pattern-comp-op</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<link rel="shortcut icon" href="http://cartodb.com/assets/favicon.ico" />
<style>
html, body, #map {
height: 100%;
@rochoa
rochoa / index.html
Last active March 16, 2017 13:01
[CARTO] CartoCSS example – background-color
<!DOCTYPE html>
<html>
<head>
<title>CartoDB: CartoCSS example – background-color</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<link rel="shortcut icon" href="http://cartodb.com/assets/favicon.ico" />
<style>
html, body, #map {
height: 100%;
@rochoa
rochoa / index.html
Last active March 16, 2017 13:01
[CARTO] CartoCSS example – background-image
<!DOCTYPE html>
<html>
<head>
<title>CartoDB: CartoCSS example – background-image</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<link rel="shortcut icon" href="http://cartodb.com/assets/favicon.ico" />
<style>
html, body, #map {
height: 100%;
@rochoa
rochoa / README.md
Last active January 9, 2018 06:31
[CARTO] MVT service + Mapbox GL

CartoDB's MVT service + Mapbox GL

Check index.html for some examples. These use a beta feature of CartoDB's Maps API: fixed URLs. So there is no need to use cartodb.js and tiles can be consumed using a named map name.

cartodb.js example

Check cartodb.js.html to see the integration with cartodb.js and in particular with cartodb.core.js.

Mapbox GL resources

@rochoa
rochoa / README.md
Last active September 10, 2015 13:35 — forked from tyrasd/README.md
Map & Globe

modified version of http://bl.ocks.org/curran/01aa2685f083b6c1b9fb with the map's bounding box on the globe

original readme follows:

--

Pan and zoom in the map on the left to rotate the globe.

Click and drag the globe to pan on the map.