vizicities/examples/basic/main.js

39 wiersze
1.2 KiB
JavaScript
Czysty Zwykły widok Historia

// Manhattan
2016-06-17 11:19:09 +00:00
var coords = [40.739940, -73.988801];
var world = VIZI.world('world', {
2016-06-17 11:19:09 +00:00
skybox: false,
postProcessing: false
}).setView(coords);
// Add controls
VIZI.Controls.orbit().addTo(world);
2016-06-17 11:19:09 +00:00
// CartoDB basemap
VIZI.imageTileLayer('http://{s}.basemaps.cartocdn.com/light_nolabels/{z}/{x}/{y}.png', {
2016-03-09 12:26:41 +00:00
attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, &copy; <a href="http://cartodb.com/attributions">CartoDB</a>'
}).addTo(world);
2016-06-17 11:19:09 +00:00
// Buildings from Mapzen
VIZI.topoJSONTileLayer('https://vector.mapzen.com/osm/buildings/{z}/{x}/{y}.topojson?api_key=vector-tiles-NT5Emiw', {
2016-04-19 07:43:41 +00:00
interactive: false,
style: function(feature) {
var height;
if (feature.properties.height) {
height = feature.properties.height;
} else {
height = 10 + Math.random() * 10;
}
return {
2016-06-17 11:19:09 +00:00
height: height
2016-04-19 07:43:41 +00:00
};
},
filter: function(feature) {
// Don't show points
return feature.geometry.type !== 'Point';
},
attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, <a href="http://whosonfirst.mapzen.com#License">Who\'s On First</a>.'
}).addTo(world);