Esempio n. 1
0
 def _get_dataset_subtypes(self, dataset_name, dataset_type):
     """Get subtypes information for single dataset."""
     if dataset_type == DATASET_TYPE_FC:
         dataset = FeatureClass(os.path.join(self.gdb.path, dataset_name))
     elif dataset_type == DATASET_TYPE_TABLE:
         dataset = Table(os.path.join(self.gdb.path, dataset_name))
     subtypes = dataset.get_subtypes()
     if subtypes:
         df_subtypes = self._map_boolean(pd.DataFrame.from_dict(subtypes))
         return df_subtypes
Esempio n. 2
0
    def _get_dataset_indexes(self, dataset_name, dataset_type):
        """Get indexes information for single feature class."""
        if dataset_type == DATASET_TYPE_FC:
            dataset = FeatureClass(os.path.join(self.gdb.path, dataset_name))
        elif dataset_type == DATASET_TYPE_TABLE:
            dataset = Table(os.path.join(self.gdb.path, dataset_name))

        indexes = dataset.get_indexes()
        if indexes:
            df_indexes = (pd.DataFrame.from_dict(indexes).sort_values(
                by='Name'))
            return df_indexes
Esempio n. 3
0
    def _get_fc_props(fc):
        """Get single geodatabase feature class props as ordered dict."""
        fc_instance = FeatureClass(arcpy.Describe(fc).catalogPath)
        od = OrderedDict()

        passed_first_column = False
        for k, v in GDB_FC_PROPS.items():
            od[v] = getattr(fc_instance, k, '')
            if not passed_first_column:
                od['Feature dataset'] = ''
                passed_first_column = True
        # custom props
        od['Row count'] = fc_instance.get_row_count()
        num_attachments = fc_instance.get_attachments_count()

        if num_attachments is not None:
            od['Attachments enabled'] = True
            od['Attachments count'] = num_attachments
        else:
            od['Attachments enabled'] = False
            od['Attachments count'] = ''

        return od
Esempio n. 4
0
    def _get_dataset_fields(self, dataset_name, dataset_type):
        """Get fields information for single dataset."""
        if self.arcpy_found:
            if dataset_type == DATASET_TYPE_FC:
                dataset = FeatureClass(
                    os.path.join(self.gdb.path, dataset_name))
            elif dataset_type == DATASET_TYPE_TABLE:
                dataset = Table(os.path.join(self.gdb.path, dataset_name))
        else:
            if dataset_type == DATASET_TYPE_FC:
                dataset = FeatureClassOgr(self.gdb, dataset_name)
            elif dataset_type == DATASET_TYPE_TABLE:
                dataset = TableOgr(self.gdb, dataset_name)

        df_fields = self._map_boolean(
            pd.DataFrame.from_dict(dataset.get_fields()))

        # when there is a dataset with no fields
        if not df_fields.empty:
            df_fields['Default value'].fillna(value='', inplace=True)
        else:
            df_fields = None
        return df_fields