Skip to content

Instantly share code, notes, and snippets.

Created November 16, 2015 22:49
Show Gist options
  • Select an option

  • Save anonymous/ca1f18d77e16355b43bd to your computer and use it in GitHub Desktop.

Select an option

Save anonymous/ca1f18d77e16355b43bd to your computer and use it in GitHub Desktop.
This is a Tangram scene, made with Tangram Play. It uses CartoDB data exported as GeoJSON vector tiles.[This is a Tangram scene, made with Tangram Play.]
cameras:
perspective:
type: perspective
vanishing_point: [0, -500]
lights:
directional1:
type: directional
direction: [.1, .5, -1]
diffuse: .7
ambient: .5
styles:
buildings:
base: polygons
shaders:
blocks:
color: |
color.rgb *= vec3(min((worldPosition().z*.001 + .5),1.));
sources:
osm:
type: TopoJSON
url: //vector.mapzen.com/osm/all/{z}/{x}/{y}.topojson?api_key=vector-tiles-P6dkVl4
cartodb:
type: GeoJSON
url: http://osm2.cartodb.com/api/v2/sql?format=geojson&q=%20WITH%20_sql%20AS%20(SELECT%20*%20FROM%20us_counties),%20zz%20AS%20(SELECT%20{z}%20as%20z,{x}%20as%20x,{y}%20as%20y),%20tile%20AS%20(SELECT%20TileBBox(zz.z,zz.x,zz.y)%20as%20bbox,zz.z%20as%20zoom%20FROM%20zz)%20SELECT%20cartodb_id,%20ST_Transform(ST_Simplify(ST_ClipByBox2D(the_geom_webmercator,%20tile.bbox),%20ZRes(tile.zoom)),4326)%20as%20the_geom%20FROM%20_sql%20INNER%20JOIN%20tile%20ON%20(ST_Intersects(_sql.the_geom_webmercator,%20tile.bbox))%20WHERE%20sqrt(ST_Area(_sql.the_geom_webmercator))%20%3E%20ZRes(tile.zoom)
layers:
cartodb:
data: { source: cartodb}
draw:
lines:
order: 100
color: red
width: 2px
water:
data: { source: osm }
draw:
polygons:
order: 2
color: '#353535'
earth:
data: { source: osm }
draw:
polygons:
order: 0
color: '#555'
landuse:
data: { source: osm }
draw:
polygons:
order: 1
color: '#666'
roads:
data: { source: osm }
properties: { width: 3 }
draw:
lines:
order: 2
color: '#777'
width: 5
ferry:
filter: { kind: ferry }
draw:
lines:
order: 2
color: '#444'
width: 2
buildings:
data: { source: osm }
draw:
polygons:
order: 50
color: '#999'
extruded:
draw:
polygons:
style: buildings
extrude: function () { return feature.height > 0 || $zoom >= 16; }
road_labels:
data: { source: osm, layer: roads }
filter: { name: true, aeroway: false, tunnel: false, railway: false, not: { kind: [rail, ferry] } }
highway:
filter: { kind: highway, $zoom: { min: 7 } }
draw:
text:
font:
fill: white
family: helvetica
size: 12px
weight: 500
not_highway:
filter: { not: { kind: highway }, $zoom: { min: 13 } }
draw:
text:
font:
fill: white
family: helvetica
size: 11px
weight: 100
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment