Skip to content

Instantly share code, notes, and snippets.

@ramiroaznar
Created October 20, 2016 10:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ramiroaznar/e150bf13af9ca085c8089962a27a2b16 to your computer and use it in GitHub Desktop.
Save ramiroaznar/e150bf13af9ca085c8089962a27a2b16 to your computer and use it in GitHub Desktop.
Stacking Chips v2 SQL query & CartoCSS Style
WITH
m AS (SELECT count(*) n, array_agg(cartodb_id) id_list, the_geom_webmercator, ST_Y(the_geom_webmercator) y FROM copia_de_victimas GROUP BY the_geom_webmercator ORDER BY y DESC) ,
f AS (SELECT n, generate_series(1, array_length(id_list,1)) p, unnest(id_list) cartodb_id, the_geom_webmercator FROM m)
SELECT
t.the_geom_webmercator,
t.the_geom,
f.cartodb_id,
f.p,
t.profesion
FROM f, copia_de_victimas t
WHERE f.cartodb_id = t.cartodb_id
Map{
buffer-size:2048px;
}
#layer {
/* the first line only would work with BUILDER */
marker-fill: ramp([profesion], (#5B3F95, #1D6996, #129C63, #73AF48, #EDAD08, #E17C05, #C94034, #BA0040, #8E1966, #6F3072, #DC1721), category(10));
marker-fill-opacity: 1;
marker-line-color: #424141;
marker-line-width: 0.6;
marker-line-opacity: 1;
marker-placement: point;
marker-type: ellipse;
marker-width: 10;
marker-height: 8;
marker-allow-overlap: true;
[p>1] {
marker-transform: translate(0, -2*([p]-1));
}
}
@AbelVM
Copy link

AbelVM commented Oct 28, 2016

Te falta la licencia del código (https://gist.github.com/AbelVM/c4cf55f6816467cb45fa) y la referencia a quien tuvo la idea (https://github.com/chriswhong), no? :trollinginthedeep:

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