Commit 32ed4c20 authored by Daniel Wiesmann's avatar Daniel Wiesmann Committed by Claude Paroz
Browse files

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.
parent e215d325
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -12,12 +12,6 @@ except ImportError:
        HAS_GDAL = False
    gdal = GDALInfo()

# NumPy supported?
try:
    import numpy
except ImportError:
    numpy = False


class GEOSBase(object):
    """
+2 −1
Original line number Diff line number Diff line
@@ -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 −1
Original line number Diff line number Diff line
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


+2 −1
Original line number Diff line number Diff line
@@ -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.")
+6 −0
Original line number Diff line number Diff line
@@ -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."