# CityView
[](https://pypi.org/project/cityview/)
[](https://www.npmjs.com/package/three-cityjson)
CityJSON loader and renderer for three.js, react-three-fiber, and Jupyter Notebook / JupyterLab.
Supports [CityJSON format](https://www.cityjson.org/) and [CityJSONSeq format](https://www.cityjson.org/cityjsonseq/).
## Contents
- [Packages](#packages)
- [Installation](#installation)
- [Usage](#usage)
- [Roadmap](#roadmap)
- [License](#license)
## Packages
| Package Name | Description |
|----------------|-------------|
| [cityview](https://github.com/ozekik/cityview) (top-level package) | Python package |
| [three-cityjson](https://github.com/ozekik/cityview/tree/master/packages/three-cityjson) | JavaScript / TypeScript package |
## Installation
```bash
pip install cityview
```
## Usage
### Basic usage
#### VirtualView
```python
import cityview as cv
view = cv.VirtualView(theme="light")
with open("./packages/three-cityjson/public/sample/daiba_sta.city.jsonl", "r") as f:
data = f.read()
view.layers = [
cv.CityJSONLayer(data=data, format="cityjsonseq")
]
view.update()
view
```

#### MapView
```python
import cityview as cv
view = cv.MapView(theme="dark")
with open("./packages/three-cityjson/public/sample/daiba_sta.city.jsonl", "r") as f:
data = f.read()
view.layers = [
cv.CityJSONLayer(data=data, format="cityjsonseq")
]
view.update()
view
```

### Handling click events
```python
import cityview as cv
view = cv.VirtualView(theme="light")
with open("./packages/three-cityjson/public/sample/daiba_sta.city.jsonl", "r") as f:
data = f.read()
def handler(change):
print(change["new"])
view.observe(handler, names="click")
view.layers = [
cv.CityJSONLayer(data=data, format="cityjsonseq")
]
view.update()
view
```
## Roadmap
- [ ] Online viewer
## License
MIT
Raw data
{
"_id": null,
"home_page": "https://github.com/ozekik/cityview/",
"name": "cityview",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.9",
"maintainer_email": null,
"keywords": null,
"author": "Kentaro Ozeki",
"author_email": "32771324+ozekik@users.noreply.github.com",
"download_url": "https://files.pythonhosted.org/packages/9b/36/3f3c0d391e4391bd345b7d9ac9b8af925d97138268983b71a8a5658d4ab4/cityview-0.2.0.tar.gz",
"platform": null,
"description": "# CityView\n\n[](https://pypi.org/project/cityview/)\n[](https://www.npmjs.com/package/three-cityjson)\n\nCityJSON loader and renderer for three.js, react-three-fiber, and Jupyter Notebook / JupyterLab.\n\nSupports [CityJSON format](https://www.cityjson.org/) and [CityJSONSeq format](https://www.cityjson.org/cityjsonseq/).\n\n## Contents\n\n- [Packages](#packages)\n- [Installation](#installation)\n- [Usage](#usage)\n- [Roadmap](#roadmap)\n- [License](#license)\n\n## Packages\n\n| Package Name | Description |\n|----------------|-------------|\n| [cityview](https://github.com/ozekik/cityview) (top-level package) | Python package |\n| [three-cityjson](https://github.com/ozekik/cityview/tree/master/packages/three-cityjson) | JavaScript / TypeScript package |\n\n## Installation\n\n```bash\npip install cityview\n```\n\n## Usage\n\n### Basic usage\n\n#### VirtualView\n\n```python\nimport cityview as cv\n\nview = cv.VirtualView(theme=\"light\")\n\nwith open(\"./packages/three-cityjson/public/sample/daiba_sta.city.jsonl\", \"r\") as f:\n data = f.read()\n\nview.layers = [\n cv.CityJSONLayer(data=data, format=\"cityjsonseq\")\n]\n\nview.update()\n\nview\n```\n\n\n\n#### MapView\n\n```python\nimport cityview as cv\n\nview = cv.MapView(theme=\"dark\")\n\nwith open(\"./packages/three-cityjson/public/sample/daiba_sta.city.jsonl\", \"r\") as f:\n data = f.read()\n\nview.layers = [\n cv.CityJSONLayer(data=data, format=\"cityjsonseq\")\n]\n\nview.update()\n\nview\n```\n\n\n\n### Handling click events\n\n```python\nimport cityview as cv\n\nview = cv.VirtualView(theme=\"light\")\n\nwith open(\"./packages/three-cityjson/public/sample/daiba_sta.city.jsonl\", \"r\") as f:\n data = f.read()\n\ndef handler(change):\n print(change[\"new\"])\n\nview.observe(handler, names=\"click\")\n\nview.layers = [\n cv.CityJSONLayer(data=data, format=\"cityjsonseq\")\n]\n\nview.update()\n\nview\n```\n\n\n## Roadmap\n\n- [ ] Online viewer\n\n## License\n\nMIT\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "CityJSON renderer for Jupyter Notebook / JupyterLab",
"version": "0.2.0",
"project_urls": {
"Homepage": "https://github.com/ozekik/cityview/",
"Repository": "https://github.com/ozekik/cityview"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a9000c0f971b244b6a29cdc13872d01073860a0e6d2b0f8b854c0dc870518079",
"md5": "bdd7029df18f534775d5bcf602eb693f",
"sha256": "a6d1541ed12760331a9c14438e012ad24ff25c829c6c7595cc80355b75659a4c"
},
"downloads": -1,
"filename": "cityview-0.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "bdd7029df18f534775d5bcf602eb693f",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.9",
"size": 992316,
"upload_time": "2024-09-11T17:01:46",
"upload_time_iso_8601": "2024-09-11T17:01:46.099924Z",
"url": "https://files.pythonhosted.org/packages/a9/00/0c0f971b244b6a29cdc13872d01073860a0e6d2b0f8b854c0dc870518079/cityview-0.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "9b363f3c0d391e4391bd345b7d9ac9b8af925d97138268983b71a8a5658d4ab4",
"md5": "501911b5709a5c8b22b681808b5ef5f7",
"sha256": "abd30fe9bb521dda6af62e2326d45e7bf0a158ebe74b310c8c7936044ef024eb"
},
"downloads": -1,
"filename": "cityview-0.2.0.tar.gz",
"has_sig": false,
"md5_digest": "501911b5709a5c8b22b681808b5ef5f7",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.9",
"size": 988930,
"upload_time": "2024-09-11T17:01:48",
"upload_time_iso_8601": "2024-09-11T17:01:48.543249Z",
"url": "https://files.pythonhosted.org/packages/9b/36/3f3c0d391e4391bd345b7d9ac9b8af925d97138268983b71a8a5658d4ab4/cityview-0.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-11 17:01:48",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ozekik",
"github_project": "cityview",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "cityview"
}