Source: https://gometry.monicz.dev/ecosystem/visualization/

# Notebooks & visualization

Every core gometry type renders a rich, theme-adaptive HTML or SVG preview in
Jupyter with no optional dependencies. Install `gometry[viz]` to add interactive
[lonboard](https://developmentseed.org/lonboard/) maps.

## Built-in notebook previews

In Jupyter and other IPython frontends, gometry objects render automatically via
`_repr_html_` and `_repr_svg_`. Styling adapts to light and dark notebook themes,
and large inputs are bounded so previews stay responsive:

| Type | Notebook preview |
| --- | --- |
| [`Geometry`](https://gometry.monicz.dev/api/geometry/#gometry.Geometry "Geometry") | Inline SVG preview with geometry type, CRS, and bounds summary (complex shapes are downsampled for display) |
| [`GeometryArray`](https://gometry.monicz.dev/api/geometry-array/#gometry.GeometryArray "GeometryArray") | Interactive lonboard map when `gometry[viz]` is installed and the CRS can be displayed in WGS 84; otherwise a capped SVG thumbnail grid |
| [`CRS`](https://gometry.monicz.dev/api/crs/#gometry.CRS "CRS") | Structured authority, axis, and unit summary card |
| [`Feature`](https://gometry.monicz.dev/api/features/#gometry.Feature "Feature"), [`Features`](https://gometry.monicz.dev/api/features/#gometry.Features "Features") | Geometry SVG preview alongside feature ID and properties table |
| [`H3Cell`](https://gometry.monicz.dev/api/h3/#gometry.H3Cell "H3Cell"), [`S2Cell`](https://gometry.monicz.dev/api/s2/#gometry.S2Cell "S2Cell"), [`GeohashCell`](https://gometry.monicz.dev/api/geohash/#gometry.GeohashCell "GeohashCell"), [`Tile`](https://gometry.monicz.dev/api/tiles/#gometry.Tile "Tile"), [`CellArray`](https://gometry.monicz.dev/api/grids/#gometry.CellArray "CellArray") | Cell metadata and inline polygon SVG preview (capped grid for arrays) |
| [`SpatialIndex`](https://gometry.monicz.dev/api/spatial-index/#gometry.SpatialIndex "SpatialIndex") | Index size, CRS, and spatial extent card |
| [`ListArray`](https://gometry.monicz.dev/api/coordinates/#gometry.ListArray "ListArray") | Row count, total elements, and sample row lengths |

Representative notebook outputs rendered directly from gometry's `_repr_html_`:

**GeometryArray**

partial: notebook cell

```python
import gometry as gm

wgs84 = gm.Space(crs=4326)
arr = gm.GeometryArray([
    gm.box(0, 0, 2, 2, space=wgs84),
    gm.Point(1, 1, space=wgs84).buffer(10_000),
    gm.LineString([(0, 0), (1, 2), (2, 0)], space=wgs84),
    gm.Polygon([(0, 0), (2, 0), (1, 2)], space=wgs84),
], space=wgs84)
arr
```

4 geometries

**Features**

partial: notebook cell

```python
import gometry as gm

features = gm.from_geojson('''
{"type":"FeatureCollection","features":[
  {"type":"Feature","id":"eiffel","properties":{"name":"Eiffel Tower","kind":"landmark"},
   "geometry":{"type":"Point","coordinates":[2.2945,48.8584]}},
  {"type":"Feature","id":"champ","properties":{"name":"Champ-de-Mars","kind":"park"},
   "geometry":{"type":"Polygon","coordinates":[[[2.290,48.855],[2.296,48.855],[2.296,48.858],[2.290,48.858],[2.290,48.855]]]}}
]}
''', crs=4326)
features
```

2 features · EPSG:4326

| # | geometry | id | kind | name |
| --- | --- | --- | --- | --- |
| 0 |  | 'eiffel' | 'landmark' | 'Eiffel Tower' |
| 1 |  | 'champ' | 'park' | 'Champ-de-Mars' |

**CellArray**

partial: notebook cell

```python
import gometry as gm

station = gm.Point(2.2945, 48.8584, space=gm.Space(crs=4326))
cells = gm.h3_cover(station.buffer(500), resolution=10)
cells
```

<CellArray[H3Cell] len=76> (showing first 12)

**CRS & SpatialIndex**

partial: notebook cell

```python
import gometry as gm

crs = gm.CRS(4326)
idx = gm.SpatialIndex(gm.points([2.29, 2.31, 2.35], [48.85, 48.86, 48.87], space=gm.Space(crs=crs)))
crs, idx
```

|  |  |
| --- | --- |
| CRS | EPSG:4326 |
| Name | WGS 84 |
| Authority | EPSG:4326 |
| Type | geographic\_2d |
| Datum | World Geodetic System 1984 ensemble |
| Area of use | World. (-180.0000, -90.0000, 180.0000, 90.0000) |
| Axes | Lat (north, degree), Lon (east, degree) |

<SpatialIndex len=3 crs=EPSG:4326>

|  |  |
| --- | --- |
| Live geometries | 3 |
| CRS | EPSG:4326 |
| Bounds | (2.2900, 48.8500, 2.3500, 48.8700) |

To force the lightweight SVG grid for a `GeometryArray` even when lonboard is
installed, call `_repr_html_svg()`.

## Interactive maps with `gm.explore()`

Install `gometry[viz]` to enable interactive maps:

**uv**

```bash
uv add "gometry[viz]"
```

**pip**

```bash
pip install "gometry[viz]"
```

[`gm.explore`](https://gometry.monicz.dev/api/interop/#gometry.explore "explore") accepts a [`Geometry`](https://gometry.monicz.dev/api/geometry/#gometry.Geometry "Geometry"),
[`GeometryArray`](https://gometry.monicz.dev/api/geometry-array/#gometry.GeometryArray "GeometryArray"), [`Features`](https://gometry.monicz.dev/api/features/#gometry.Features "Features"),
scalar [`Cell`](https://gometry.monicz.dev/api/grids/#gometry.Cell "Cell"), or [`CellArray`](https://gometry.monicz.dev/api/grids/#gometry.CellArray "CellArray") and hands it
to lonboard through the Arrow PyCapsule interface. Inputs need a CRS and finite
bounds; cells and cell arrays convert to their WGS 84 polygons automatically.

partial: requires gometry[viz]

```python
import gometry as gm

station = gm.Point(2.2945, 48.8584, space=gm.Space(crs=4326))
cells = gm.h3_cover(station.buffer(500), resolution=10)

gm.explore(
    cells,
    polygon_kwargs={"get_fill_color": [15, 118, 110, 120]},
)
```

By default, `explore()` renders points, lines, and polygons distinctly with
hover inspection. Pass lonboard's `scatterplot_kwargs`, `path_kwargs`,
`polygon_kwargs`, or `map_kwargs` to customize styling.

WGS 84 display reprojection and automatic fallback

lonboard expects WGS 84 longitude/latitude display coordinates.
`gm.explore()` and `GeometryArray._repr_html_` reproject projected and
non-WGS 84 geographic frames toward EPSG:4326 for display. If an array has
no CRS, cannot be reprojected, or exceeds the automatic preview size cap,
`GeometryArray._repr_html_` falls back to the SVG grid automatically.

## See also

- [Arrow & storage](https://gometry.monicz.dev/ecosystem/arrow/) — Arrow PyCapsules used to feed lonboard.
- [Arrays & performance](https://gometry.monicz.dev/guide/arrays/) — vectorized array workflows.
- [Grids & geocodes](https://gometry.monicz.dev/guide/grids/) — H3, S2, Geohash, and XYZ tile cells.
