warn during system check it shapely speedups are not available
This commit is contained in:
parent
49bc5f013d
commit
5ede164761
2 changed files with 17 additions and 2 deletions
|
@ -1,6 +1,7 @@
|
||||||
from itertools import chain
|
from itertools import chain
|
||||||
|
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
|
from django.core import checks
|
||||||
from matplotlib.patches import PathPatch
|
from matplotlib.patches import PathPatch
|
||||||
from matplotlib.path import Path
|
from matplotlib.path import Path
|
||||||
from shapely import speedups
|
from shapely import speedups
|
||||||
|
@ -10,6 +11,20 @@ if speedups.available:
|
||||||
speedups.enable()
|
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):
|
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)
|
if the given geometry is a Polygon and invalid, try to make it valid if it results in a Polygon (not MultiPolygon)
|
||||||
|
|
|
@ -62,9 +62,9 @@ def check_svg_renderer(app_configs, **kwargs):
|
||||||
if not rtree_index:
|
if not rtree_index:
|
||||||
errors.append(
|
errors.append(
|
||||||
checks.Warning(
|
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',
|
obj='rtree.index.Index',
|
||||||
id='c3nav.mapdata.W001',
|
id='c3nav.mapdata.W002',
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
return errors
|
return errors
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue