Example #1
0
 def getDataFromLayer(self, layer):
     '''
     Returns the data corresponding to a given layer, ready to be passed to the
     method in the Catalog class for uploading to the server.
     If needed, it performs an export to ensure that the file format is supported
     by the upload API to be used for import. In that case, the data returned
     will point to the exported copy of the data, not the original data source
     '''
     if layer.type() == layer.RasterLayer:
         data = exporter.exportRasterLayer(layer)
     else:
         filename = exporter.exportVectorLayer(layer)
         basename, extension = os.path.splitext(filename)
         data = {
             'shp': basename + '.shp',
             'shx': basename + '.shx',
             'dbf': basename + '.dbf',
             'prj': basename + '.prj'
         }
     return data
Example #2
0
 def getDataFromLayer(self, layer):
     '''
     Returns the data corresponding to a given layer, ready to be passed to the
     method in the Catalog class for uploading to the server.
     If needed, it performs an export to ensure that the file format is supported
     by the upload API to be used for import. In that case, the data returned
     will point to the exported copy of the data, not the original data source
     '''
     if layer.type() == layer.RasterLayer:
         data = exporter.exportRasterLayer(layer)
     else:
         filename = exporter.exportVectorLayer(layer)
         basename, extension = os.path.splitext(filename)
         data = {
             'shp': basename + '.shp',
             'shx': basename + '.shx',
             'dbf': basename + '.dbf',
             'prj': basename + '.prj'
         }
     return data