本文整理匯總了Python中importer.Importer.importLayer方法的典型用法代碼示例。如果您正苦於以下問題:Python Importer.importLayer方法的具體用法?Python Importer.importLayer怎麽用?Python Importer.importLayer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類importer.Importer
的用法示例。
在下文中一共展示了Importer.importLayer方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: len
# 需要導入模塊: from importer import Importer [as 別名]
# 或者: from importer.Importer import importLayer [as 別名]
else:
dataset = os.path.basename(os.path.normpath(folder)).lower()
for s in glob.glob(os.path.join(folder, 'layer', '*.shp')):
layers.append({'dataset': dataset, 'layer': s})
for s in glob.glob(os.path.join(folder, 'table', '*.dbf')):
layers.append({'dataset': dataset, 'layer': s})
if len(layers) == 0:
for d in [name for name in os.listdir(folder)
if os.path.isdir(os.path.join(folder, name))]:
for s in glob.glob(os.path.join(folder, d, 'layer', '*.shp')):
layers.append({'dataset': d.lower(), 'layer': s})
for s in glob.glob(os.path.join(folder, d, 'table', '*.dbf')):
layers.append({'dataset': d.lower(), 'layer': s})
print "\nLayers to be processed are:"
for l in layers:
print '{}: {}'.format(l['dataset'], l['layer'])
i = Importer(Database())
i.recreate = recreate
i.skip_shape_import = skip_shape_import
i.setupDatabase()
for idx, l in enumerate(layers):
print "\n\nImporting {}/{}: {}\n-------------".format(idx + 1, len(layers), l['layer'])
path, file = os.path.split(l['layer'])
layer = file[:-4]
i.importLayer(l['layer'], l['dataset'], layer)