Beispiel #1
0
 def addfield(self, fieldname, dtype, values=None):
     dt = TableUtil.toDataTypes(dtype)
     self.layer.editAddField(fieldname, dt)
     if not values is None:
         n = self.shapenum()
         for i in range(n):
             if i < len(values):
                 self.layer.editCellValue(fieldname, i, values[i])
Beispiel #2
0
 def addfield(self, fieldname, dtype, values=None):
     dt = TableUtil.toDataTypes(dtype)
     self.layer.editAddField(fieldname, dt)
     if not values is None:
         n = self.shapenum()
         for i in range(n):
             if i < len(values):
                 self.layer.editCellValue(fieldname, i, values[i])
Beispiel #3
0
 def addcol(self, colname, dtype, index=None):
     '''
     Add an emtpy column.
     
     :param colname: (*string*) The new column name.
     :param dtype: (*string*) The data type. [string | int | float].
     :param index: (*int*) The order index of the column to be added. Default is ``None``, the
         column will be added as last column.
     '''
     dtype = TableUtil.toDataTypes(dtype)
     if index is None:
         self.data.addColumn(colname, dtype)
     else:
         self.data.addColumn(index, colname, dtype)
Beispiel #4
0
 def addcol(self, colname, dtype, index=None):
     '''
     Add an emtpy column.
     
     :param colname: (*string*) The new column name.
     :param dtype: (*string*) The data type. [string | int | float].
     :param index: (*int*) The order index of the column to be added. Default is ``None``, the
         column will be added as last column.
     '''
     dtype = TableUtil.toDataTypes(dtype)
     if index is None:
         self.data.addColumn(colname, dtype)
     else:
         self.data.addColumn(index, colname, dtype)
Beispiel #5
0
 def addfield(self, fieldname, dtype, values=None):
     '''
     Add a field into the attribute table.
     
     :param fieldname: (*string*) Field name.
     :param dtype: (*string*) Field data type [string | int | float | double].
     :param values: (*array_like*) Field values.
     '''
     dt = TableUtil.toDataTypes(dtype)
     self.layer.editAddField(fieldname, dt)
     if not values is None:
         n = self.shapenum()
         for i in range(n):
             if i < len(values):
                 self.layer.editCellValue(fieldname, i, values[i])
Beispiel #6
0
 def addfield(self, fieldname, dtype, values=None):
     '''
     Add a field into the attribute table.
     
     :param fieldname: (*string*) Field name.
     :param dtype: (*string*) Field data type [string | int | float | double].
     :param values: (*array_like*) Field values.
     '''
     dt = TableUtil.toDataTypes(dtype)
     self.layer.editAddField(fieldname, dt)
     if not values is None:
         n = self.shapenum()
         for i in range(n):
             if i < len(values):
                 self.layer.editCellValue(fieldname, i, values[i])