Coverage for gws-app/gws/plugin/alkis/__init__.py: 100%

0 statements  

« prev     ^ index     » next       coverage.py v7.16.2, created at 2026-10-05 13:35 +0200

1"""ALKIS cadastre search. 

2 

3This plugin provides the "Flurstueckssuche": a search for land parcels 

4(Flurstuecke) and addresses in ALKIS cadastre data stored in PostgreSQL, the 

5display and printing of parcel details, protected access to land register 

6(Buchung) and owner (Eigentuemer) data, and the export of parcel data. 

7 

8The ALKIS source tables (for example, imported by the Norbit plugin) are not 

9searched directly. A command line indexer reads them once and writes a set of 

10GWS index tables into a separate schema (``indexSchema``). All searches run 

11against this index. 

12 

13Submodules 

14---------- 

15 

16- ``action`` - the ``alkis`` action. It configures the index, templates, 

17 printers, exporters and the selection storage, checks access to owner and 

18 register data, logs owner data access, and implements the API commands 

19 ``alkisGetToponyms``, ``alkisFindAdresse``, ``alkisFindFlurstueck``, 

20 ``alkisExportFlurstueck``, ``alkisPrintFlurstueck`` and 

21 ``alkisSelectionStorage``. 

22- ``cli`` - the ``alkis`` command line commands: ``index`` (build the index), 

23 ``status`` (check the index), ``export`` (export all parcels), ``keys`` 

24 (list export keys) and ``dump`` (write the internal representation of 

25 parcels to a JSON file). 

26- ``data`` - the data layer: 

27 

28 - ``data.types`` - records and entities (Flurstueck, Buchungsblatt, Person, 

29 Lage and others), query and option types. 

30 - ``data.index`` - the index object: index tables, status, address and 

31 parcel queries, serialization of entities. 

32 - ``data.indexer`` - builds the index from the source tables. 

33 - ``data.norbit6`` - reads source tables in the Norbit (GeoInfoDok 6) 

34 format. 

35 - ``data.exporter`` - exports parcels to CSV or GeoJSON. 

36 - ``data.geo_info_dok`` - the GeoInfoDok 6 and 7 schemas (generated) and 

37 the generator that creates them. 

38 

39- ``templates`` - default HTML templates for parcel and address views and 

40 for printing. 

41- ``js`` - the client part (search form, results, selection). 

42 

43Design 

44------ 

45 

46The action creates one index object per index schema. At activation, the 

47index status is checked once and cached server-wide; a missing index is 

48reported as a configuration warning, and if the basic index is missing, the 

49action is not sent to the client. 

50 

51Default templates and a default printer are always added after the 

52configured ones. Without configured exporters, a default exporter is created 

53when ``ui.useExport`` is set. 

54 

55Owner and register data are only returned when the index contains them and 

56the user may read the ``eigentuemer`` and ``buchung`` options respectively. 

57Requesting owner data implies register data. In control mode, every owner 

58query requires a control input that matches one of ``controlRules``. 

59 

60Example:: 

61 

62 actions+ { 

63 type "alkis" 

64 dbUid "DB_ALKIS" 

65 dataSchema "public" 

66 indexSchema "gws8" 

67 crs 25832 

68 

69 ui { 

70 useSelect true 

71 useExport true 

72 searchSpatial true 

73 } 

74 

75 eigentuemer { 

76 permissions.read "allow sachbearbeiter, deny all" 

77 controlMode true 

78 controlRules ["^[A-Z]{2}-\\\\d{4}$"] 

79 logTable "public.alkis_log" 

80 } 

81 

82 buchung { 

83 permissions.read "allow sachbearbeiter, deny all" 

84 } 

85 } 

86 

87Build and check the index from the command line:: 

88 

89 gws alkis index --projectUid myproject 

90 gws alkis status --projectUid myproject 

91"""