- model / view
- collection / view collection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH a as ( | |
select zoom('!scale_denominator!') as current_zoom | |
) | |
SELECT the_geom_webmercator from roads, a where current_zoom < 8 AND type='Interstate' | |
UNION | |
SELECT the_geom_webmercator from roads, a where current_zoom >= 8 AND current_zoom < 12 AND (type='Interstate' OR type='US') | |
UNION | |
SELECT the_geom_webmercator from roads where current_zoom >= 12 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Leaflet example | CartoDB.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%; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html> | |
<head> | |
<title>Bing Maps + CartoDB.js</title> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> | |
<style> | |
html, body, #myMap{ | |
height: 100%; | |
padding: 0; | |
margin: 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vizjson({ | |
"version": "0.1.0", | |
"title": "fake", | |
"scrollwheel": true, | |
"zoom": 3, | |
"bounds": [ | |
[ | |
-44.46515101351962, | |
-133.06640625 | |
], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import json | |
import random | |
import urllib | |
class MapInstance(object): | |
def __init__(self, definition, url, headers=None): | |
self.url = url | |
self.definition = definition |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select _postgis_stats('tm_world_borders_s_11'::regclass ,'the_geom'); | |
-[ RECORD 1 ]--+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | |
_postgis_stats | {"ndims":2,"size":[6,7],"extent":{"min":[-181.8,-90.8679],"max":[181.8,84.4381]},"table_features":246,"sample_features":246,"not_null_features":246,"histogram_features":246,"histogram_cells":42,"cells_covered":246} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test_postgis=# select count(*) from sigpac_47_valladolid_parfe; | |
count | |
-------- | |
342691 | |
test_postgis=# select sum(st_memsize(the_geom_webmercator)) from sigpac_47_valladolid_parfe; | |
sum | |
----------- | |
254827296 | |
(1 row) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH deltas as ( | |
SELECT | |
st_distance(the_geom::geography, lag(the_geom::geography, 1) over(order by timestamp)) as ddist, | |
timestamp - lag(timestamp, 1) over(order by timestamp) as dt | |
from out_2 offset 1000 | |
) | |
select avg(ddist/dt) as speed from deltas |