Skip to main content

Visualizing the structure of high-dimensional urban features as a continuous perceptual color space

Project description

UrbanHue

Visualizing the structure of high-dimensional urban features as a continuous perceptual color field.

UrbanHue turns any high-dimensional description of urban places — street-view visual embeddings, POI text vectors, spatial-interaction representations, census features — into a continuous, perceptually uniform color field on a map. The color difference between two places reflects how similar their underlying features are: similar places get similar colors, dissimilar places get contrasting colors. Unlike discrete clustering, which can only express category membership, a continuous perceptual color field makes the degree of similarity directly visible in geographic space.

The method projects the N × D feature matrix to a 3D manifold (UMAP by default), then fits that manifold into the displayable CIELAB gamut by a seven-parameter rigid transformation with uniform scaling, following the U-CIE framework (Koutrouli et al., 2022). Geographic coordinates are used only to position points on the map — never to determine color.

Installation

pip install urbanhue

Optional extras:

pip install "urbanhue[basemap]"   # contextily, for OSM/Positron basemaps
pip install "urbanhue[gpu]"       # torch, for GPU-accelerated UMAP
pip install "urbanhue[all]"       # both

Requires Python ≥ 3.9.

Quickstart (Python API)

from urbanhue import UrbanHue

uh = UrbanHue(dr_method="umap", n_init=25, seed=42)
result = uh.fit_transform(features, coordinates)   # features: (N, D), coordinates: (N, 2)

result.plot_map(basemap=True, output="colorfield.png")
result.to_geodataframe().to_file("colors.gpkg")
print("clip_ratio:", result.clip_ratio)            # gamut-fit diagnostic (rho)

Quickstart (command line)

urbanhue points.parquet --feat_prefix emb_ --dr_method umap --n_init 25 --out_dir results/

Writes a per-point color CSV, a GeoPackage, a map preview, and a JSON record of all run parameters.

Reproducibility

The optimization landscape has multiple near-optimal minima related by rigid rotations, so absolute color assignment can vary across runs and hardware while preserving the internal similarity structure. To reproduce a specific figure exactly, archive the per-point color output:

result.save_colors("canonical_colors.csv")

Examples

The examples/ directory contains three runnable minimal scripts:

Script Modality
example_visual_embeddings.py street-view visual embeddings
example_spatial_interaction.py spatial-interaction representations per tract
example_multimodal.py combining visual + POI features

Interoperability

  • ZenSVI embedding CSVs can be used directly as input.
  • Exported GeoDataFrames work with QGIS, GeoPandas, and Folium.
  • Color fields overlay onto OSMnx street networks and OpenStreetMap basemaps.

Citation

If you use UrbanHue, please cite the paper (see CITATION.cff).

License

MIT — see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

urbanhue-0.1.0.tar.gz (15.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

urbanhue-0.1.0-py3-none-any.whl (16.6 kB view details)

Uploaded Python 3

File details

Details for the file urbanhue-0.1.0.tar.gz.

File metadata

  • Download URL: urbanhue-0.1.0.tar.gz
  • Upload date:
  • Size: 15.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for urbanhue-0.1.0.tar.gz
Algorithm Hash digest
SHA256 cf1a4217ec160c0fb79c9047d696b043fe2b98cda53f11b45c51dc61e67e561a
MD5 68b8f95ab808c7efcb3ade172c66ea07
BLAKE2b-256 8f3d53fb9f8245d887fb612aa4d1e887955b5089a0a7f0575c846091e0b03c1f

See more details on using hashes here.

File details

Details for the file urbanhue-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: urbanhue-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 16.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for urbanhue-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f0d7025be28051b92e3f908554dcb7fafc5fa1d602a502ecb0409b49b0122d09
MD5 20c57f2de49096f7b550f8f73c80ec6f
BLAKE2b-256 e55292d3a117ec859c164eddefa445a037c0f949a35b092fcca74dba02bd1828

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page