Skip to content

Instantly share code, notes, and snippets.

Avatar

Javier de la Torre jatorre

View GitHub Profile
View gist:5fef10d812aa3fca64f742f6e4ec95cd
CREATE TEMP FUNCTION calculate_mapbox_price(num_tiles INT64, max_zoom INT64, min_zoom INT64)
RETURNS FLOAT64
DETERMINISTIC
LANGUAGE js
AS """
var sku;
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<title>team-ricky.suk_sandbox.openaq_wildfire | CARTO BigQuery Tiler</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://storage.googleapis.com/bqtilerjslibs/mbgl1.12.0.js'></script>
<link href='https://storage.googleapis.com/bqtilerjslibs/mbgl1.12.0.css' rel='stylesheet' />
<link href="https://fonts.googleapis.com/css2?family=Open+Sans&display=swap" rel="stylesheet">
View gist:91e28bf2c6470823508d4a7ca19554b0
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<title>cartobq.maps.ookla2 | CARTO BigQuery Tiler</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://storage.googleapis.com/bqtilerjslibs/mbgl1.12.0.js'></script>
<link href='https://storage.googleapis.com/bqtilerjslibs/mbgl1.12.0.css' rel='stylesheet' />
<link href="https://fonts.googleapis.com/css2?family=Open+Sans&display=swap" rel="stylesheet">
View positron (2).json
{
"version": 8,
"name": "Positron",
"metadata": {"maputnik:renderer": "mbgljs"},
"sources": {
"carto": {
"type": "vector",
"url": "https://tiles.basemaps.cartocdn.com/vector/carto.streets/v1/tiles.json"
}
},
View positron-modified.json
{
"version": 8,
"name": "Positron",
"metadata": {"maputnik:renderer": "mbgljs"},
"sources": {
"carto": {
"type": "vector",
"url": "https://tiles.basemaps.cartocdn.com/vector/carto.streets/v1/tiles.json"
}
},
View gist:ded44ab09480ae1ec5ac5fb05ee66700
CALL cartobq.tiler.ST_PointAggregationAsMVT(
--SQL to use as the source (use geom as name for geography)
'''(SELECT ST_Centroid(geometry) as geom
FROM `bigquery-public-data.geo_openstreetmap.planet_layers`
where layer_name ='building')''',
--Name and location where the Tileset will be stored. Replace:
'`cartobq.maps.osm_buildings_weekly`',
--Options on how to generate the Tileset
View metadata.json
{
"tiles": [
"https://bq1.cartocdn.com/bqtiler?y={y}&x={x}&z={z}&p=0_16_19257_19396_24574_24697_4000_1&t=cartobq.maps.nyc_taxi_demo2",
"https://bq2.cartocdn.com/bqtiler?y={y}&x={x}&z={z}&p=0_16_19257_19396_24574_24697_4000_1&t=cartobq.maps.nyc_taxi_demo2",
"https://bq3.cartocdn.com/bqtiler?y={y}&x={x}&z={z}&p=0_16_19257_19396_24574_24697_4000_1&t=cartobq.maps.nyc_taxi_demo2",
"https://bq4.cartocdn.com/bqtiler?y={y}&x={x}&z={z}&p=0_16_19257_19396_24574_24697_4000_1&t=cartobq.maps.nyc_taxi_demo2"
],
"id": "cartobqtiler/cartobq.maps.nyc_taxi_demo2",
"name": "`cartobq.maps.nyc_taxi_demo2`",
View index.html
<html>
<head>
<!-- deck.gl standalone bundle -->
<script src="https://unpkg.com/deck.gl@^8.2.2/dist.min.js"></script>
<!-- Google Maps dependencies -->
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDxXV2PyJHev2jX5w6X3UAqNQ97t1fg0vU&libraries=visualization"></script>
<style type="text/css">
body {margin: 0; padding: 0;}
View index.html
<html>
<head>
<!-- deck.gl standalone bundle -->
<script src="https://unpkg.com/deck.gl@^8.2.2/dist.min.js"></script>
<!-- Google Maps dependencies -->
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDxXV2PyJHev2jX5w6X3UAqNQ97t1fg0vU&libraries=visualization"></script>
<style type="text/css">
body {margin: 0; padding: 0;}
View index.html
<html>
<head>
<!-- deck.gl standalone bundle -->
<script src="https://unpkg.com/deck.gl@^8.2.2/dist.min.js"></script>
<!-- Google Maps dependencies -->
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDxXV2PyJHev2jX5w6X3UAqNQ97t1fg0vU&libraries=visualization"></script>
<style type="text/css">
body {margin: 0; padding: 0;}