Пример #1
0
    def createField(self, table, field):
        #Creates an OGR field
        colType = columnType(table, field)

        #Get OGR type
        ogrType = ogrTypes[colType]
        field_defn = ogr.FieldDefn(field, ogrType)

        return field_defn
Пример #2
0
    def createField(self, table, field):
        # Creates an OGR field

        colType = columnType(table, field)
        # Get OGR type
        ogrType = ogrTypes[colType]

        # OGR date handling is broken! handle all dates as strings
        if ogrType == OGRWriter.OGR_DATE_TYPE:
            ogrType = OGRWriter.OGR_STRING_TYPE

        field_defn = ogr.FieldDefn(field, ogrType)

        return field_defn
Пример #3
0
    def _validate_columns(self):
        # Validates if the columns in the config exist in the data source.
        ds_set = set(table_column_names(self._config.data_source))
        conf_set = set(self._config.columns.keys())
        valid_cols_set = ds_set.intersection(conf_set)
        v_col_mapping = OrderedDict()
        for vc in valid_cols_set:
            v_col_mapping[vc] = self._config.columns.get(vc)
            # Set column type
            col_type = columnType(self._config.data_source, vc)
            if col_type:
                self._column_types[vc] = col_type

        return v_col_mapping
Пример #4
0
    def createField(self, table, field):
        # Creates an OGR field

        colType = columnType(table, field)
        # Get OGR type
        ogrType = ogrTypes[colType]

        # OGR date handling is broken! Convert Date type to STR type
        if ogrType == OGRWriter.OGR_DATE_TYPE:
            ogrType = OGRWriter.OGR_STRING_TYPE

        field_defn = ogr.FieldDefn(field.encode('utf-8'), ogrType)

        return field_defn
Пример #5
0
    def createField(self,table,field):
        #Creates an OGR field

        colType = columnType(table, field)
        #Get OGR type
        ogrType = ogrTypes[colType]

        #OGR date handling is broken! handle all dates as strings
        if ogrType == OGRWriter.OGR_DATE_TYPE: 
            ogrType = OGRWriter.OGR_STRING_TYPE

        field_defn = ogr.FieldDefn(field.encode('utf-8'), ogrType)

        return field_defn