2016-02-24 20:42:32 +00:00
|
|
|
var world = VIZI.World('world', {
|
|
|
|
skybox: true
|
|
|
|
}).setView([51.505, -0.09]);
|
2016-02-12 08:47:08 +00:00
|
|
|
|
2016-02-15 13:21:48 +00:00
|
|
|
// Add controls
|
|
|
|
VIZI.Controls.Orbit().addTo(world);
|
|
|
|
|
2016-02-19 21:25:16 +00:00
|
|
|
// // http://{s}.tile.osm.org/{z}/{x}/{y}.png
|
|
|
|
// // http://{s}.tiles.wmflabs.org/osm-no-labels/{z}/{x}/{y}.png
|
2016-02-18 22:03:56 +00:00
|
|
|
var imageTileLayer = VIZI.ImageTileLayer('http://{s}.basemaps.cartocdn.com/light_nolabels/{z}/{x}/{y}.png', {
|
|
|
|
attribution: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, © <a href="http://cartodb.com/attributions">CartoDB</a>'
|
|
|
|
}).addTo(world);
|
2016-02-19 21:25:16 +00:00
|
|
|
|
2016-02-27 19:31:41 +00:00
|
|
|
// Building and roads from Mapzen (polygons and linestrings)
|
|
|
|
var topoJSONTileLayer = VIZI.TopoJSONTileLayer('https://vector.mapzen.com/osm/buildings,roads/{z}/{x}/{y}.topojson?api_key=vector-tiles-NT5Emiw', {
|
2016-02-29 23:04:07 +00:00
|
|
|
// picking: true,
|
2016-02-22 22:24:57 +00:00
|
|
|
style: function(feature) {
|
2016-02-25 12:27:42 +00:00
|
|
|
var height;
|
|
|
|
|
|
|
|
if (feature.properties.height) {
|
|
|
|
height = feature.properties.height;
|
|
|
|
} else {
|
|
|
|
height = 10 + Math.random() * 10;
|
|
|
|
}
|
|
|
|
|
2016-02-22 13:03:50 +00:00
|
|
|
return {
|
2016-02-27 19:31:41 +00:00
|
|
|
height: height,
|
|
|
|
lineColor: '#f7c616',
|
|
|
|
lineWidth: 1,
|
|
|
|
lineTransparent: true,
|
|
|
|
lineOpacity: 0.2,
|
|
|
|
lineBlending: THREE.AdditiveBlending,
|
|
|
|
lineRenderOrder: 2
|
2016-02-22 13:03:50 +00:00
|
|
|
};
|
|
|
|
},
|
2016-02-29 23:04:07 +00:00
|
|
|
// onClick: function(feature) {
|
|
|
|
// console.log('Clicked:', feature);
|
|
|
|
// },
|
2016-02-19 21:25:16 +00:00
|
|
|
attribution: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, <a href="http://whosonfirst.mapzen.com#License">Who\'s On First</a>.'
|
|
|
|
}).addTo(world);
|
2016-02-27 19:31:41 +00:00
|
|
|
|
2016-02-29 23:04:07 +00:00
|
|
|
// Just buildings from Mapzen (polygons)
|
2016-02-27 19:31:41 +00:00
|
|
|
// var topoJSONTileLayer = VIZI.TopoJSONTileLayer('https://vector.mapzen.com/osm/buildings/{z}/{x}/{y}.topojson?api_key=vector-tiles-NT5Emiw', {
|
|
|
|
// style: function(feature) {
|
|
|
|
// var height;
|
|
|
|
//
|
|
|
|
// if (feature.properties.height) {
|
|
|
|
// height = feature.properties.height;
|
|
|
|
// } else {
|
|
|
|
// height = 10 + Math.random() * 10;
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// return {
|
|
|
|
// // color: (feature.properties.area > 10000) ? '#ff0000' : '#0000ff'
|
|
|
|
// color: '#ffffff',
|
|
|
|
// height: height
|
|
|
|
// };
|
|
|
|
// },
|
|
|
|
// // filter: function(feature) {
|
|
|
|
// // // Only show features with an area larger than 5000 (metres squared in
|
|
|
|
// // // projected units)
|
|
|
|
// // return feature.properties.area > 5000;
|
|
|
|
// // },
|
|
|
|
// attribution: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, <a href="http://whosonfirst.mapzen.com#License">Who\'s On First</a>.'
|
|
|
|
// }).addTo(world);
|
2016-02-28 20:29:52 +00:00
|
|
|
|
2016-03-01 17:26:26 +00:00
|
|
|
// // London Underground lines
|
2016-02-28 20:29:52 +00:00
|
|
|
// var geoJSONLayer = VIZI.GeoJSONLayer('https://rawgit.com/robhawkes/4acb9d6a6a5f00a377e2/raw/30ae704a44e10f2e13fb7e956e80c3b22e8e7e81/tfl_lines.json', {
|
2016-02-29 23:04:07 +00:00
|
|
|
// picking: true,
|
2016-03-01 17:26:26 +00:00
|
|
|
// style: function(feature) {
|
|
|
|
// var colour = feature.properties.lines[0].colour || '#ffffff';
|
|
|
|
//
|
|
|
|
// return {
|
|
|
|
// lineColor: colour,
|
|
|
|
// // lineHeight: 20,
|
|
|
|
// lineWidth: 3,
|
|
|
|
// // lineTransparent: true,
|
|
|
|
// // lineOpacity: 0.5,
|
|
|
|
// // lineBlending: THREE.AdditiveBlending,
|
|
|
|
// lineRenderOrder: 2
|
|
|
|
// };
|
2016-02-28 20:29:52 +00:00
|
|
|
// },
|
2016-02-29 23:04:07 +00:00
|
|
|
// onClick: function(feature) {
|
|
|
|
// console.log('Clicked:', feature);
|
|
|
|
// },
|
2016-02-28 20:29:52 +00:00
|
|
|
// attribution: '© Transport for London.'
|
|
|
|
// }).addTo(world);
|