Skip to content

Instantly share code, notes, and snippets.

@ramiroaznar
Created October 26, 2016 09:31
Show Gist options
  • Save ramiroaznar/8f46ac73ee372bd06d583a6d43d7be2f to your computer and use it in GitHub Desktop.
Save ramiroaznar/8f46ac73ee372bd06d583a6d43d7be2f to your computer and use it in GitHub Desktop.
How to create category + bubble maps with Turbo Carto
SELECT
*,
7 as italians,
3 as french,
19 as spanish
FROM
populated_places
WHERE
name ILIKE 'Barcelona'
UNION ALL
SELECT
*,
10 as italians,
12 as french,
4 as spanish
FROM
populated_places
WHERE
name ILIKE 'Tarragona'
UNION ALL
SELECT
*,
5 as italians,
7 as french,
14 as spanish
FROM
populated_places
WHERE
name ILIKE 'Madrid'
UNION ALL
SELECT
*,
15 as italians,
2 as french,
1 as spanish
FROM
populated_places
WHERE
name ILIKE 'Zaragoza'
#layer {
line-width: 0.1;
marker-allow-overlap: true;
}
#layer::italians {
marker-width: ramp([italians], range(20, 50), jenks(4));
marker-fill: green;
marker-allow-overlap: true;
marker-opacity: 0.5;
}
#layer::french {
marker-width: ramp([french], range(20, 50), jenks(4));
marker-fill: blue;
marker-allow-overlap: true;
marker-opacity: 0.5;
}
#layer::spanish {
marker-width: ramp([spanish], range(20, 50), jenks(4));
marker-fill: red;
marker-allow-overlap: true;
marker-opacity: 0.5;
}
@ramiroaznar
Copy link
Author

screenshot

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