diff --git a/src/c3nav/mapdata/utils/geometry.py b/src/c3nav/mapdata/utils/geometry.py index 6f06faf2..e33a8c9d 100644 --- a/src/c3nav/mapdata/utils/geometry.py +++ b/src/c3nav/mapdata/utils/geometry.py @@ -1,6 +1,7 @@ from itertools import chain import matplotlib.pyplot as plt +from django.core import checks from matplotlib.patches import PathPatch from matplotlib.path import Path from shapely import speedups @@ -10,6 +11,20 @@ if speedups.available: speedups.enable() +@checks.register() +def check_svg_renderer(app_configs, **kwargs): + errors = [] + if not speedups.available: + errors.append( + checks.Warning( + 'Your shapely version does not have speedups enabled. This will significantly slow down c3nav!', + obj='rtree.index.Index', + id='c3nav.mapdata.W001', + ) + ) + return errors + + def clean_geometry(geometry): """ if the given geometry is a Polygon and invalid, try to make it valid if it results in a Polygon (not MultiPolygon) diff --git a/src/c3nav/mapdata/utils/index.py b/src/c3nav/mapdata/utils/index.py index b4bd810d..e0bea2b6 100644 --- a/src/c3nav/mapdata/utils/index.py +++ b/src/c3nav/mapdata/utils/index.py @@ -62,9 +62,9 @@ def check_svg_renderer(app_configs, **kwargs): if not rtree_index: errors.append( checks.Warning( - 'The libspatialindex_c library is missing. This will drastically slow down c3nav rendering.', + 'The libspatialindex_c library is missing. This will slow down c3nav in future versions.', obj='rtree.index.Index', - id='c3nav.mapdata.W001', + id='c3nav.mapdata.W002', ) ) return errors