gws.plugin.alkis.data.norbit

Read data from Norbit plugin tables.

Source code: gws.plugin.alkis.data.norbit

Module Contents

class gws.plugin.alkis.data.norbit.Object(provider: gws.plugin.postgres.provider.Object, schema='public')

Bases: gws.plugin.alkis.data.types.Reader

Reader for ALKIS source tables written by the norBIT ALKIS import.

There is one table per object type, named after the class in lower case, with one column per attribute. Struct attributes are stored in columns prefixed with the attribute name, lists are stored as arrays. The reader converts each row into an instance of the gid class, using a reader method per attribute, chosen by the attribute type.

db
readers
schema = 'public'
STD_READERS

Reader method names for basic and special attribute types.

as_ax_buchung_historischesflurstueck_list(cls, prop, r)

Read a list of AX_Buchung_HistorischesFlurstueck structs.

Parameters:
  • cls – GeoInfoDok class of the attribute.

  • prop – Column name.

  • r – Table row as a dict.

Returns:

A list of AX_Buchung_HistorischesFlurstueck instances with their buchungsblattbezirk set.

as_ax_lagebezeichnung(cls, prop, r)

Read an AX_Lagebezeichnung attribute.

Parameters:
  • cls – GeoInfoDok class of the attribute.

  • prop – Column name.

  • r – Table row as a dict.

Returns:

The unencoded location string if present, otherwise an AX_VerschluesselteLagebezeichnung.

as_ax_relativehoehe_list(cls, prop, r)

Read a list of AX_RelativeHoehe structs.

Parameters:
  • cls – GeoInfoDok class of the attribute.

  • prop – Column name prefix of the struct attributes.

  • r – Table row as a dict.

Returns:

The hoehe of the first struct that has one, or None.

as_bool(cls, prop, r)

Read a boolean.

Parameters:
  • cls – GeoInfoDok class of the attribute.

  • prop – Column name.

  • r – Table row as a dict.

Returns:

A boolean, or None if the value is missing.

as_bool_list(cls, prop, r)

Read a list of booleans.

Parameters:
  • cls – GeoInfoDok class of the attribute.

  • prop – Column name.

  • r – Table row as a dict.

Returns:

A list of booleans.

as_date(cls, prop, r)

Read a date or a date and time.

ISO strings are parsed, other values are returned as is.

Parameters:
  • cls – GeoInfoDok class of the attribute.

  • prop – Column name.

  • r – Table row as a dict.

Returns:

A date or datetime, or None if the value is empty.

as_date_list(cls, prop, r)

Read a list of dates.

Parameters:
  • cls – GeoInfoDok class of the attribute.

  • prop – Column name.

  • r – Table row as a dict.

Returns:

A list of dates or datetimes.

as_enum(cls, prop, r)

Read a code list value.

Parameters:
  • cls – GeoInfoDok class of the attribute.

  • prop – Column name.

  • r – Table row as a dict.

Returns:

An EnumPair, or None if the value is not in the code list.

as_enum_list(cls, prop, r)

Read a list of code list values.

Parameters:
  • cls – GeoInfoDok class of the attribute.

  • prop – Column name.

  • r – Table row as a dict.

Returns:

A list of EnumPair objects. Values not in the code list are skipped.

as_float(cls, prop, r)

Read a float.

Parameters:
  • cls – GeoInfoDok class of the attribute.

  • prop – Column name.

  • r – Table row as a dict.

Returns:

A float, or None if the value is missing.

as_float_list(cls, prop, r)

Read a list of floats.

Parameters:
  • cls – GeoInfoDok class of the attribute.

  • prop – Column name.

  • r – Table row as a dict.

Returns:

A list of floats.

as_int(cls, prop, r)

Read an integer.

Parameters:
  • cls – GeoInfoDok class of the attribute.

  • prop – Column name.

  • r – Table row as a dict.

Returns:

An integer, or None if the value is missing.

as_int_list(cls, prop, r)

Read a list of integers.

Parameters:
  • cls – GeoInfoDok class of the attribute.

  • prop – Column name.

  • r – Table row as a dict.

Returns:

A list of integers.

as_ref(cls, prop, r)

Read a reference to another object.

Parameters:
  • cls – GeoInfoDok class of the attribute.

  • prop – Column name.

  • r – Table row as a dict.

Returns:

The identifier of the referenced object.

as_ref_list(cls, prop, r)

Read a list of references to other objects.

Parameters:
  • cls – GeoInfoDok class of the attribute.

  • prop – Column name.

  • r – Table row as a dict.

Returns:

A list of object identifiers.

as_str(cls, prop, r)

Read a string.

Parameters:
  • cls – GeoInfoDok class of the attribute.

  • prop – Column name.

  • r – Table row as a dict.

Returns:

A stripped string, or None if the value is empty.

as_str_list(cls, prop, r)

Read a list of strings.

Parameters:
  • cls – GeoInfoDok class of the attribute.

  • prop – Column name.

  • r – Table row as a dict.

Returns:

A list of stripped strings, empty values become None.

as_struct(cls, prop, r)

Read a struct attribute.

A column <prop>_<attribute> is used if present, otherwise the plain attribute column.

Parameters:
  • cls – GeoInfoDok class of the attribute.

  • prop – Column name prefix of the struct attributes.

  • r – Table row as a dict.

Returns:

An instance of cls.

as_struct_list(cls, prop, r)

Read a list of structs from parallel array columns.

Parameters:
  • cls – GeoInfoDok class of the attribute.

  • prop – Column name prefix of the struct attributes.

  • r – Table row as a dict.

Returns:

A list of cls instances.

count(cls, table_name=None)

Count source objects of a GeoInfoDok class.

Parameters:
  • cls – GeoInfoDok class from the geo_info_dok schema module.

  • table_name – Source table name. Defaults to a name derived from the class.

Returns:

The number of objects.

get_reader(attr)

Return the reader method for an attribute.

Parameters:

attr – Attribute metadata from the gid schema.

Returns:

A bound reader method. Unknown types are read as strings.

read_all(cls, table_name=None, uids=None)

Read source objects of a GeoInfoDok class.

Parameters:
  • cls – GeoInfoDok class from the geo_info_dok schema module.

  • table_name – Source table name. Defaults to a name derived from the class.

  • uids – Object identifiers to read. If empty, all objects are read.

Returns:

An iterable of cls instances.