diff --git a/large_image/tilesource/__init__.py b/large_image/tilesource/__init__.py index 8fb2a7895..1c5f86dfd 100644 --- a/large_image/tilesource/__init__.py +++ b/large_image/tilesource/__init__.py @@ -82,7 +82,7 @@ def getSourceNameFromDict(availableSources, pathOrUri, *args, **kwargs): isLargeImageUri = str(pathOrUri).startswith('large_image://') extensions = [ext.lower() for ext in os.path.basename(uriWithoutProtocol).split('.')[1:]] properties = { - 'geospatial': isGeospatial(pathOrUri), + '_geospatial_source': isGeospatial(pathOrUri), } sourceList = [] for sourceName in availableSources: diff --git a/large_image/tilesource/base.py b/large_image/tilesource/base.py index 72d2a2635..a55c89a80 100644 --- a/large_image/tilesource/base.py +++ b/large_image/tilesource/base.py @@ -44,6 +44,8 @@ class TileSource: None: SourcePriority.FALLBACK } + geospatial = False + def __init__(self, encoding='JPEG', jpegQuality=95, jpegSubsampling=0, tiffCompression='raw', edge=False, style=None, *args, **kwargs): diff --git a/sources/gdal/large_image_source_gdal/__init__.py b/sources/gdal/large_image_source_gdal/__init__.py index c3aa721b0..98b123ada 100644 --- a/sources/gdal/large_image_source_gdal/__init__.py +++ b/sources/gdal/large_image_source_gdal/__init__.py @@ -115,7 +115,7 @@ class GDALFileTileSource(FileTileSource, metaclass=LruCacheMetaclass): 'image/tiff': SourcePriority.LOW, 'image/x-tiff': SourcePriority.LOW, } - geospatial = True + _geospatial_source = True def __init__(self, path, projection=None, unitsPerPixel=None, **kwargs): """ @@ -601,14 +601,21 @@ def getBandInformation(self, statistics=True, dataset=None, **kwargs): self._bandInfo = infoSet return self._bandInfo + @property + def geospatial(self): + """ + This is true if the source has geospatial information. + """ + return bool( + self.dataset.GetProjection() or + (self.dataset.GetGCPProjection() and self.dataset.GetGCPs()) or + self.dataset.GetGeoTransform(can_return_null=True) or + hasattr(self, '_netcdf')) + def getMetadata(self): with self._getDatasetLock: metadata = { - 'geospatial': bool( - self.dataset.GetProjection() or - (self.dataset.GetGCPProjection() and self.dataset.GetGCPs()) or - self.dataset.GetGeoTransform(can_return_null=True) or - hasattr(self, '_netcdf')), + 'geospatial': self.geospatial, 'levels': self.levels, 'sizeX': self.sizeX, 'sizeY': self.sizeY, diff --git a/sources/mapnik/large_image_source_mapnik/__init__.py b/sources/mapnik/large_image_source_mapnik/__init__.py index 5a382d672..5852f803b 100644 --- a/sources/mapnik/large_image_source_mapnik/__init__.py +++ b/sources/mapnik/large_image_source_mapnik/__init__.py @@ -71,7 +71,6 @@ class MapnikFileTileSource(GDALFileTileSource, metaclass=LruCacheMetaclass): 'image/tiff': SourcePriority.LOWER, 'image/x-tiff': SourcePriority.LOWER, } - geospatial = True def __init__(self, path, projection=None, unitsPerPixel=None, **kwargs): """