Moved numpy import helper to shortcuts
Numpy will be used in both the geos and gdal modules, so the import should sit in the parent module gis.
This commit is contained in:
parent
e215d325a8
commit
32ed4c202f
|
@ -12,12 +12,6 @@ except ImportError:
|
|||
HAS_GDAL = False
|
||||
gdal = GDALInfo()
|
||||
|
||||
# NumPy supported?
|
||||
try:
|
||||
import numpy
|
||||
except ImportError:
|
||||
numpy = False
|
||||
|
||||
|
||||
class GEOSBase(object):
|
||||
"""
|
||||
|
|
|
@ -6,9 +6,10 @@
|
|||
from ctypes import byref, c_double, c_uint
|
||||
|
||||
from django.contrib.gis.geos import prototypes as capi
|
||||
from django.contrib.gis.geos.base import GEOSBase, numpy
|
||||
from django.contrib.gis.geos.base import GEOSBase
|
||||
from django.contrib.gis.geos.error import GEOSException, GEOSIndexError
|
||||
from django.contrib.gis.geos.libgeos import CS_PTR
|
||||
from django.contrib.gis.shortcuts import numpy
|
||||
from django.utils.six.moves import range
|
||||
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
from django.contrib.gis.geos import prototypes as capi
|
||||
from django.contrib.gis.geos.base import numpy
|
||||
from django.contrib.gis.geos.coordseq import GEOSCoordSeq
|
||||
from django.contrib.gis.geos.error import GEOSException
|
||||
from django.contrib.gis.geos.geometry import GEOSGeometry
|
||||
from django.contrib.gis.geos.point import Point
|
||||
from django.contrib.gis.shortcuts import numpy
|
||||
from django.utils.six.moves import range
|
||||
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ from unittest import skipUnless
|
|||
|
||||
from django.contrib.gis.gdal import HAS_GDAL
|
||||
from django.contrib.gis.geometry.test_data import TestDataMixin
|
||||
from django.contrib.gis.shortcuts import numpy
|
||||
from django.utils import six
|
||||
from django.utils.encoding import force_bytes
|
||||
from django.utils.six.moves import range
|
||||
|
@ -20,7 +21,7 @@ if HAS_GEOS:
|
|||
from .. import (GEOSException, GEOSIndexError, GEOSGeometry,
|
||||
GeometryCollection, Point, MultiPoint, Polygon, MultiPolygon, LinearRing,
|
||||
LineString, MultiLineString, fromfile, fromstr, geos_version_info)
|
||||
from ..base import gdal, numpy, GEOSBase
|
||||
from ..base import gdal, GEOSBase
|
||||
|
||||
|
||||
@skipUnless(HAS_GEOS, "Geos is required.")
|
||||
|
|
|
@ -5,6 +5,12 @@ from django.conf import settings
|
|||
from django.http import HttpResponse
|
||||
from django.template import loader
|
||||
|
||||
# NumPy supported?
|
||||
try:
|
||||
import numpy
|
||||
except ImportError:
|
||||
numpy = False
|
||||
|
||||
|
||||
def compress_kml(kml):
|
||||
"Returns compressed KMZ from the given KML string."
|
||||
|
|
Loading…
Reference in New Issue