Skip to content

Commit

Permalink
fixed mimeUri x Spatialite and Geopackage. fixes #16296
Browse files Browse the repository at this point in the history
  • Loading branch information
luipir committed Oct 3, 2017
1 parent 82dcc68 commit 378ab23
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion python/plugins/db_manager/db_plugins/gpkg/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
* *
***************************************************************************/
"""
import re

from builtins import str

# this will disable the dbplugin if the connector raise an ImportError
Expand Down Expand Up @@ -189,7 +191,7 @@ def ogrUri(self):
def mimeUri(self):

# QGIS has no provider to load Geopackage vectors, let's use OGR
return u"vector:ogr:%s:%s" % (self.name, self.ogrUri())
return u"vector:ogr:%s:%s" % (self.name, re.sub(":", "\:", self.ogrUri()))

def toMapLayer(self):
from qgis.core import QgsVectorLayer
Expand Down
6 changes: 4 additions & 2 deletions python/plugins/db_manager/db_plugins/spatialite/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
* *
***************************************************************************/
"""
import re

# this will disable the dbplugin if the connector raise an ImportError
from .connector import SpatiaLiteDBConnector
Expand Down Expand Up @@ -183,7 +184,8 @@ def ogrUri(self):
return ogrUri

def mimeUri(self):
return Table.mimeUri(self)
layerType = "raster" if self.type == Table.RasterType else "vector"
return u"%s:%s:%s:%s" % (layerType, self.database().dbplugin().providerName(), self.name, re.sub(":", "\:", self.uri().uri(False)))

def toMapLayer(self):
from qgis.core import QgsVectorLayer
Expand Down Expand Up @@ -268,7 +270,7 @@ def rasterliteGdalUri(self):

def mimeUri(self):
# QGIS has no provider to load rasters, let's use GDAL
uri = u"raster:gdal:%s:%s" % (self.name, self.uri().database())
uri = u"raster:gdal:%s:%s" % (self.name, re.sub(":", "\:", self.uri().database()))
return uri

def toMapLayer(self):
Expand Down

0 comments on commit 378ab23

Please sign in to comment.