{"_id":"5452b671b7fa011600a75c27","is_link":false,"__v":5,"githubsync":"","project":"545285163f92fc0e009396c7","category":{"_id":"54557c91a1e5cd0e00435ecc","__v":5,"pages":["54558241a1e5cd0e00435ee7","5455828da1e5cd0e00435ee9","54558344a1e5cd0e00435eec","545583a1533d890e000cf8b9","545583e0a1e5cd0e00435ef2"],"version":"5452b671b7fa011600a75c25","project":"545285163f92fc0e009396c7","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2014-11-02T00:36:33.382Z","from_sync":false,"order":0,"slug":"guides","title":"Guides"},"user":"545284e73f92fc0e009396c6","version":{"_id":"5452b671b7fa011600a75c25","__v":13,"forked_from":"545285163f92fc0e009396ca","project":"545285163f92fc0e009396c7","createdAt":"2014-10-30T22:06:41.529Z","releaseDate":"2014-10-30T22:06:41.529Z","categories":["5452b671b7fa011600a75c26","545579ee35f4ac0800f42bac","54557a3135f4ac0800f42bad","54557b7b35f4ac0800f42bb3","54557c91a1e5cd0e00435ecc","54557caf35f4ac0800f42bbd","54557dc1a1e5cd0e00435ecf","54557e7ba1e5cd0e00435ed6","54557f81533d890e000cf8a9","54557fcd533d890e000cf8aa","54558020a1e5cd0e00435edf","545580b6533d890e000cf8ad","545580e1a1e5cd0e00435ee6"],"is_deprecated":false,"is_hidden":false,"is_beta":true,"is_stable":true,"codename":"","version_clean":"0.2.0","version":"0.2.0"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2014-10-30T18:36:07.141Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"try":true,"basic_auth":false,"auth":"never","params":[],"url":""},"isReference":false,"order":0,"body":"Here are some step-by-step instructions on how to get up and running with your first visualisation, a 3D basemap. You can also [use this JSBin](http://jsbin.com/guqojerova/7/edit?html,js,output) to see the example running and play with the code.\n\nThe first step is to download the [latest ViziCities build files](https://github.com/vizicities/vizicities/tree/0.2.0/build) (JS & CSS).\n\nOnce you've done that then set up the basic HTML and include the ViziCities files:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<!DOCTYPE html>\\n<html>\\n<head>\\n  <meta http-equiv=\\\"Content-type\\\" content=\\\"text/html; charset=utf-8\\\">\\n  <title>ViziCities - Basic Example</title>\\n\\n  <style type=\\\"text/css\\\">\\n    html, body {\\n      height: 100%;\\n      width: 100%;\\n    }\\n    \\n    #vizicities-viewport {\\n      height: 100%;\\n      width: 100%;\\n    }\\n  </style>\\n\\n  <link rel=\\\"stylesheet\\\" type=\\\"text/css\\\" href=\\\"vizi.css\\\">\\n</head>\\n<body>\\n  <div id=\\\"vizicities-viewport\\\"></div>\\n  <script src=\\\"vizi.min.js\\\"></script>\\n  <script src=\\\"main.js\\\"></script>\\n</body>\\n</html>\",\n      \"language\": \"html\"\n    }\n  ]\n}\n[/block]\nAt this point you can initialise ViziCities in a new script (`main.js` in this example):\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"var world = new VIZI.World({\\n  viewport: document.querySelector(\\\"#vizicities-viewport\\\"),\\n  center: new VIZI.LatLon(51.50358, -0.01924)\\n});\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\nAnd add some controls:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"var controls = new VIZI.ControlsMap(world.camera);\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\nLet's add a basemap using [the Blueprint API](http://dev.vizicities.com/v0.2.0/docs/using-the-blueprint-api):\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"var mapConfig = {\\n  input: {\\n    type: \\\"BlueprintInputMapTiles\\\",\\n    options: {\\n      tilePath: \\\"https://a.tiles.mapbox.com/v3/examples.map-i86l3621/{z}/{x}/{y}:::at:::2x.png\\\"\\n    }\\n  },\\n  output: {\\n    type: \\\"BlueprintOutputImageTiles\\\",\\n    options: {\\n      grids: [{\\n        zoom: 13,\\n        tilesPerDirection: 5,\\n        cullZoom: 11\\n      }]\\n    }\\n  },\\n  triggers: [{\\n    triggerObject: \\\"output\\\",\\n    triggerName: \\\"initialised\\\",\\n    triggerArguments: [\\\"tiles\\\"],\\n    actionObject: \\\"input\\\",\\n    actionName: \\\"requestTiles\\\",\\n    actionArguments: [\\\"tiles\\\"],\\n    actionOutput: {\\n      tiles: \\\"tiles\\\" // actionArg: triggerArg\\n    }\\n  }, {\\n    triggerObject: \\\"output\\\",\\n    triggerName: \\\"gridUpdated\\\",\\n    triggerArguments: [\\\"tiles\\\"],\\n    actionObject: \\\"input\\\",\\n    actionName: \\\"requestTiles\\\",\\n    actionArguments: [\\\"tiles\\\"],\\n    actionOutput: {\\n      tiles: \\\"tiles\\\" // actionArg: triggerArg\\n    }\\n  }, {\\n    triggerObject: \\\"input\\\",\\n    triggerName: \\\"tileReceived\\\",\\n    triggerArguments: [\\\"image\\\", \\\"tile\\\"],\\n    actionObject: \\\"output\\\",\\n    actionName: \\\"outputImageTile\\\",\\n    actionArguments: [\\\"image\\\", \\\"tile\\\"],\\n    actionOutput: {\\n      image: \\\"image\\\", // actionArg: triggerArg\\n      tile: \\\"tile\\\"\\n    }\\n  }]\\n};\\n\\nvar switchboardMap = new VIZI.BlueprintSwitchboard(mapConfig);\\nswitchboardMap.addToWorld(world);\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\nThe last step is to to set up the update and render loop:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"var clock = new VIZI.Clock();\\n\\nvar update = function() {\\n  var delta = clock.getDelta();\\n\\n  world.onTick(delta);\\n  world.render();\\n\\n  window.requestAnimationFrame(update);\\n};\\n\\nupdate();\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\nLoad the HTML page in a browser and enjoy your awesome 3D view of London!","excerpt":"Get up and running with your first visualisation, a 3D basemap of London","slug":"getting-started","type":"basic","title":"Getting started with ViziCities"}

Getting started with ViziCities

Get up and running with your first visualisation, a 3D basemap of London

Here are some step-by-step instructions on how to get up and running with your first visualisation, a 3D basemap. You can also [use this JSBin](http://jsbin.com/guqojerova/7/edit?html,js,output) to see the example running and play with the code. The first step is to download the [latest ViziCities build files](https://github.com/vizicities/vizicities/tree/0.2.0/build) (JS & CSS). Once you've done that then set up the basic HTML and include the ViziCities files: [block:code] { "codes": [ { "code": "<!DOCTYPE html>\n<html>\n<head>\n <meta http-equiv=\"Content-type\" content=\"text/html; charset=utf-8\">\n <title>ViziCities - Basic Example</title>\n\n <style type=\"text/css\">\n html, body {\n height: 100%;\n width: 100%;\n }\n \n #vizicities-viewport {\n height: 100%;\n width: 100%;\n }\n </style>\n\n <link rel=\"stylesheet\" type=\"text/css\" href=\"vizi.css\">\n</head>\n<body>\n <div id=\"vizicities-viewport\"></div>\n <script src=\"vizi.min.js\"></script>\n <script src=\"main.js\"></script>\n</body>\n</html>", "language": "html" } ] } [/block] At this point you can initialise ViziCities in a new script (`main.js` in this example): [block:code] { "codes": [ { "code": "var world = new VIZI.World({\n viewport: document.querySelector(\"#vizicities-viewport\"),\n center: new VIZI.LatLon(51.50358, -0.01924)\n});", "language": "javascript" } ] } [/block] And add some controls: [block:code] { "codes": [ { "code": "var controls = new VIZI.ControlsMap(world.camera);", "language": "javascript" } ] } [/block] Let's add a basemap using [the Blueprint API](http://dev.vizicities.com/v0.2.0/docs/using-the-blueprint-api): [block:code] { "codes": [ { "code": "var mapConfig = {\n input: {\n type: \"BlueprintInputMapTiles\",\n options: {\n tilePath: \"https://a.tiles.mapbox.com/v3/examples.map-i86l3621/{z}/{x}/{y}@2x.png\"\n }\n },\n output: {\n type: \"BlueprintOutputImageTiles\",\n options: {\n grids: [{\n zoom: 13,\n tilesPerDirection: 5,\n cullZoom: 11\n }]\n }\n },\n triggers: [{\n triggerObject: \"output\",\n triggerName: \"initialised\",\n triggerArguments: [\"tiles\"],\n actionObject: \"input\",\n actionName: \"requestTiles\",\n actionArguments: [\"tiles\"],\n actionOutput: {\n tiles: \"tiles\" // actionArg: triggerArg\n }\n }, {\n triggerObject: \"output\",\n triggerName: \"gridUpdated\",\n triggerArguments: [\"tiles\"],\n actionObject: \"input\",\n actionName: \"requestTiles\",\n actionArguments: [\"tiles\"],\n actionOutput: {\n tiles: \"tiles\" // actionArg: triggerArg\n }\n }, {\n triggerObject: \"input\",\n triggerName: \"tileReceived\",\n triggerArguments: [\"image\", \"tile\"],\n actionObject: \"output\",\n actionName: \"outputImageTile\",\n actionArguments: [\"image\", \"tile\"],\n actionOutput: {\n image: \"image\", // actionArg: triggerArg\n tile: \"tile\"\n }\n }]\n};\n\nvar switchboardMap = new VIZI.BlueprintSwitchboard(mapConfig);\nswitchboardMap.addToWorld(world);", "language": "javascript" } ] } [/block] The last step is to to set up the update and render loop: [block:code] { "codes": [ { "code": "var clock = new VIZI.Clock();\n\nvar update = function() {\n var delta = clock.getDelta();\n\n world.onTick(delta);\n world.render();\n\n window.requestAnimationFrame(update);\n};\n\nupdate();", "language": "javascript" } ] } [/block] Load the HTML page in a browser and enjoy your awesome 3D view of London!