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
Created July 18, 2018 11:17
Click on button to open a Leaflet popup | CARTO.s v4.1
<!DOCTYPE html>
<html>
<head>
<title>Click on button to open a Leaflet popup | CARTO.s v4.1</title>
<meta name="viewport" content="initial-scale=1.0">
<meta charset="utf-8">
<!-- Include jQuery -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<!-- Include Leaflet -->
<script src="https://unpkg.com/leaflet@1.3.1/dist/leaflet.js"></script>
@ramiroaznar
ramiroaznar / AnimatedMarker.js
Last active September 26, 2024 02:03
How to make your markers move with Leaflet.js
L.AnimatedMarker = L.Marker.extend({
options: {
// meters
distance: 200,
// ms
interval: 1000,
// animate on add?
autoStart: true,
// callback onend
onEnd: function(){},
@ramiroaznar
ramiroaznar / index.html
Last active September 1, 2024 05:30
How to add a Singapore basemap in Leaflet
<!DOCTYPE html>
<html>
<head>
<title>How to add a Singapore basemap in Leaflet</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" />
<link rel="stylesheet" href="http://libs.cartocdn.com/cartodb.js/v3/3.15/themes/css/cartodb.css" />
<script src="http://libs.cartocdn.com/cartodb.js/v3/3.15/cartodb.js"></script>
@ramiroaznar
ramiroaznar / index.html
Last active May 21, 2024 23:50
Getting coordinates from a Leaflet map
<html>
<head>
<title>Getting coordinates from a Leaflet map</title>
<meta charset="utf-8">
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.css" />
<script src="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.js"></script>
<style type="text/css">
html, body, #map{
height: 100%;
padding: 0;
@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 / readme.md
Last active August 2, 2023 12:19
TURBO CARTO - The good, the handsome and the turbo.
@ramiroaznar
ramiroaznar / README.md
Last active January 24, 2023 15:39
Adding or moving markers on a Leaflet map

The map is set to drag the marker and get its new location with a popup. Uncomment from line 32 to 39, and comment line 41 to 51 in order to see how to add markers on click.

@ramiroaznar
ramiroaznar / index.html
Last active September 30, 2022 02:36
How to create an interactive heatmap with Leaflet.js
<html>
<head>
<title>How to create an interactive heatmap with Leaflet.js</title>
<meta charset="utf-8">
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.css" />
<script src="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.js"></script>
<script src="leaflet-heat.js"></script>
<style type="text/css">
html, body, #map{
height: 100%;
@ramiroaznar
ramiroaznar / test_is_in_null_island.sql
Created July 1, 2022 09:19
dbt spatial test macros
{% test is_in_null_island(model, column_name) %}
with validation as (
select
st_x({{ column_name }}) as lng,
st_y({{ column_name }}) as lat
from
{{ model }}
@ramiroaznar
ramiroaznar / index.html
Last active May 20, 2022 16:34
Interaction and styling GeoJSON with Leaflet.js
<html>
<head>
<title>Interaction and styling GeoJSON with Leaflet.js</title>
<meta charset="utf-8">
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.css" />
<script src="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.js"></script>
<style type="text/css">
html, body, #map{
height: 100%;
padding: 0;