Skip to content

Instantly share code, notes, and snippets.

View ernesmb's full-sized avatar

Ernesto Martínez Becerra ernesmb

View GitHub Profile
@ernesmb
ernesmb / index.html
Last active January 17, 2018 17:01
Lasso tool with CARTO.js
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Carto.js Guide</title>
<!-- Include Leaflet 1.2.0 Library -->
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.2.0/dist/leaflet.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet.draw/0.4.13/leaflet.draw.css" />
-- CREATE A STORED PROCEDURE AND TRIGGER TO KEEP A LOG OF CHANGES ON ANY CARTO TABLE
---- based on @andrewxhill's: https://gist.github.com/andrewxhill/0645add72c093f2f4908
--
--- Create the log table and cartodbfy it
CREATE TABLE version_control();
SELECT CDB_CartodbfyTable('username','version_control'); -- username parameter is only needed in organizational accounts
--
--- Add extra columns
@ernesmb
ernesmb / index.html
Last active July 19, 2017 09:00
pixel hexbin aggregation
<!DOCTYPE html>
<html>
<head>
<title>Aggregated content from clustered features II - Average Population| CartoDB</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 {
@ernesmb
ernesmb / index.html
Last active February 3, 2017 18:12
Setup a point collector app
<!--
based on @iriberri's http://bl.ocks.org/iriberri/7d84ed35ef0b5e80555d
-->
<!DOCTYPE html>
<html>
<head>
<title>Point Collector | 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" />
@ernesmb
ernesmb / readme.md
Created July 5, 2016 12:17
admin0_polygons

This is a complete list of names for admin0 polygons (AKA countries) accepted by the geocoder

admin,adm0_a3,name,name_long,formal_en,iso_a2

Aruba,ABW,Aruba,Aruba,Aruba,AW
Afghanistan,AFG,Afghanistan,Afghanistan,Islamic State of Afghanistan,AF
Angola,AGO,Angola,Angola,People's Republic of Angola,AO
Anguilla,AIA,Anguilla,Anguilla,,AI
Albania,ALB,Albania,Albania,Republic of Albania,AL
@ernesmb
ernesmb / index.html
Created June 26, 2016 16:13
SearchBox with autocomplete
<!DOCTYPE html>
<html>
<head>
<title>SearchBox with autocomplete | CartoDB</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 {
@ernesmb
ernesmb / index.html
Last active January 17, 2018 17:03
A Giant's Causeway of Data
<!DOCTYPE html>
<html>
<head>
<title>Made with CartoDB</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 {
@ernesmb
ernesmb / index.html
Last active September 18, 2017 15:59
maps_instantiation
<!DOCTYPE html>
<html>
<head>
<style>
html, body{
height: 100%;
width:100%;
margin:0;
padding:0;
}
@ernesmb
ernesmb / config.json
Last active April 19, 2016 10:25
named map with filter
{
"version": "0.0.1",
"name": "world_borders",
"auth": {
"method": "token",
"valid_tokens": [
"ernesto"
]
},
"placeholders": {
@ernesmb
ernesmb / index.html
Last active May 17, 2016 16:45
CreateLayer with Infobox
<!DOCTYPE html>
<html>
<head>
<title>CartoTemplate | CartoDB</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 {