{"_id":"54557a6435f4ac0800f42baf","project":"545285163f92fc0e009396c7","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"},"category":{"_id":"54557a3135f4ac0800f42bad","pages":["54557a6435f4ac0800f42baf","54557c5435f4ac0800f42bb9","54557e58a1e5cd0e00435ed4","5456daaff037df0800035612"],"project":"545285163f92fc0e009396c7","version":"5452b671b7fa011600a75c25","__v":4,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2014-11-02T00:26:25.292Z","from_sync":false,"order":1,"slug":"blueprint-inputs","title":"Blueprint Inputs"},"__v":29,"is_link":false,"user":"545284e73f92fc0e009396c6","updates":[],"next":{"pages":[],"description":""},"createdAt":"2014-11-02T00:27:16.935Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"try":true,"basic_auth":false,"auth":"never","params":[],"url":""},"isReference":false,"order":1,"body":"This module lets you retrieve GeoJSON data from a relative or external URL. For example, you could use this module to request vector map tiles from Mapzen, or to request a file relative to your ViziCities installation containing voting boundaries.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Name\"\n}\n[/block]\n`BlueprintInputGeoJSON`\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Options\"\n}\n[/block]\nOverride module functionality with the following options.\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Option\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"`path`\",\n    \"0-1\": \"`String`\",\n    \"0-2\": \"URL describing the GeoJSON file. Can be relative to path of ViziCities installation.\\n\\nEg. \\\"/data/sample.geojson\\\"\",\n    \"1-0\": \"`tilePath`\",\n    \"1-1\": \"`String`\",\n    \"1-2\": \"URL describing the GeoJSON tile endpoint. Must contain `{x}`, `{y}` and `{z}` variables.\\n\\nEg. \\\"http://vector.mapzen.com/osm/buildings/{z}/{x}/{y}.json\\\"\"\n  },\n  \"cols\": 3,\n  \"rows\": 2\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Triggers\"\n}\n[/block]\nThese triggers are fired at various point during the lifetime of the module.\n\n## Trigger: `initialised`\n\nFired when the GeoJSON module has been added to the `World` and is ready to use.\n\n## Trigger: `dataReceived`\n\nFired when GeoJSON data from a single file has been successfully received from the `path` URL.\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Argument\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Example\",\n    \"0-0\": \"`geoJSON`\",\n    \"0-1\": \"`Object` or `Array` (JSON)\",\n    \"0-2\": \"```\\n{\\n  \\\"type\\\": \\\"FeatureCollection\\\",\\n  \\\"features\\\": [\\n    {\\n      \\\"geometry\\\": {\\n        \\\"type\\\": \\\"Polygon\\\",\\n        \\\"coordinates\\\": [\\n          [\\n            [\\n              -0.012994,\\n              51.514796\\n            ],\\n            [\\n              -0.012128,\\n              51.515036\\n            ]\\n          ]\\n        ]\\n      },\\n      \\\"type\\\": \\\"Feature\\\",\\n      \\\"id\\\": \\\"28117012\\\",\\n      \\\"properties\\\": {}\\n    }\\n  ]\\n}\\n```\"\n  },\n  \"cols\": 3,\n  \"rows\": 1\n}\n[/block]\n## Trigger: `tileReceived`\n\nFired when GeoJSON data has been successfully received from the requested `tilePath` endpoint.\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Argument\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Example\",\n    \"0-0\": \"`geoJSON`\",\n    \"0-1\": \"`Object` or `Array` (JSON)\",\n    \"1-0\": \"`tile`\",\n    \"1-1\": \"`Object`\",\n    \"1-2\": \"```\\n{\\n  x: 262116,\\n  y: 174348,\\n  z: 19\\n}\\n```\",\n    \"0-2\": \"```\\n{\\n  \\\"type\\\": \\\"FeatureCollection\\\",\\n  \\\"features\\\": [\\n    {\\n      \\\"geometry\\\": {\\n        \\\"type\\\": \\\"Polygon\\\",\\n        \\\"coordinates\\\": [\\n          [\\n            [\\n              -0.012994,\\n              51.514796\\n            ],\\n            [\\n              -0.012128,\\n              51.515036\\n            ]\\n          ]\\n        ]\\n      },\\n      \\\"type\\\": \\\"Feature\\\",\\n      \\\"id\\\": \\\"28117012\\\",\\n      \\\"properties\\\": {}\\n    }\\n  ]\\n}\\n```\"\n  },\n  \"cols\": 3,\n  \"rows\": 2\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Actions\"\n}\n[/block]\nThese actions are exposed to the Blueprint API to be triggered by other modules.\n\n## Action: `requestData`\n\nRequests GeoJSON data from the `path` URL.\n\n## Action: `requestTiles`\n\nRequests GeoJSON data from the `tilePath` endpoint.\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Argument\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Example\",\n    \"0-0\": \"`tiles`\",\n    \"0-1\": \"`Array` of `Object`\",\n    \"0-2\": \"```\\n[{\\n  x: 262116,\\n  y: 174348,\\n  z: 19\\n}, {\\n  x: 262117,\\n  y: 174348,\\n  z: 19\\n}]\\n```\"\n  },\n  \"cols\": 3,\n  \"rows\": 1\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Example input\"\n}\n[/block]\nExample map tile image retrieved from the Mapzen URL `http://vector.mapzen.com/osm/buildings/{z}/{x}/{y}.json`:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"type\\\": \\\"FeatureCollection\\\",\\n  \\\"features\\\": [\\n    {\\n      \\\"geometry\\\": {\\n        \\\"type\\\": \\\"Polygon\\\",\\n        \\\"coordinates\\\": [\\n          [\\n            [\\n              -0.019079,\\n              51.512004\\n            ],\\n            [\\n              -0.018992,\\n              51.512005\\n            ],\\n            [\\n              -0.018990,\\n              51.511931\\n            ],\\n            [\\n              -0.019076,\\n              51.511930\\n            ],\\n            [\\n              -0.019079,\\n              51.512004\\n            ]\\n          ]\\n        ]\\n      },\\n      \\\"type\\\": \\\"Feature\\\",\\n      \\\"id\\\": \\\"197277383\\\",\\n      \\\"properties\\\": {\\n        \\\"kind\\\": \\\"house\\\"\\n      }\\n    },\\n    {\\n      \\\"geometry\\\": {\\n        \\\"type\\\": \\\"Polygon\\\",\\n        \\\"coordinates\\\": [\\n          [\\n            [\\n              -0.013803,\\n              51.513455\\n            ],\\n            [\\n              -0.013734,\\n              51.513465\\n            ],\\n            [\\n              -0.013706,\\n              51.513397\\n            ],\\n            [\\n              -0.013774,\\n              51.513384\\n            ],\\n            [\\n              -0.013803,\\n              51.513455\\n            ]\\n          ]\\n        ]\\n      },\\n      \\\"type\\\": \\\"Feature\\\",\\n      \\\"id\\\": \\\"191580388\\\",\\n      \\\"properties\\\": {}\\n    }\\n  ]\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]","excerpt":"GeoJSON data input for ViziCities","slug":"blueprint-input-geojson","type":"basic","title":"GeoJSON"}

GeoJSON

GeoJSON data input for ViziCities

This module lets you retrieve GeoJSON data from a relative or external URL. For example, you could use this module to request vector map tiles from Mapzen, or to request a file relative to your ViziCities installation containing voting boundaries. [block:api-header] { "type": "basic", "title": "Name" } [/block] `BlueprintInputGeoJSON` [block:api-header] { "type": "basic", "title": "Options" } [/block] Override module functionality with the following options. [block:parameters] { "data": { "h-0": "Option", "h-1": "Type", "h-2": "Description", "0-0": "`path`", "0-1": "`String`", "0-2": "URL describing the GeoJSON file. Can be relative to path of ViziCities installation.\n\nEg. \"/data/sample.geojson\"", "1-0": "`tilePath`", "1-1": "`String`", "1-2": "URL describing the GeoJSON tile endpoint. Must contain `{x}`, `{y}` and `{z}` variables.\n\nEg. \"http://vector.mapzen.com/osm/buildings/{z}/{x}/{y}.json\"" }, "cols": 3, "rows": 2 } [/block] [block:api-header] { "type": "basic", "title": "Triggers" } [/block] These triggers are fired at various point during the lifetime of the module. ## Trigger: `initialised` Fired when the GeoJSON module has been added to the `World` and is ready to use. ## Trigger: `dataReceived` Fired when GeoJSON data from a single file has been successfully received from the `path` URL. [block:parameters] { "data": { "h-0": "Argument", "h-1": "Type", "h-2": "Example", "0-0": "`geoJSON`", "0-1": "`Object` or `Array` (JSON)", "0-2": "```\n{\n \"type\": \"FeatureCollection\",\n \"features\": [\n {\n \"geometry\": {\n \"type\": \"Polygon\",\n \"coordinates\": [\n [\n [\n -0.012994,\n 51.514796\n ],\n [\n -0.012128,\n 51.515036\n ]\n ]\n ]\n },\n \"type\": \"Feature\",\n \"id\": \"28117012\",\n \"properties\": {}\n }\n ]\n}\n```" }, "cols": 3, "rows": 1 } [/block] ## Trigger: `tileReceived` Fired when GeoJSON data has been successfully received from the requested `tilePath` endpoint. [block:parameters] { "data": { "h-0": "Argument", "h-1": "Type", "h-2": "Example", "0-0": "`geoJSON`", "0-1": "`Object` or `Array` (JSON)", "1-0": "`tile`", "1-1": "`Object`", "1-2": "```\n{\n x: 262116,\n y: 174348,\n z: 19\n}\n```", "0-2": "```\n{\n \"type\": \"FeatureCollection\",\n \"features\": [\n {\n \"geometry\": {\n \"type\": \"Polygon\",\n \"coordinates\": [\n [\n [\n -0.012994,\n 51.514796\n ],\n [\n -0.012128,\n 51.515036\n ]\n ]\n ]\n },\n \"type\": \"Feature\",\n \"id\": \"28117012\",\n \"properties\": {}\n }\n ]\n}\n```" }, "cols": 3, "rows": 2 } [/block] [block:api-header] { "type": "basic", "title": "Actions" } [/block] These actions are exposed to the Blueprint API to be triggered by other modules. ## Action: `requestData` Requests GeoJSON data from the `path` URL. ## Action: `requestTiles` Requests GeoJSON data from the `tilePath` endpoint. [block:parameters] { "data": { "h-0": "Argument", "h-1": "Type", "h-2": "Example", "0-0": "`tiles`", "0-1": "`Array` of `Object`", "0-2": "```\n[{\n x: 262116,\n y: 174348,\n z: 19\n}, {\n x: 262117,\n y: 174348,\n z: 19\n}]\n```" }, "cols": 3, "rows": 1 } [/block] [block:api-header] { "type": "basic", "title": "Example input" } [/block] Example map tile image retrieved from the Mapzen URL `http://vector.mapzen.com/osm/buildings/{z}/{x}/{y}.json`: [block:code] { "codes": [ { "code": "{\n \"type\": \"FeatureCollection\",\n \"features\": [\n {\n \"geometry\": {\n \"type\": \"Polygon\",\n \"coordinates\": [\n [\n [\n -0.019079,\n 51.512004\n ],\n [\n -0.018992,\n 51.512005\n ],\n [\n -0.018990,\n 51.511931\n ],\n [\n -0.019076,\n 51.511930\n ],\n [\n -0.019079,\n 51.512004\n ]\n ]\n ]\n },\n \"type\": \"Feature\",\n \"id\": \"197277383\",\n \"properties\": {\n \"kind\": \"house\"\n }\n },\n {\n \"geometry\": {\n \"type\": \"Polygon\",\n \"coordinates\": [\n [\n [\n -0.013803,\n 51.513455\n ],\n [\n -0.013734,\n 51.513465\n ],\n [\n -0.013706,\n 51.513397\n ],\n [\n -0.013774,\n 51.513384\n ],\n [\n -0.013803,\n 51.513455\n ]\n ]\n ]\n },\n \"type\": \"Feature\",\n \"id\": \"191580388\",\n \"properties\": {}\n }\n ]\n}", "language": "json" } ] } [/block]