Skip to content

Instantly share code, notes, and snippets.

View ramiroaznar's full-sized avatar

Ramiro Aznar ramiroaznar

View GitHub Profile
@ramiroaznar
ramiroaznar / index.html
Last active May 12, 2017 14:06
How to highlight a polygon when hovering on a CARTO layer
<!DOCTYPE html>
<html>
<head>
<title>How to highlight a polygon when hovering on with CARTO.js</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%;
@ramiroaznar
ramiroaznar / query.sql
Created April 6, 2017 16:25
How to select points which do not intersect with buffers
with
buffers as (
select st_transform(
st_union(
st_buffer(
the_geom::geography, 1000)::geometry
),
3857
) as the_geom_webmercator
@ramiroaznar
ramiroaznar / README.md
Created March 2, 2017 16:04 — forked from rochoa/README.md
turbo-cartocss examples

Color ramps: *-fill

Basic usage

marker-fill: ramp([column_name], colorbrewer(Greens));
                  |                    |
                  v                    |
      column to calculate ramp         |
                                       v
@ramiroaznar
ramiroaznar / style.css
Created March 1, 2017 14:07
CartoCSS conditionals + TurboCARTO
#layer{
polygon-gamma: 0.5;
polygon-opacity: 0.8;
[participac <= 70]{
polygon-fill: ramp([participac], (#813753, #a65461, #541f3f, #c1766f, #d39c83, #e0c2a2, #ede5cf), jenks)
/* the color palette is switched, in fact it is only using two colors/classes */
}
[participac > 70]{
polygon-fill: ramp([participac], (#d1eeea,#a8dbd9,#85c4c9,#68abb8,#4f90a6,#3b738f,#2a5674), jenks)
}
@ramiroaznar
ramiroaznar / query.sql
Created March 1, 2017 14:06
Compare columns and select the one which is bigger with PostgreSQL
with temp as (select 1 as a, 2 as b, 3 as c)
select
case when
a > b and a > c then 'a'
when b > a and b > c then 'b'
else 'c' end as bigger
from temp
@ramiroaznar
ramiroaznar / index.html
Last active May 12, 2017 14:04
Paula Scher basemap with Leaflet.js
<!DOCTYPE html>
<html>
<head>
<title>Paula Scher basemap with Leaflet.js</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="https://pbs.twimg.com/profile_images/780792637481689088/8y-GChEY.jpg" />
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css" />
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script>
@ramiroaznar
ramiroaznar / README.md
Last active November 26, 2021 22:08
ramiroaznar meta gist

Meta Gist

  • PostgreSQL and PostGIS queries
  • CartoCSS styles
  • CARTO.js blocks
  • DI.js blocks
  • Leaflet.js blocks
  • Other blocks
  • Others
@ramiroaznar
ramiroaznar / index.html
Last active January 14, 2024 15:53
CARTO.js + Highchart.js
<!DOCTYPE html>
<html>
<head>
<title>CARTO.js + Highchart.js</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" />
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
@ramiroaznar
ramiroaznar / index.html
Last active November 3, 2017 14:09
Searchbox + Dropdown menu + CARTO.js
<!DOCTYPE html>
<html>
<head>
<title>Searchbox + Dropdown menu + CARTO.js</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="https://cartodb.com/assets/favicon.ico" />
<link rel="stylesheet" href="https://cartodb-libs.global.ssl.fastly.net/cartodb.js/v3/3.15/themes/css/cartodb.css" />
<script src="https://cartodb-libs.global.ssl.fastly.net/cartodb.js/v3/3.15/cartodb.js"></script>
@ramiroaznar
ramiroaznar / index.html
Last active June 7, 2017 15:40
How to display a Raster layer in CARTO
<!DOCTYPE html>
<html>
<head>
<title>How to load a Raster layer in CARTO</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" />
<script src="https://cartodb-libs.global.ssl.fastly.net/cartodb.js/v3/3.15/cartodb.js"></script>
<link rel="stylesheet" href="https://cartodb-libs.global.ssl.fastly.net/cartodb.js/v3/3.15/themes/css/cartodb.css" />