Troubleshooting¶
X must be a geopandas.GeoDataFrame¶
Convert a pandas DataFrame and select its geometry column:
Missing cost column¶
Either configure the correct column:
or pass the costs as y:
Disconnected components¶
SpatialDeform does not invent target distances between disconnected networks. Split components and fit them separately, or add meaningful connector edges. Do not add a tiny arbitrary edge purely to silence the validation; it will dominate shortest paths and distort the result.
Geographic CRS rejected¶
The optimizer needs planar coordinates. Keep auto_project=True, or project
explicitly:
edges = edges.to_crs(edges.estimate_utm_crs())
model = SpatialDeformer(auto_project=False).fit(edges)
Lines that should meet become separated¶
When endpoint IDs are inferred, inspect the rounded coordinates:
If reducing precision joins unrelated nodes, repair topology instead of reducing it further.
Distortion is too weak¶
- decrease
geo_weight; - use a fixed
scalederived from a reference scenario; - confirm costs actually vary across the network;
- inspect
graph_distances_rather than only edge costs.
Distortion is too strong¶
- increase
geo_weight; - use Gaussian spatial weights;
- increase
spatial_bandwidthgradually; - inspect extreme costs and disconnected-looking bottlenecks.
Uniform slowdown does not expand the map¶
This is expected when every scenario independently uses scale="auto". Fit a
reference state once and reuse its scale_ for every comparison state.
Installation starts compiling geospatial dependencies¶
Use a supported Python version and update pip. On unusual architectures, use a distribution that provides GeoPandas and SciPy binaries or install through conda-forge before installing SpatialDeform.
Reporting a problem¶
Include:
- SpatialDeform and Python versions;
- GeoPandas, Shapely, NumPy, SciPy, and scikit-learn versions;
- CRS and geometry types;
- whether topology uses columns or endpoint inference;
- the complete exception traceback;
- a minimal, non-sensitive reproducer if possible.
Open an issue in the GitHub repository.