Example #1
0
 def export_layers(self):
     items = self.layers_selectbox.curselection()
     items = [self.layernames[item] for item in items]
     exporter = Exporter(get_output_filename())
     try:
         for item in items:
             exporter.append_xml(self.layer_conf.register[item])
         exporter.export()
         SuccesView()
     except:
         ErrorView(sys.exc_info()[0])
                    required=True
                   )
parser.add_argument(
                    '-t',
                    metavar='TYPE',
                    help='Type of dibe object', 
                    dest='dibe_type',
                    required=True
                   )
parser.add_argument(
                     '-i',
                     metavar='ID_FIELD',
                     help='Fieldname of the field containing the identifiers \
                                                         of the dibe-objects',
                     dest='dibe_id_fieldname',
                     required=True
                    )  
args = parser.parse_args()

for shapefile in glob.glob(os.path.join(args.datafolder,"*.shp")):
    layer = Layer(
                  args.dibe_type , 
                  os.path.basename(shapefile),
                  args.dibe_id_fieldname,
                  shapefile
                 )
    exporter = Exporter(get_output_filename())                                            
    exporter.append_xml(layer)                                                  
    exporter.export()