File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed
python/plugins/processing/algs/gdal Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change 25
25
26
26
__revision__ = '$Format:%H$'
27
27
28
- import string
29
28
import re
29
+ import os
30
30
31
31
try :
32
32
from osgeo import ogr
36
36
37
37
from PyQt4 .QtCore import *
38
38
from PyQt4 .QtGui import *
39
+
39
40
from qgis .core import *
40
41
41
42
from processing .algs .gdal .GdalAlgorithm import GdalAlgorithm
@@ -66,3 +67,21 @@ def ogrConnectionString(self, uri):
66
67
else :
67
68
ogrstr = unicode (layer .source ())
68
69
return ogrstr
70
+
71
+ def ogrLayerName (self , uri ):
72
+ layerName = None
73
+
74
+ if 'host' in uri :
75
+ regex = re .compile ('(table=")(.+?)(\.")(.+?)"' )
76
+ r = regex .search (uri )
77
+ return r .groups ()[1 ] + '.' + r .groups ()[3 ]
78
+ elif 'dbname' in uri :
79
+ regex = re .compile ('(table=")(.+?)"' )
80
+ r = regex .search (uri )
81
+ return r .groups ()[1 ]
82
+ elif 'layername' in uri :
83
+ regex = re .compile ('(layername=)(.*)' )
84
+ r = regex .search (uri )
85
+ return r .groups ()[1 ]
86
+ else :
87
+ return os .path .basename (os .path .splitext (uri )[0 ])
You can’t perform that action at this time.
0 commit comments