2013-05-11 11:08:45 +08:00
|
|
|
def geo_apps():
|
2010-12-02 13:58:21 +08:00
|
|
|
"""
|
|
|
|
Returns a list of GeoDjango test applications that reside in
|
|
|
|
`django.contrib.gis.tests` that can be used with the current
|
|
|
|
database and the spatial libraries that are installed.
|
|
|
|
"""
|
|
|
|
from django.db import connection
|
|
|
|
from django.contrib.gis.geos import GEOS_PREPARE
|
|
|
|
from django.contrib.gis.gdal import HAS_GDAL
|
2010-10-11 20:20:07 +08:00
|
|
|
|
2010-12-02 13:58:21 +08:00
|
|
|
apps = ['geoapp', 'relatedapp']
|
2010-09-12 09:40:42 +08:00
|
|
|
|
2010-12-02 13:58:21 +08:00
|
|
|
# No distance queries on MySQL.
|
|
|
|
if not connection.ops.mysql:
|
|
|
|
apps.append('distapp')
|
|
|
|
|
|
|
|
# Test geography support with PostGIS 1.5+.
|
|
|
|
if connection.ops.postgis and connection.ops.geography:
|
|
|
|
apps.append('geogapp')
|
|
|
|
|
|
|
|
# The following GeoDjango test apps depend on GDAL support.
|
|
|
|
if HAS_GDAL:
|
2011-09-18 03:54:52 +08:00
|
|
|
# Geographic admin, LayerMapping, and ogrinspect test apps
|
|
|
|
# all require GDAL.
|
|
|
|
apps.extend(['geoadmin', 'layermap', 'inspectapp'])
|
2011-09-10 11:04:30 +08:00
|
|
|
|
2011-09-18 03:54:52 +08:00
|
|
|
# 3D apps use LayerMapping, which uses GDAL and require GEOS 3.1+.
|
2010-12-02 13:58:21 +08:00
|
|
|
if connection.ops.postgis and GEOS_PREPARE:
|
|
|
|
apps.append('geo3d')
|
2013-05-11 11:08:45 +08:00
|
|
|
return [('django.contrib.gis.tests', app) for app in apps]
|