Skip to content

Class-based API#171

Open
songololo wants to merge 26 commits intomasterfrom
dev
Open

Class-based API#171
songololo wants to merge 26 commits intomasterfrom
dev

Conversation

@songololo
Copy link
Copy Markdown
Collaborator

@songololo songololo commented Mar 10, 2026

Class based API

songololo and others added 3 commits March 10, 2026 20:49
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…h fixes

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 10, 2026

Visit the preview URL for this PR (updated for commit 01f7ad8):

https://cityseer-api-docs--pr171-dev-261fq41a.web.app

(expires Thu, 09 Apr 2026 17:57:04 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 470ca74c3557f8695e6e641c5f19c203859880a1

songololo and others added 21 commits March 10, 2026 23:48
Accept either "geometry" or "geom" edge attributes in from_nx, and
return the original graph structure (with cc_ columns added) from
to_nx when the network was built via from_nx.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Pulls centrality accumulation fixes from master:
- Source-based accumulation when not sampling (prevents edge roll-off)
- Target-based with dead buffer sources when sampling
- Directional Dijkstra (downstream/upstream) matching accumulation mode
- Dead-to-dead betweenness exclusion and dead target skip for closeness

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adds directed (one-way) routing via CityNetwork.from_geopandas(directed=True)
with a boolean oneway column, CityNetwork.from_nx() auto-detecting MultiDiGraph,
and io.network_structure_from_nx() for the low-level API. Each directed edge
becomes its own dual node marked one-way in its coordinate direction.

The Rust Dijkstra already follows Direction::Outgoing, so no algorithm changes
are needed — directionality is controlled entirely by which edges the Python-side
graph construction adds. The graphs module simplification pipeline remains
undirected-only; from_osm uses that pipeline and stays undirected.

Includes strict oneway column validation (rejects NaN, non-boolean), directed
update() that rebuilds directions from incoming GeoDataFrame, to_nx() raising
NotImplementedError for directed networks without a source graph, save/load
roundtrip, and 16 new tests.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- New `decay_fn` parameter (expression string using variable `p`) replaces
  `betas`, `min_threshold_wt`, and `spatial_tolerance` on centrality,
  accessibility, mixed-use, and stats functions
- New `cityseer.decay` module with helpers: exponential, linear, flat,
  gaussian, logistic
- Rename node_beta → node_decay, node_betweenness_beta → node_betweenness_decay
- Unify weighted/unweighted metrics into single decay-controlled output
  (remove _wt/_nw column suffixes)
- Add meval crate for Rust-side expression parsing
- Update QGIS plugin for new API (centrality, accessibility, stats)
- Add comprehensive docs: decay functions, column naming conventions,
  output reference tables, CityNetwork examples
- Segment centrality retains old betas API (analytical integral)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…oss-links

- New /guide page: installation, core concepts, CityNetwork API, centrality,
  decay functions, land-use analysis, directed graphs, elevation, column naming,
  performance guidance, adaptive sampling — with cross-links to 20+ cityseer-examples
  recipe notebooks
- Trim intro.md to focused landing page (321 → 48 lines), pointing to guide
- Add /guide to navigation sidebar
- Add module docstrings to layers.py and network.py
- Add examples to node_centrality_shortest, node_centrality_simplest,
  nx_remove_filler_nodes
- Add cityseer-examples cross-links to compute_accessibilities, compute_mixed_uses,
  compute_stats, street_continuity, CityNetwork class
- Fix broken links: /config#build-od-matrix, /guide#graph-cleaning
- Fix incomplete docstring line in layers.py build_data_map

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Fix "composes with" → "is applied on top of" (elevation section)
- Tighten street continuity description
- Replace "unbiased" with precise statistical language in sampling section
- Note that both centrality_shortest and centrality_simplest support sampling

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Page <title> now shows "cityseer — network" instead of just "/api/network"
- Add og:title, og:type, og:url meta tags for social sharing
- robots.txt and sitemap already in place

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
SEO improvements:
- Per-page meta descriptions for all 20 documentation pages
- Open Graph tags (og:title, og:description, og:type, og:url, og:image,
  og:site_name, og:locale) on every page
- Twitter Card tags (summary card with image) on every page
- JSON-LD structured data (SoftwareApplication schema) on every page
- Canonical URLs on every page
- Descriptive page titles ("cityseer — guide" not just "/guide")
- Fix EPSG codes being eaten by remark-directive (use backtick formatting)

Astro 5 config cleanup:
- Remove deprecated markdown.drafts option (removed in Astro 3)
- Remove redundant remarkGfm plugin (built-in since Astro 5)
- Add markdown.smartypants: false to prevent double-processing with
  remark-smartypants plugin (which uses custom dash options)
- Add markdown.gfm: true for clarity

Dependency cleanup:
- Remove @astrojs/markdown-component (dead code, Astro 1.x migration aid)
- Remove autoprefixer (unused, Tailwind v4 handles prefixing)
- Remove pug-plain-loader (Webpack-era vestige, Vite uses pug directly)
- Add @astrojs/check and typescript (required for astro check script)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ity functions

Replace the separate segment_centrality code path (edge-based continuous
integrals, dedicated Dijkstra, CentralitySegmentResult) with a
segment_weighted boolean on the existing centrality functions. On dual
graphs, this sets node weights to primal edge lengths so that closeness
measures reflect total reachable street length and betweenness weights
pairs by both endpoint segment lengths.

- Rename node_centrality_shortest → centrality_shortest
- Rename node_centrality_simplest → centrality_simplest
- Add segment_weighted param (Rust + Python) with _SegmentWeightContext
- Add set_node_weight method on NetworkStructure
- Replace pair_distances_betas_time with pair_distances_and_time
- Clean up betas machinery from Python callers and log_thresholds
- Remove dead code: EdgeVisit, dijkstra_tree_segment, origin_seg/last_seg,
  unchecked edge helpers, CentralitySegmentResult
- Update all docs, tests, type stubs, and references

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace boolean flags (compute_closeness, compute_betweenness) and hardcoded
metric accumulation with user-defined {name: expression} dicts evaluated via
meval. Centrality metrics are now specified using variables c (cost) and
p (normalised progress), making them user-extensible without Rust changes.

- Add validate_metric_expr/parse_metric_expr using meval bind2("c", "p")
- Replace 3 result types with generic CentralityResult with metrics dict
- Generalise brandes_backprop from 2 fixed channels to N
- Remove decay_fn, angular_scaling_unit, farness_scaling_offset params
- Add safe AST-based postprocess evaluator (no eval())
- Update QGIS plugin for new API
- 4.25.0b13

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant