Skip to content

Enhance options for morphological_graph()#178

Merged
yu-ta-sato merged 2 commits into
c2g-dev:mainfrom
yu-ta-sato:enh/allow_param_tweaking_for_morpho_graph
Jul 1, 2026
Merged

Enhance options for morphological_graph()#178
yu-ta-sato merged 2 commits into
c2g-dev:mainfrom
yu-ta-sato:enh/allow_param_tweaking_for_morpho_graph

Conversation

@yu-ta-sato

Copy link
Copy Markdown
Collaborator

Description

This PR adds three new optional parameters to morphological_graph() to make it more configurable, without changing default behaviour:

  • non_movement_barrier_col (str | None, default None): flags a boolean column in segments_gdf marking rows that should act as barriers only. Flagged segments still shape the tessellation barriers (clipped to the same radius as the buffered movement network), but are excluded from the movement nodes, the movement-to-movement graph, and the network-distance computation. This is orthogonal to primary_barrier_col, which substitutes geometry for a segment without ever removing it from the movement layer — the new option decides whether a row becomes a movement node at all.

  • tessellation_fallback (bool, default False): when enabled, falls back to using reachable building footprints directly as place cells if the enclosed tessellation encloses no area (momepy raises "No objects to concatenate") or otherwise yields no cells despite reachable buildings/segments being available. Fallback cells go through the same reachability-budget filtering (network distance + extent_buffer access cap) as the primary path, so retention rules stay consistent. With the flag off, behaviour is unchanged and the underlying error still propagates.

  • tessellation_n_jobs (int, default -1): forwards the number of parallel jobs to create_tessellation / momepy.enclosed_tessellation. Useful for setting it to 1 to run serially and avoid oversubscription when morphological_graph() is itself invoked from within an outer parallel loop (e.g. batched processing over many centre points).

Related Issues

NA

Checklist

  • I have read the [Contributing Guide](https.city2graph.net/contributing.html).
  • have updated the documentation, if necessary.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • Pre-commit checks passed locally.

@yu-ta-sato yu-ta-sato merged commit 9fa27b6 into c2g-dev:main Jul 1, 2026
6 checks passed
@yu-ta-sato yu-ta-sato deleted the enh/allow_param_tweaking_for_morpho_graph branch July 1, 2026 03:14
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