vizicities/examples/basic/main.js

43 wiersze
1.3 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>'
2016-12-21 11:47:51 +00:00
}).addTo(world).then(function() {
console.log('Added image tile layer to world');
2016-12-21 11:47:51 +00:00
});
2016-06-17 11:19:09 +00:00
// Buildings from Mapzen
2016-11-04 21:11:26 +00:00
VIZI.topoJSONTileLayer('https://tile.mapzen.com/mapzen/vector/v1/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>.'
2016-12-21 11:47:51 +00:00
}).addTo(world).then(function() {
console.log('Added TopoJSON layer to world');
2016-08-30 15:46:04 +00:00
});