Created
March 30, 2019 16:05
-
-
Save willemarcel/d6152bc7d0638f8463eecc43e6b510ac to your computer and use it in GitHub Desktop.
test map campaigner visualization with Leaftlet.VectorGrid
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>Quick Start - Leaflet</title> | |
<meta charset="utf-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<link rel="shortcut icon" type="image/x-icon" href="docs/images/favicon.ico" /> | |
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.4.0/dist/leaflet.css" integrity="sha512-puBpdR0798OZvTTbP4A8Ix/l+A4dHDD0DGqYW6RQ+9jxkRFclaxxQb/SJAWZfWAkuyeQUytO7+7N4QKrDh+drA==" crossorigin=""/> | |
<script src="https://unpkg.com/leaflet@1.4.0/dist/leaflet.js" integrity="sha512-QVftwZFqvtRNi0ZyCtsznlKSWOStnDORoefr1enyq5mVL4tmKB3S/EnC3rRJcxCPavG10IcrVGSmPh6Qw5lwrg==" crossorigin=""></script> | |
<script type="text/javascript" src="https://unpkg.com/leaflet.vectorgrid@1.2.0"></script> | |
</head> | |
<body> | |
<div id="mapid" style="width: 600px; height: 400px;"></div> | |
<script> | |
var mymap = L.map('mapid').setView([-23.55143, -46.67923], 13); | |
L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw', { | |
maxZoom: 18, | |
attribution: 'Map data © <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, ' + | |
'<a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' + | |
'Imagery © <a href="https://www.mapbox.com/">Mapbox</a>', | |
id: 'mapbox.streets' | |
}).addTo(mymap); | |
// 'http://localhost:5000/tiles/{z}/{x}/{y}.pbf', | |
L.vectorGrid.protobuf( | |
'https://s3-us-west-2.amazonaws.com/hotosm-fieldcampaigner-data-staging/campaigns/9386a612e0b64909875f3e30a22fe123/render/buildings/tiles/{z}/{x}/{y}.pbf', | |
{ | |
vectorTileLayerStyles: { | |
buildings: { | |
fill: true, | |
weight: 1, | |
fillColor: "#2b2b2b", | |
color: "#2b2b2b", | |
fillOpacity: 1, | |
opacity: 1 | |
} | |
}, | |
maxNativeZoom: 19 | |
} | |
).addTo(mymap); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment