Records

Regarding to the main documentation you find here all the stuff which is related to the records. You can imagine these record things as the in-application-currency. They are achieved and structured in the Sources. They are gathered by the Readers. And they are combined, sorted, dismissed and reorganized by the processor.

Note

This layer is not meant to be adapted in normal.

AddressRecord

class pyramid_oereb.core.records.address.AddressRecord(street_name, zip_code, street_number, geom)[source]

Bases: object

The record for handling the address entity inside the application. An address is exactly defined by street name, zip code and street number. In addition it must have a geometry which must be a point from the shapely library (https://pypi.python.org/pypi/Shapely).

street_name

The name of the street for this address.

Type:

unicode

zip_code

The zipcode for this address.

Type:

int

street_number

The house number for this address.

Type:

unicode

geom

The point which is representing this address.

Type:

shapely.geometry.Point

__init__(street_name, zip_code, street_number, geom)[source]
Parameters:
  • street_name (unicode) – The name of the street for this address.

  • zip_code (int) – The zipcode for this address.

  • street_number (unicode) – The house number for this address.

  • geom (shapely.geometry.Point) – The point which is representing this address.

AvailabilityRecord

class pyramid_oereb.core.records.availability.AvailabilityRecord(fosnr, theme_code, available=False)[source]

Bases: object

__init__(fosnr, theme_code, available=False)[source]

The record to check if data is available for municipality.

Parameters:
  • fosnr (int) – The unique id of the municipality.

  • theme_code (str) – The theme_code which is affected to be available or not.

  • available (bool) – Switch if data is available in municipality and theme/sub theme or not.

DataIntegrationRecord

class pyramid_oereb.core.records.data_integration.DataIntegrationRecord(date, checksum=None, theme=None, office=None, theme_identifier=None, office_identifier=None)[source]

Bases: object

__init__(date, checksum=None, theme=None, office=None, theme_identifier=None, office_identifier=None)[source]

The record to check if data is available for municipality.

Parameters:
  • date (datetime.date) – The date when data for the theme was delivered.

  • theme (pyramid_oereb.core.records.ThemeRecord or None) – The theme code which this element belongs to.

  • office (pyramid_oereb.core.records.office.OfficeRecord or None) – The office this element belongs to.

  • checksum (str or None) – A checksum to persist the data state which is in the db. It is thought to be a helper field to check if import is necessary.

  • theme_identifier (str|int|None) – The identifier which can be used to match the corresponding theme.

  • office_identifier (str|int|None) – The identifier which can be used to match the corresponding office.

DisclaimerRecord

class pyramid_oereb.core.records.disclaimer.DisclaimerRecord(title, content, extract_index=None)[source]

Bases: object

Represents a disclaimer entry with the label and it’s message.

Parameters:
  • title (dict of unicode) – The multilingual disclaimer message label

  • content (dict of unicode) – The multilingual disclaimer message.

__init__(title, content, extract_index=None)[source]
title

The multilingual disclaimer message label

Type:

dict of unicode

content

The multilingual disclaimer message.

Type:

dict of unicode

DocumentTypeRecord

class pyramid_oereb.core.records.document_types.DocumentTypeRecord(code, title)[source]

Bases: object

Represents a document type entry with the code and it’s display name.

Parameters:
  • code (str of unicode) – The code for the document type.

  • title (dict of unicode) – The label title for the document type (multilingual).

__init__(code, title)[source]

DocumentRecord

class pyramid_oereb.core.records.documents.DocumentRecord(document_type, index, law_status, title, responsible_office, published_from, published_until=None, text_at_web=None, abbreviation=None, official_number=None, only_in_municipality=None, article_numbers=None, file=None, identifier=None)[source]

Bases: object

More specific document class representing real documents.

document_type

The document type.

Type:

pyramid_oereb.lib.records.document_types.DocumentTypeRecord

index

An index used to sort the documents.

Type:

int

law_status

Multilingual label of the law status.

Type:

dict

title

The multilingual title of the document. It might be shortened one.

Type:

dict of unicode

responsible_office

Office which is responsible for this document.

Type:

pyramid_oereb.lib.records.office.OfficeRecord

published_from

Date from when this document is published.

Type:

datetime.date

published_until

Date until when this document is published.

Type:

datetime.date

text_at_web

The multilingual URI to the documents content.

Type:

dict of uri

abbreviation

Short term for this document (multilingual).

Type:

dict of unicode

official_number

The official number for identification of this document.

Type:

dict of unicode

only_in_municipality

Restrict document to a specific municipality by code.

Type:

int

article_numbers

Pointers to specific articles.

Type:

list of unicode

file

The binary content of the document.

Type:

bytes

__init__(document_type, index, law_status, title, responsible_office, published_from, published_until=None, text_at_web=None, abbreviation=None, official_number=None, only_in_municipality=None, article_numbers=None, file=None, identifier=None)[source]
Parameters:
  • document_type (pyramid_oereb.lib.records.document_types.DocumentTypeRecord) – The document type.

  • index (int) – An index used to sort the documents.

  • law_status (pyramid_oereb.lib.records.law_status.LawStatusRecord) – The law status of this record.

  • title (dict of unicode) – The multilingual title of the document. It might be shortened one.

  • responsible_office (pyramid_oereb.lib.records.office.OfficeRecord) – Office which is responsible for this document.

  • published_from (datetime.date) – Date from when this document is published.

  • published_until (datetime.date) – Date until when this document is published.

  • text_at_web (dict of uri) – The multilingual URI to the documents content.

  • abbreviation (dict of unicode) – Short term for this document (multilingual).

  • official_number (dict of unicode) – The official number for identification of this document.

  • only_in_municipality (int) – Restrict document to a specific municipality by code.

  • article_numbers (list of unicode) – Pointers to specific articles.

  • file (bytes) – The binary content of the document.

  • identifier (str) – The identifier of the document which might be used for linking to other elements.

copy()[source]

Returns (DocumentRecord): A copy of this DocumentRecord element

property published

Returns true if its not a future or past document.

Returns:

True if document is published.

Return type:

bool

DatasourceRecord

class pyramid_oereb.core.records.embeddable.DatasourceRecord(theme, date, owner)[source]

Bases: object

__init__(theme, date, owner)[source]

The record for handling the datasource entity for the embeddable flavour.

Parameters:
  • theme (pyramid_oereb.lib.records.theme.ThemeRecord) – The topic of the datasource.

  • date (datetime.datetime) – Actuality of the topic.

  • owner (pyramid_oereb.lib.records.office.OfficeRecord) – The information about the organisation which is responsible for the topic.

EmbeddableRecord

class pyramid_oereb.core.records.embeddable.EmbeddableRecord(cadaster_state, cadaster_organisation, data_owner_cadastral_surveying, transfer_from_source_cadastral_surveying, datasources)[source]

Bases: object

cadaster_state

Actuality of the oereb cadaster.

Type:

datetime.datetime

cadaster_organisation

The information about the organisation which provides this cadaster.

Type:

pyramid_oereb.lib.records.office.OfficeRecord

data_owner_cadastral_surveying

The information about the office which povides the surveying data for this extract.

Type:

pyramid_oereb.lib.records.office.OfficeRecord

transfer_from_source_cadastral_surveying

The actuality of the surveying data used for this extract.

Type:

datetime.datetime

datasources

All the datasource information on the extract.

Type:

list of pyramid_oereb.lib.records.embeddable.DatasourceRecord

__init__(cadaster_state, cadaster_organisation, data_owner_cadastral_surveying, transfer_from_source_cadastral_surveying, datasources)[source]

The record for handling the address entity inside the application.

Parameters:
  • cadaster_state (datetime.datetime) – Actuality of the oereb cadaster.

  • cadaster_organisation (pyramid_oereb.lib.records.office.OfficeRecord) – The information about the organisation which provides this cadaster.

  • data_owner_cadastral_surveying (pyramid_oereb.lib.records.office.OfficeRecord) – The information about the office which povides the surveying data for this extract.

  • transfer_from_source_cadastral_surveying (datetime.datetime) – The actuality of the surveying data used for this extract.

  • datasources (list of pyramid_oereb.lib.records.embeddable.DatasourceRecord) – All the datasource information on the extract.

ExtractRecord

class pyramid_oereb.core.records.extract.ExtractRecord(real_estate, logo_plr_cadastre, federal_logo, cantonal_logo, municipality_logo, plr_cadastre_authority, update_date_os, disclaimers=None, glossaries=None, concerned_theme=None, not_concerned_theme=None, theme_without_data=None, general_information=None, qr_code=None, qr_code_ref=None)[source]

Bases: object

The extract base class. .. attribute:: creation_date

The date and time of the extract creation.

type:

datetime.datetime

electronic_signature

Digital signature for the extract.

Type:

unicode or None

concerned_theme

List of concerned themes.

Type:

list of pyramid_oereb.core.records.theme.ThemeRecord

not_concerned_theme

List of not concerned themes.

Type:

list of pyramid_oereb.core.records.theme.ThemeRecord

theme_without_data

List of themes without data.

Type:

list of pyramid_oereb.core.records.theme.ThemeRecord

extract_identifier

The extract identifier (UUID).

Type:

unicode

update_date_os

Last update of the official survey used as base map in the extract.

Type:

datetime

general_information

General information for the static extract as multilingual text.

Type:

list of dict

real_estate

The real estate in its record representation.

Type:

pyramid_oereb.lib.records.real_estate.RealEstateRecord

logo_plr_cadastre

Image file of the PLR logo.

Type:

pyramid_oereb.lib.records.logo.LogoRecord

Image file of the federal logo.

Type:

pyramid_oereb.lib.records.image.ImageRecord

Image file of the cantonal logo.

Type:

pyramid_oereb.lib.records.image.ImageRecord

Image file of the municipality logo.

Type:

pyramid_oereb.lib.records.image.ImageRecord

plr_cadastre_authority

The authority which is responsible for the PLR cadastre.

Type:

pyramid_oereb.lib.records.office.OfficeRecord

disclaimer (list of

pyramid_oereb.core.records.disclaimer.DisclaimerRecord or None): Disclaimers for the extract.

glossaries

Glossaries for the extract.

Type:

list of pyramid_oereb.lib.records.glossary.GlossaryRecord

__init__(real_estate, logo_plr_cadastre, federal_logo, cantonal_logo, municipality_logo, plr_cadastre_authority, update_date_os, disclaimers=None, glossaries=None, concerned_theme=None, not_concerned_theme=None, theme_without_data=None, general_information=None, qr_code=None, qr_code_ref=None)[source]
Parameters:
  • real_estate (pyramid_oereb.lib.records.real_estate.RealEstateRecord) – The real estate in its record representation.

  • logo_plr_cadastre (pyramid_oereb.lib.records.logo.LogoRecord) – Image file of the PLR logo.

  • federal_logo (pyramid_oereb.lib.records.image.ImageRecord) – Image file of the federal logo.

  • cantonal_logo (pyramid_oereb.lib.records.image.ImageRecord) – Image file of the cantonal logo.

  • municipality_logo (pyramid_oereb.lib.records.image.ImageRecord) – Image file of the municipality logo.

  • plr_cadastre_authority (pyramid_oereb.lib.records.office.OfficeRecord) – The authority which is responsible for the PLR cadastre.

  • update_date_os (datetime) – Last update of the official survey used as base map in the extract.

  • of (disclaimer (list) – pyramid_oereb.core.records.disclaimer.DisclaimerRecord or None): Disclaimers for the extract.

  • glossaries (list of pyramid_oereb.lib.records.glossary.GlossaryRecord) – Glossaries for the extract.

  • concerned_theme (list of pyramid_oereb.lib.records.theme.ThemeRecord or None) – Concerned themes.

  • not_concerned_theme (list of pyramid_oereb.lib.records.theme.ThemeRecord or None) – Not concerned themes.

  • theme_without_data (list of pyramid_oereb.lib.records.theme.ThemeRecord or None) – Themes without data.

  • general_information (list of dict) – General information for the static extract as multilingual text.

  • qr_code (pyramid_oereb.lib.records.image.ImageRecord or None) – QR code for the extract as ImageRecord.

  • qr_code_ref (str or None) – The URL to retrieve the QR code.

GeneralInformationRecord

class pyramid_oereb.core.records.general_information.GeneralInformationRecord(title, content, extract_index=None)[source]

Bases: object

Represents a general information entry with its title and content. .. attribute:: title

The title of the information (multilingual)

type:

dict of unicode

content

The actual information (multilingual)

Type:

dict of unicode

__init__(title, content, extract_index=None)[source]
Parameters:
  • title (dict of unicode) – The title of the information (multilingual)

  • content (dict of unicode) – The actual information (multilingual)

GeometryRecord

class pyramid_oereb.core.records.geometry.GeometryRecord(law_status, published_from, published_until, geom, geo_metadata=None, public_law_restriction=None)[source]

Bases: object

Geometry record

law_status

The law status of this record.

Type:

pyramid_oereb.lib.records.law_status.LawStatusRecord

published_from

Date from/since when the PLR record is published.

Type:

datetime.date

published_until

Date until the PLR record is published.

Type:

datetime.date

geom

The geometry which must be of type POINT, LINESTRING or POLYGON, everything else will raise an error.

Type:

Point or LineString or Polygon

geo_metadata

The metadata.

Type:

uri

public_law_restriction

The public law restriction

Type:

pyramid_oereb.lib.records.plr.PlrRecord

calculated

True if there was an access on property before calculation was done.

Type:

boole

Raises:

AttributeError – Error when a wrong geometry type was passed.

__init__(law_status, published_from, published_until, geom, geo_metadata=None, public_law_restriction=None)[source]
Parameters:
  • law_status (pyramid_oereb.lib.records.law_status.LawStatusRecord) – The law status of this record.

  • published_from (datetime.date) – Date from/since when the PLR record is published.

  • published_until (datetime.date) – Date until the PLR record is published.

  • geom (Point or LineString or Polygon)

  • POINT (The geometry which must be of type) – will raise an error.

  • POLYGON (LINESTRING or) – will raise an error.

  • else (everything) – will raise an error.

  • geo_metadata (uri) – The metadata.

  • public_law_restriction (pyramid_oereb.lib.records.plr.PlrRecord) – The public law restriction

property area_share

Returns: float or None: the area of this geometry.

calculate(real_estate, min_length, min_area, length_unit, area_unit, geometry_types, tolerances=None)[source]

Entry method for calculation. It checks if the geometry type of this instance is a geometry collection which has to be unpacked first in case of collection.

Parameters:
  • real_estate (pyramid_oereb.lib.records.real_estate.RealEstateRecord) – The real estate record.

  • min_length (float) – The threshold to consider or not a line element.

  • min_area (float) – The threshold to consider or not a surface element.

  • length_unit (unicode) – The thresholds unit for area calculation.

  • area_unit (unicode) – The thresholds unit for area calculation.

  • geometry_types (dict) – The allowed geometry types for the to match the simple feature types point, line, polygon

Returns:

True if intersection fits the limits.

Return type:

bool

property dim

Returns: int: The topological dimension.

static geom_dim(geom)[source]

Returns the topological dimension of the specified geometry.

Parameters:

geom (shapely.geometry.base.BaseGeometry) – The geometry to be evaluated.

Returns:

The geometry’s topological dimension.

Return type:

int

property length_share

Returns: float or None: the length of this geometry.

property nr_of_points

Returns: float or None: the total amount of points/this geometry.

property published

Returns: bool: True if geometry is published.

GlossaryRecord

class pyramid_oereb.core.records.glossary.GlossaryRecord(title, content)[source]

Bases: object

Represents a glossary entry with the term and it’s description.

title

The term used in the extract (multilingual).

Type:

dict of unicode

content

The description text for the glossary entry (multilingual).

Type:

dict of unicode

__init__(title, content)[source]
Parameters:
  • title (dict of unicode) – The term used in the extract (multilingual).

  • content (dict of unicode) – The description text for the glossary entry (multilingual)

ImageRecord

class pyramid_oereb.core.records.image.ImageRecord(content)[source]

Bases: object

VALID_FILE_TYPES

list with valid image file type.

Type:

list of str

SVG_PATTERN

regex pattern for svg image file types.

Type:

re

__init__(content)[source]

The record to hold the binary information of a image.

Parameters:

content (binary) – The binary information of this image as binary string.

encode()[source]
Returns:

The encoded image as a base64 encoded string..

Return type:

str

property extension

Checks for valid file type and returns its mime type.

Returns:

The file’s mime type.

Return type:

str

static get_extension(obj)[source]

Checks for valid file type and returns its extension.

Parameters:

obj (str, bytes, bytearray or readable) – Path to the file, a readable object or the file’s content as str, bytes or bytearray. See filetype documentation: https://h2non.github.io/filetype.py/v1.0.0/filetype.m.html

Returns:

The file’s extension.

Return type:

str

static get_mimetype(obj)[source]

Checks for valid file type and returns its mime type.

Parameters:

obj (str, bytes, bytearray or readable) – Path to the file, a readable object or the file’s content as str, bytes or bytearray. See filetype documentation: https://h2non.github.io/filetype.py/v1.0.0/filetype.m.html

Returns:

The file’s mime type.

Return type:

str

property mimetype

Checks for valid file type and returns its extension.

Returns:

The file’s extension.

Return type:

str

LawStatusRecord

class pyramid_oereb.core.records.law_status.LawStatusRecord(code, title)[source]

Bases: object

Law status record.

code

The code of the law status. It must be “inForce” or “changeWithPreEffect” or “changeWithoutPreEffect” every other value will raise an error.

Type:

str or unicode

title

The multilingual law status description.

Type:

dict of unicode

__init__(code, title)[source]
Parameters:
  • code (str or unicode) – The code of the law status. It must be “inForce” or “changeWithPreEffect” or “changeWithoutPreEffect” every other value will raise an error.

  • title (dict of unicode) – The multilingual law status description.

LogoRecord

class pyramid_oereb.core.records.logo.LogoRecord(code, image_dict)[source]

Bases: object

Represents a logo with its code and its base64 encoded string (multilingual).

code

The code for the logo.

Type:

str of unicode

image_dict

The image encoded as base64 (multilingual).

Type:

dict of pyramid_oereb.lib.records.image.ImageRecord

__init__(code, image_dict)[source]
Parameters:
  • code (str of unicode) – The code for the logo.

  • image_dict (dict of pyramid_oereb.lib.records.image.ImageRecord) – The image encoded as base64 (multilingual).

MapLayeringRecord

class pyramid_oereb.core.records.map_layering.MapLayeringRecord(view_service, layer_index, layer_opacity)[source]

Bases: object

Represents a map layering entry with the view service, layer index and layer opacity.

view_service

View service.

Type:

dict

layer_index

Index for sorting the layering of the view services within a theme.

Type:

int

layer_opacity

Opacity of a view service.

Type:

float

__init__(view_service, layer_index, layer_opacity)[source]
Parameters:
  • view_service (dict) – View service.

  • layer_index (int) – Index for sorting the layering of the view services within a theme.

  • layer_opacity (float) – Opacity of a view service.

MunicipalityRecord

class pyramid_oereb.core.records.municipality.MunicipalityRecord(fosnr, name, published, geom=None)[source]

Bases: object

The base document class.

fosnr

The unique id bfs of the municipality.

Type:

int

name

The zipcode for this address.

Type:

unicode

published

Is this municipality ready for publishing via server.

Type:

bool

geom

The geometry which is representing this municipality as a WKT.

Type:

str or None

__init__(fosnr, name, published, geom=None)[source]
Parameters:
  • fosnr (int) – The unique id bfs of the municipality.

  • name (unicode) – The zipcode for this address.

  • published (bool) – Is this municipality ready for publishing via server.

  • geom (str or None) – The geometry which is representing this municipality as a WKT.

OfficeRecord

class pyramid_oereb.core.records.office.OfficeRecord(name, uid=None, office_at_web=None, line1=None, line2=None, street=None, number=None, postal_code=None, city=None, identifier=None)[source]

Bases: object

Responsible office record.

name

The official name of the authority (multilingual)

Type:

dict of unicode

uid

The unique identifier of the authority in the federal register

Type:

unicode

office_at_web

The URL to the office’s homepage (multilingual)

Type:

dict of unicode

line1

Complementary address information

Type:

unicode

line2

Complementary address information

Type:

unicode

street

The street where the authority is located

Type:

unicode

number

House number

Type:

unicode

postal_code

ZIP Code of the

Type:

integer

city

The city where the authority is located identifier (str): The identifier of the theme which might be used for linking to other elements.

Type:

unicode

__init__(name, uid=None, office_at_web=None, line1=None, line2=None, street=None, number=None, postal_code=None, city=None, identifier=None)[source]
Parameters:
  • name (dict of unicode) – The official name of the authority (multilingual)

  • uid (unicode) – The unique identifier of the authority in the federal register

  • office_at_web (dict of unicode) – The URL to the office’s homepage (multilingual)

  • line1 (unicode) – Complementary address information

  • line2 (unicode) – Complementary address information

  • street (unicode) – The street where the authority is located

  • number (unicode) – House number

  • postal_code (integer) – ZIP Code of the

  • city (unicode) – The city where the authority is located identifier (str): The identifier of the theme which might be used for linking to other elements.

EmptyPlrRecord

class pyramid_oereb.core.records.plr.EmptyPlrRecord(theme, has_data=True)[source]

Bases: object

theme

The theme to which the PLR belongs to.

Type:

pyramid_oereb.lib.records.theme.ThemeRecord

has_data

True if the topic contains data.

Type:

bool

__init__(theme, has_data=True)[source]

Record for empty topics.

Parameters:
  • theme (pyramid_oereb.lib.records.theme.ThemeRecord) – The theme to which the PLR belongs to.

  • has_data (bool) – True if the topic contains data.

PlrRecord

class pyramid_oereb.core.records.plr.PlrRecord(theme, legend_entry, law_status, published_from, published_until, responsible_office, symbol, view_service, geometries, sub_theme=None, type_code=None, type_code_list=None, documents=None, info=None, min_length=0.0, min_area=0.0, length_unit='m', area_unit='m2', view_service_id=None, tolerance=None, tolerances=None)[source]

Bases: EmptyPlrRecord

Public law restriction record. .. attribute:: theme

The theme to which the PLR belongs to.

type:

pyramid_oereb.lib.records.theme.ThemeRecord

legend_entry

The PLR record’s corresponding legend record.

Type:

pyramid_oereb.lib.records.view_service.LegendEntryRecord

law_status

The law status of this record.

Type:

pyramid_oereb.lib.records.law_status.LawStatusRecord

published_from

Date from/since when the PLR record is published.

Type:

datetime.date

published_until

Date from when the PLR record is not published anymore.

Type:

datetime.date

responsible_office

Office which is responsible for this PLR.

Type:

pyramid_oereb.lib.records.office.OfficeRecord

symbol

Symbol of the restriction defined for the legend entry

Type:

pyramid_oereb.lib.records.image.ImageRecord

view_service

The view service instance associated with this record.

Type:

pyramid_oereb.lib.records.view_service.ViewServiceRecord

geometries

List of geometry records associated with this record.

Type:

list of pyramid_oereb.lib.records.geometry.GeometryRecord

sub_theme

Optional subtopic.

Type:

pyramid_oereb.lib.records.theme.ThemeRecord or None

type_code

The PLR record’s type code (also used by view service).

Type:

unicode

type_code_list

URL to the PLR’s list of type codes.

Type:

unicode

documents

List of documents associated with this record.

Type:

list of pyramid_oereb.core.records.documents.DocumentBaseRecord

info

The information read from the config.

Type:

dict or None

min_length

The threshold for area calculation.

Type:

float

min_area

The threshold for area calculation.

Type:

float

length_unit

The threshold for area calculation.

Type:

unicode

area_unit

The threshold for area calculation.

Type:

unicode

view_service_id

The id to the connected view service. This is very important to be able to

Type:

int

solve bug https

//github.com/openoereb/pyramid_oereb/issues/521

__init__(theme, legend_entry, law_status, published_from, published_until, responsible_office, symbol, view_service, geometries, sub_theme=None, type_code=None, type_code_list=None, documents=None, info=None, min_length=0.0, min_area=0.0, length_unit='m', area_unit='m2', view_service_id=None, tolerance=None, tolerances=None)[source]
Parameters:
  • theme (pyramid_oereb.lib.records.theme.ThemeRecord) – The theme to which the PLR belongs to.

  • legend_entry (pyramid_oereb.lib.records.view_service.LegendEntryRecord) – The PLR record’s corresponding legend record.

  • law_status (pyramid_oereb.lib.records.law_status.LawStatusRecord) – The law status of this record.

  • published_from (datetime.date) – Date from/since when the PLR record is published.

  • published_until (datetime.date) – Date from when the PLR record is not published anymore.

  • responsible_office (pyramid_oereb.lib.records.office.OfficeRecord) – Office which is responsible for this PLR.

  • symbol (pyramid_oereb.lib.records.image.ImageRecord) – Symbol of the restriction defined for the legend entry

  • view_service (pyramid_oereb.lib.records.view_service.ViewServiceRecord) – The view service instance associated with this record.

  • geometries (list of pyramid_oereb.lib.records.geometry.GeometryRecord) – List of geometry records associated with this record.

  • sub_theme (pyramid_oereb.lib.records.theme.ThemeRecord or None) – Optional subtopic.

  • type_code (unicode) – The PLR record’s type code (also used by view service).

  • type_code_list (unicode) – URL to the PLR’s list of type codes.

  • documents (list of pyramid_oereb.core.records.documents.DocumentBaseRecord) – List of documents associated with this record.

  • info (dict or None) – The information read from the config.

  • min_length (float) – The threshold for area calculation.

  • min_area (float) – The threshold for area calculation.

  • length_unit (unicode) – The threshold for area calculation.

  • area_unit (unicode) – The threshold for area calculation.

  • view_service_id (int) – The id to the connected view service.

property area_share

Retruns: float or None: the summed area of all related geometry records of this PLR.

calculate(real_estate, geometry_types)[source]

Entry method for calculation. It checks if the geometry type of this instance is a geometry collection which has to be unpacked first in case of collection.

Parameters:
  • real_estate (pyramid_oereb.lib.records.real_estate.RealEstateRecord) – The real estate record.

  • geometry_types (dict) – The allowed geometry types for the to match the simple

  • point (feature types)

  • line

  • polygon

Returns:

True if intersection fits the limits.

Return type:

bool

property legend_text

Returns: dict of unicode: the legend text

property length_share

Returns: float or None: the summed length of all related geometry records of this PLR.

property nr_of_points

Returns: float or None: the number of points of all related geometry records of this PLR.

property part_in_percent

Retruns: decimal or None: (decimal): Part of the property area touched by the restriction in percent.

property published

Retruns: bool: True if PLR is published.

RealEstateRecord

class pyramid_oereb.core.records.real_estate.RealEstateRecord(type, canton, municipality, fosnr, land_registry_area, limit, metadata_of_geographical_base_data=None, number=None, identdn=None, egrid=None, subunit_of_land_register=None, subunit_of_land_register_designation=None, public_law_restrictions=None, references=None)[source]

Bases: object

Basic characteristics and geometry of the property to be analysed.

plan_for_land_register

The view service to be used for the land registry map.

Type:

pyramid_oereb.lib.records.view_service.ViewServiceRecord

highlight

the view service with the wms

Type:

pyramid_oereb.lib.records.view_service.ViewServiceRecord

image of the highlighted real estate.
areas_ratio

Ratio of geometrical area and area from land registry.

Type:

decimal

__init__(type, canton, municipality, fosnr, land_registry_area, limit, metadata_of_geographical_base_data=None, number=None, identdn=None, egrid=None, subunit_of_land_register=None, subunit_of_land_register_designation=None, public_law_restrictions=None, references=None)[source]
Parameters:
  • type (unicode) – The property type. This attribute will be translated with the configured corresponding value.

  • canton (unicode) – The abbreviation of the canton the property is located in

  • municipality (unicode) – The municipality the property is located in

  • fosnr (int) – The federal number of the municipality defined by the statistics office

  • land_registry_area (int) – Area of the property as defined in the land registry

  • limit (shapely.geometry.MultiPolygon) – The boundary of the property as geometry in as shapely multi polygon

  • metadata_of_geographical_base_data (uri) – Link to the metadata of the geodata

  • number (unicode or None) – The official cantonal number of the property

  • identdn (unicode or None) – The unique identifier of the property

  • egrid (unicode or None) – The federal property identifier

  • subunit_of_land_register (unicode or None) – Subunit of the land register if existing.

  • subunit_of_land_register_designation (unicode or None) – Dexciption of subunit_of_land_register if exisiting.

  • public_law_restrictions (list of pyramid_oereb.lib.records.plr.PlrRecord or None) – List of public law restrictions for this real estate

  • references (list of pyramid_oereb.lib.records.documents.DocumentRecord or None) – Documents associated with this real estate

  • plan_for_land_register (pyramid_oereb.lib.records.view_service.ViewServiceRecord) – The view service to be used for the land registry map

  • plan_for_land_register_main_page (pyramid_oereb.lib.records.view_service.ViewServiceRecord) – The view service to be used for the land registry map used on the main page

set_main_page_view_service(plan_for_land_register_main_page)[source]

Sets the view service to generate the land registry map for the real estate.

Parameters:

plan_for_land_register_main_page (pyramid_oereb.lib.records.view_service.ViewServiceRecord) – The view service to be used for the land registry map used on the main page

set_view_service(plan_for_land_register)[source]

Sets the view service to generate the land registry map for the real estate.

Parameters:

plan_for_land_register (pyramid_oereb.lib.records.view_service.ViewServiceRecord) – The view service to be used for the land registry map.

RealEstateTypeRecord

class pyramid_oereb.core.records.real_estate_type.RealEstateTypeRecord(code, title)[source]

Bases: object

Represents a real estate type entry with the code and it’s display name. .. attribute:: code

The code for the real estate type.

type:

str of unicode

title

The label title for the real estate type (multilingual).

Type:

dict of unicode

__init__(code, title)[source]
Parameters:
  • code (str of unicode) – The code for the real estate type.

  • title (dict of unicode) – The label title for the real estate type (multilingual).

ThemeRecord

class pyramid_oereb.core.records.theme.ThemeRecord(code, title, extract_index, sub_code=None, document_records=None, identifier=None)[source]

Bases: object

Creates a new theme record. .. attribute:: code

The theme’s code.

type:

unicode

title

The multilingual description.

Type:

dict of unicode

extract_index

Index to sort themes in the extract.

Type:

int

sub_code

The code of the sub_theme. Is none for themes.

Type:

unicode

document_records

Documents that relates to this theme

Type:

list of str

identifier

The identifier of the theme which might be used for linking to other elements.

Type:

str

__init__(code, title, extract_index, sub_code=None, document_records=None, identifier=None)[source]
Parameters:
  • code (unicode) – The theme’s code.

  • title (dict of unicode) – The multilingual description.

  • extract_index (int) – Index to sort themes in the extract.

  • sub_code (unicode) – The code of the sub_theme. Is none for themes.

  • document_records (list of str) – Documents that relates to this theme

  • identifier (str) – The identifier of the theme which might be used for linking to other elements.

ThemeDocumentRecord

class pyramid_oereb.core.records.theme_document.ThemeDocumentRecord(theme_id, document_id, article_numbers)[source]

Bases: object

Creates a new theme record. .. attribute:: theme_id

Foreign key relating to theme’s id.

type:

str

document_id

Foreign key relating to document’s id.

Type:

str

article_numbers

Article numbers to refine statement of document to a theme.

Type:

list of str

__init__(theme_id, document_id, article_numbers)[source]
Parameters:
  • theme_id (str) – Foreign key relating to theme’s id.

  • document_id (str) – Foreign key relating to document’s id.

  • article_numbers (list of str) – Article numbers to refine statement of document to a theme.

LegendEntryRecord

class pyramid_oereb.core.records.view_service.LegendEntryRecord(symbol, legend_text, type_code, type_code_list, theme, view_service_id=None, sub_theme=None, identifier=None)[source]

Bases: object

Represents a legend entry with it’s text as well as it’s image.

symbol

The binary content of the legend symbol.

Type:

pyramid_oereb.lib.records.image.ImageRecord

legend_text

The multilingual description text for the legend entry.

Type:

dict of unicode

type_code

The class of the legend entry corresponding to the plrs classes.

Type:

unicode

type_code_list

An URL to the type code list.

Type:

unicode

theme

The theme to which the legend entry belongs.

Type:

pyramid_oereb.lib.records.theme.ThemeRecord

view_service_id

The id to the connected view service. This is very important to be able to solve bug https://github.com/openoereb/pyramid_oereb/issues/521

Type:

int

sub_theme

The optional sub theme to which the legend entry belongs.

Type:

pyramid_oereb.lib.records.theme.ThemeRecord

identifier

The identifier of the legend entry which might be used for linking to other elements.

Type:

str

__init__(symbol, legend_text, type_code, type_code_list, theme, view_service_id=None, sub_theme=None, identifier=None)[source]
Parameters:
  • symbol (pyramid_oereb.lib.records.image.ImageRecord) – The binary content of the legend symbol.

  • legend_text (dict of unicode) – The multilingual description text for the legend entry.

  • type_code (unicode) – The class of the legend entry corresponding to the plrs classes.

  • type_code_list (unicode) – An URL to the type code list.

  • theme (pyramid_oereb.lib.records.theme.ThemeRecord) – The theme to which the legend entry belongs.

  • view_service_id (int) – The id to the connected view service. This is very important to be able to solve bug https://github.com/openoereb/pyramid_oereb/issues/521

  • sub_theme (pyramid_oereb.lib.records.theme.ThemeRecord) – The optional sub theme to which the legend entry belongs.

  • identifier (str) – The identifier of the legend entry which might be used for linking to other elements.

ViewServiceRecord

class pyramid_oereb.core.records.view_service.ViewServiceRecord(reference_wms, layer_index, layer_opacity, default_language, srid, proxies=None, legends=None)[source]

Bases: object

A view service contains a valid WMS URL with a defined set of layers.

image

multilingual dictionary containing the binary image (pyramid_oereb.core.records.image.ImageRecord) downloaded from WMS link for the requested (if any) or default language. Empty for an extract without images

Type:

dict

__init__(reference_wms, layer_index, layer_opacity, default_language, srid, proxies=None, legends=None)[source]
Parameters:
  • reference_wms (dict) – Multilingual dict with URLs to the actual service (WMS)

  • layer_index (int) – Layer index. Value from -1000 to +1000.

  • layer_opacity (float) – Opacity of layer. Value from 0.0 to 1.0.

  • default_language (str) – The default language which should be used for url selection.

  • srid (int) – The SRID which is used for the WMS.

  • proxies (dict or None) – The proxies which may be used

  • legends (list of LegendEntry or None) – A list of all relevant legend entries.

static check_min_max_attributes(min_point, min_name, max_point, max_name)[source]
Checks the validity of a min and max point:
  • type check

  • min_point < max_point

Parameters:
  • min_point (shapely.geometry.point.Point) – a point geometry

  • () (max_name) – the name of the point

  • max_point (shapely.geometry.point.Point) – a point geometry

  • () – the name of the point

Raises:

AttributeError if one of the check fails

download_wms_content(language)[source]

Downloads the image found behind the URL stored in the instance attribute “reference_wms” for the requested language

Parameters:

language (string) – the language for which the image should be downloaded

Raises:
  • LookupError – Raised if the response is not code 200 or content-type doesn’t contains type “image”.

  • AttributeError – Raised if the URL itself isn’t valid at all.

static get_bbox_from_url(wms_url)[source]

Parses wms url for BBOX parameter an returns these points as suitable values for ViewServiceRecord. :param wms_url: wms url which includes a BBOX parameter to parse. :type wms_url: str

Returns:

min and max coordinates of bounding box.

Return type:

set of two shapely.geometry.point.Point

get_full_wms_url(language, map_width, map_height, bbox)[source]

Returns the WMS URL to get the image.

Parameters:
  • language (string) – which language of the reference WMS should be used.

  • map_width (int) – Width of map in pixels.

  • map_height (int) – Height of map in pixels.

  • bbox (list of float) – Bounding box which defines the maps view.

Returns:

The url used to query the WMS server.

Return type:

str

static sanitize_layer_index(layer_index)[source]

Checks the validity of the layer index.

Arg:

layer_index (int): index of the layer

Returns:

the layer index if it is an int berween -1000 and 1000.

Return type:

int

Raises:

AttributeError if the index is out of bounds

static sanitize_layer_opacity(layer_opacity)[source]

Checks the validity of the layer opacity :param layer_opacity: the opacity used to draw the layer. :type layer_opacity: float

Returns:

the layer opacity if it is a float between 0 and 1

Return type:

float

Raises:

AttributeError if the opacity is out of bounds.