Skip to content

Instantly share code, notes, and snippets.

@rfriberg
Last active February 28, 2017 18:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rfriberg/5f031f0fe81306cd3c18e07cc1d1c85a to your computer and use it in GitHub Desktop.
Save rfriberg/5f031f0fe81306cd3c18e07cc1d1c85a to your computer and use it in GitHub Desktop.
Dot mapping in Tangram
<!DOCTYPE html>
<html lang="en">
<head>
<title>Dot Mapping</title>
<meta charset="utf-8">
<link rel="stylesheet" href="https://mapzen.com/js/mapzen.css">
<script src="https://mapzen.com/js/mapzen.min.js"></script>
<style>
html,body{margin: 0; padding: 0}
#map {
height: 100%;
width: 100%;
position: absolute;
}
</style>
</head>
<body>
<div id="map"></div>
<script>
// Mapzen API key (replace key with your own)
// To generate your own key, go to https://mapzen.com/developers/
L.Mapzen.apiKey = 'mapzen-JA21Wes';
var map = L.Mapzen.map('map', {
center: [37.7443, -122.4229],
zoom: 13,
scene: 'scene.yaml'
});
</script>
</body>
</html>
import: https://mapzen.com/carto/refill-style/refill-style.yaml
sources:
trees:
type: GeoJSON
url: https://s3.amazonaws.com/mapzen-assets/images/dot-mapping/trees_min.geojson
styles:
_tree_icons_style:
base: points
blend_order: 1
texture: https://s3.amazonaws.com/mapzen-assets/images/dot-mapping/tree_white.png
layers:
_trees_layer:
data: { source: trees }
filter: { $zoom: { min: 12 } }
draw:
points:
color: [[12, [0.290, 0.604, 0.290, 0.30]], [18, [0.165, 0.478, 0.165, 0.85]]]
size: [[12, 1px], [15, 5px], [18, 14px], [18, 20px], [22, 52px]]
collide: false
_trees_icon_sublayer:
filter: { $zoom: { min: 18 } }
draw:
_tree_icons_style:
size: [[18, 14px], [22, 40px]]
collide: false
points:
text:
text_source: |
function () {
return feature.qSpecies.split(':: ')[1];
}
font:
fill: forestgreen
size: 10pt
stroke:
width: 5px
color: white
optional: true
roads:
filter: { $zoom: { min: 18} }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment