コード例 #1
0
 def connectToShapefile(self, parameters):
     """
     Stablishes connection to a Shapefile dataset.
     :param parameters: (dict) a dict containing all connection parameters.
     :return: (AbstractDb) returns the DSGTools database object.
     """
     abstractDb = DbFactory().createDbFactory(
         driver=DsgEnums.DriverShapefile)
     abstractDb.connectDatabase(conn=parameters['path'])
     return abstractDb if abstractDb.getDatabaseName() != '' else None
コード例 #2
0
 def connectToGeopackage(self, parameters):
     """
     Stablishes connection to a Geopackage database.
     :param parameters: (dict) a dict containing all connection parameters.
     :return: (AbstractDb) returns the DSGTools database object.
     """
     abstractDb = None
     if os.path.exists(parameters['path']):
         abstractDb = DbFactory().createDbFactory(
             driver=DsgEnums.DriverGeopackage)
         abstractDb.connectDatabase(conn=parameters['path'])
     return abstractDb
コード例 #3
0
 def connectToSpatialite(self, path):
     """
     Stablishes connection to a SpatiaLite database.
     :param path: (str) path to the SpatiaLite database.
     # :return: (QSqlDatabase) the database object.
     :return: (AbstracDb) DSGTools database object.
     """
     db = None
     if os.path.exists(path):
         db = DbFactory().createDbFactory(driver=DsgEnums.DriverSpatiaLite)
         db.connectDatabase(conn=path)
     return db