Skip to content

Instantly share code, notes, and snippets.

@andrewxhill
Created November 15, 2013 17:57
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 andrewxhill/7488739 to your computer and use it in GitHub Desktop.
Save andrewxhill/7488739 to your computer and use it in GitHub Desktop.
Important bits for rainy cities visualization
With p AS (
SELECT the_geom, the_geom_webmercator, cartodb_id, name,
(SELECT globvalue FROM last_1_hours ORDER BY the_geom <-> n.the_geom LIMIT 1) g,
(SELECT st_distance(the_Geom, n.the_geom) d FROM last_1_hours ORDER BY the_geom <-> n.the_geom LIMIT 1) d
FROM ne_10m_populated_places_simple_1 n
)
SELECT * FROM p WHERE d < 0.1 ORDER BY g ASC
Map{
buffer-size: 256;
}
#ne_10m_populated_places_simple_1::labels [d<0.02]{
text-name: [name] + ' (' + [g] + ')';
text-face-name: 'DejaVu Sans Book';
text-fill: #FFFFFF;
text-allow-overlap: true;
text-halo-fill: #2c388d ;
text-halo-radius: 5;
text-size: 8;
text-opacity: 0.6;
[g>0.0001]{ text-size:10; [zoom<5]{text-size:6;}}
[g>0.001]{ text-size: 12;text-opacity: 0.7; [zoom<5]{text-size:8;}}
[g>0.01]{ text-size: 15;[zoom<5]{text-size:10;} }
[g>0.1]{ text-size: 18;text-opacity: 0.85;[zoom<5]{text-size:13;}}
[g>1]{ text-size: 22;text-opacity: 1; [zoom<5]{text-size:16;} }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment