Metadata-Version: 2.1
Name: cityview
Version: 0.2.0
Summary: CityJSON renderer for Jupyter Notebook / JupyterLab
Home-page: https://github.com/ozekik/cityview/
License: MIT
Author: Kentaro Ozeki
Author-email: 32771324+ozekik@users.noreply.github.com
Requires-Python: >=3.9,<4.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Dist: anywidget[dev] (>=0.9.13,<0.10.0)
Project-URL: Repository, https://github.com/ozekik/cityview
Description-Content-Type: text/markdown

# CityView

[![PyPI](https://img.shields.io/pypi/v/cityview.svg)](https://pypi.org/project/cityview/)
[![npm](https://img.shields.io/npm/v/three-cityjson)](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
```

![VirtualView](./assets/virtualview-light-sshot_01.png)

#### 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
```

![VirtualView](./assets/mapview-dark-sshot_01.png)

### 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

