API reference

Search classes

Module containing the abstract search classes to retrieve DOV data.

class pydov.search.abstract.AbstractCommon[source]

Class grouping methods common to AbstractSearch and AbstractTypeCommon.

class pydov.search.abstract.AbstractSearch(layer, objecttype)[source]

Abstract search class grouping methods common to all DOV search classes. Not to be instantiated or used directly.

Methods

get_description()

Get the description of this search layer.

get_fields()

Get the metadata of the fields that are available.

search([location, query, sort_by, ...])

Search for objects of this type.

Initialisation.

Parameters:
layerstr

WFS layer to use for searching and retrieving records.

objecttypepydov.types.AbstractDovType

Subclass of AbstractDovType indicating the associated DOV datatype.

Methods

get_description()

Get the description of this search layer.

get_fields()

Get the metadata of the fields that are available.

search([location, query, sort_by, ...])

Search for objects of this type.

get_description()[source]

Get the description of this search layer.

Returns:
str

The description of this layer.

get_fields()[source]

Get the metadata of the fields that are available.

Returns:
fieldsdict<str,dict>

Dictionary containing the metadata of the available fields, where the metadata dictionary includes:

name (str)

The name of the field.

definition (str)

The definition of the field.

type (str)

The datatype of the field.

notnull (boolean)

Whether the field is mandatory (True) or can be null (False).

query (boolean)

Whether the field can be used in an attribute query.

cost (integer)

The cost associated with the request of this field in the output dataframe.

Optionally, it can contain:

values (list)

A list of possible values for this field.

search(location=None, query=None, sort_by=None, return_fields=None, max_features=None)[source]

Search for objects of this type. Provide location and/or query and/or max_features. When return_fields is None, all fields are returned.

Parameters:
locationpydov.util.location.AbstractLocationFilter or owslib.fes2.BinaryLogicOpType<AbstractLocationFilter> or owslib.fes2.UnaryLogicOpType<AbstractLocationFilter>

Location filter limiting the features to retrieve. Can either be a single instance of a subclass of AbstractLocationFilter, or a combination using And, Or, Not of AbstractLocationFilters.

queryowslib.fes2.OgcExpression

OGC filter expression to use for searching. This can contain any combination of filter elements defined in owslib.fes2. The query should use the fields provided in get_fields(). Note that not all fields are currently supported as a search parameter.

sort_byowslib.fes2.SortBy, optional

List of properties to sort by.

return_fieldslist<str> or tuple<str> or set<str>

A list of fields to be returned in the output data. This should be a subset of the fields provided in get_fields(). Note that not all fields are currently supported as return fields.

max_featuresint

Limit the maximum number of features to request.

Returns:
pandas.core.frame.DataFrame

DataFrame containing the output of the search query.

Raises:
pydov.util.errors.InvalidSearchParameterError

When not one of location or query or max_features is provided.

pydov.util.errors.InvalidFieldError

When at least one of the fields in return_fields is unknown.

When a field that is only accessible as return field is used as a query parameter.

When a field that can only be used as a query parameter is used as a return field.

AttributeError

When the argument supplied as return_fields is not a list, tuple or set.

NotImplementedError

This is an abstract method that should be implemented in a subclass.

Boring

Module containing the search classes to retrieve DOV borehole data.

class pydov.search.boring.BoringSearch(objecttype=<class 'pydov.types.boring.Boring'>)[source]

Search class to retrieve information about boreholes (Boring).

Methods

get_description()

Get the description of this search layer.

get_fields()

Get the metadata of the fields that are available.

search([location, query, sort_by, ...])

Search for objects of this type.

Initialisation.

Parameters:
objecttypesubclass of pydov.types.abstract.AbstractDovType

Reference to a class representing the Boring type. Optional: defaults to the Boring type containing the fields described in the documentation.

Methods

get_description()

Get the description of this search layer.

get_fields()

Get the metadata of the fields that are available.

search([location, query, sort_by, ...])

Search for objects of this type.

Sondering

Module containing the search classes to retrieve DOV CPT data.

class pydov.search.sondering.SonderingSearch(objecttype=<class 'pydov.types.sondering.Sondering'>)[source]

Search class to retrieve information about CPT measurements ( Sonderingen).

Methods

get_description()

Get the description of this search layer.

get_fields()

Get the metadata of the fields that are available.

search([location, query, sort_by, ...])

Search for objects of this type.

Initialisation.

Parameters:
objecttypesubclass of pydov.types.abstract.AbstractDovType

Reference to a class representing the Sondering type. Optional: defaults to the Sondering type containing the fields described in the documentation.

Methods

get_description()

Get the description of this search layer.

get_fields()

Get the metadata of the fields that are available.

search([location, query, sort_by, ...])

Search for objects of this type.

Grondwaterfilter

Module containing the search classes to retrieve DOV groundwater screen data.

class pydov.search.grondwaterfilter.GrondwaterFilterSearch(objecttype=<class 'pydov.types.grondwaterfilter.GrondwaterFilter'>)[source]

Search class to retrieve information about groundwater screens (GrondwaterFilter).

Methods

get_description()

Get the description of this search layer.

get_fields()

Get the metadata of the fields that are available.

search([location, query, sort_by, ...])

Search for objects of this type.

Initialisation.

Parameters:
objecttypesubclass of pydov.types.abstract.AbstractDovType

Reference to a class representing the GrondwaterFilter type. Optional: defaults to the GrondwaterFilter type containing the fields described in the documentation.

Methods

get_description()

Get the description of this search layer.

get_fields()

Get the metadata of the fields that are available.

search([location, query, sort_by, ...])

Search for objects of this type.

search(location=None, query=None, sort_by=None, return_fields=None, max_features=None)[source]

Search for objects of this type. Provide location and/or query and/or max_features. When return_fields is None, all fields are returned.

Excludes ‘empty’ filters (i.e. Putten without Filters) by extending the query with a not-null check on pkey_filter.

Parameters:
locationpydov.util.location.AbstractLocationFilter or owslib.fes2.BinaryLogicOpType<AbstractLocationFilter> or owslib.fes2.UnaryLogicOpType<AbstractLocationFilter>

Location filter limiting the features to retrieve. Can either be a single instance of a subclass of AbstractLocationFilter, or a combination using And, Or, Not of AbstractLocationFilters.

queryowslib.fes2.OgcExpression

OGC filter expression to use for searching. This can contain any combination of filter elements defined in owslib.fes2. The query should use the fields provided in get_fields(). Note that not all fields are currently supported as a search parameter.

sort_byowslib.fes2.SortBy, optional

List of properties to sort by.

return_fieldslist<str> or tuple<str> or set<str>

A list of fields to be returned in the output data. This should be a subset of the fields provided in get_fields(). Note that not all fields are currently supported as return fields.

max_featuresint

Limit the maximum number of features to request.

Returns:
pandas.core.frame.DataFrame

DataFrame containing the output of the search query.

Raises:
pydov.util.errors.InvalidSearchParameterError

When not one of location or query or max_features is provided.

pydov.util.errors.InvalidFieldError

When at least one of the fields in return_fields is unknown.

When a field that is only accessible as return field is used as a query parameter.

When a field that can only be used as a query parameter is used as a return field.

AttributeError

When the argument supplied as return_fields is not a list, tuple or set.

NotImplementedError

This is an abstract method that should be implemented in a subclass.

Grondwatermonster

Module containing the search classes to retrieve DOV groundwater samples.

class pydov.search.grondwatermonster.GrondwaterMonsterSearch(objecttype=<class 'pydov.types.grondwatermonster.GrondwaterMonster'>)[source]

Search class to retrieve information about groundwater samples (GrondwaterMonster).

Methods

get_description()

Get the description of this search layer.

get_fields()

Get the metadata of the fields that are available.

search([location, query, sort_by, ...])

Search for objects of this type.

Initialisation.

Parameters:
objecttypesubclass of pydov.types.abstract.AbstractDovType

Reference to a class representing the GrondwaterFilter type. Optional: defaults to the GrondwaterFilter type containing the fields described in the documentation.

Methods

get_description()

Get the description of this search layer.

get_fields()

Get the metadata of the fields that are available.

search([location, query, sort_by, ...])

Search for objects of this type.

Grondwatervergunning

Module containing the search classes to retrieve permit data.

class pydov.search.grondwatervergunning.GrondwaterVergunningSearch(objecttype=<class 'pydov.types.grondwatervergunning.GrondwaterVergunning'>)[source]

Search class to retrieve information about Gw permits ( all permits: current and historical).

Methods

get_description()

Get the description of this search layer.

get_fields()

Get the metadata of the fields that are available.

search([location, query, sort_by, ...])

Search for objects of this type.

Initialisation.

Parameters:
objecttypesubclass of pydov.types.abstract.AbstractDovType

Reference to a class representing the GrondwaterVergunning type. Optional: defaults to the GrondwaterVergunning type containing the fields described in the documentation.

Methods

get_description()

Get the description of this search layer.

get_fields()

Get the metadata of the fields that are available.

search([location, query, sort_by, ...])

Search for objects of this type.

Interpretaties

Module containing the search classes to retrieve DOV interpretations.

class pydov.search.interpretaties.FormeleStratigrafieSearch(objecttype=<class 'pydov.types.interpretaties.FormeleStratigrafie'>)[source]

Search class to retrieve the interpretation for Formele stratigrafie

Methods

get_description()

Get the description of this search layer.

get_fields()

Get the metadata of the fields that are available.

search([location, query, sort_by, ...])

Search for objects of this type.

Initialisation.

Parameters:
objecttypesubclass of pydov.types.abstract.AbstractDovType

Reference to a class representing the FormeleStratigrafie type. Optional: defaults to the FormeleStratigrafie type containing the fields described in the documentation.

Methods

get_description()

Get the description of this search layer.

get_fields()

Get the metadata of the fields that are available.

search([location, query, sort_by, ...])

Search for objects of this type.

class pydov.search.interpretaties.GecodeerdeLithologieSearch(objecttype=<class 'pydov.types.interpretaties.GecodeerdeLithologie'>)[source]

Search class to retrieve gecodeerde lithologie

Methods

get_description()

Get the description of this search layer.

get_fields()

Get the metadata of the fields that are available.

search([location, query, sort_by, ...])

Search for objects of this type.

Initialisation.

Parameters:
objecttypesubclass of pydov.types.abstract.AbstractDovType

Reference to a class representing the GecodeerdeLithologie type. Optional: defaults to the GecodeerdeLithologie type containing the fields described in the documentation.

Methods

get_description()

Get the description of this search layer.

get_fields()

Get the metadata of the fields that are available.

search([location, query, sort_by, ...])

Search for objects of this type.

class pydov.search.interpretaties.GeotechnischeCoderingSearch(objecttype=<class 'pydov.types.interpretaties.GeotechnischeCodering'>)[source]

Search class to retrieve geotechnische codering

Methods

get_description()

Get the description of this search layer.

get_fields()

Get the metadata of the fields that are available.

search([location, query, sort_by, ...])

Search for objects of this type.

Initialisation.

Parameters:
objecttypesubclass of pydov.types.abstract.AbstractDovType

Reference to a class representing the GeotechnischeCodering type. Optional: defaults to the GeotechnischeCodering type containing the fields described in the documentation.

Methods

get_description()

Get the description of this search layer.

get_fields()

Get the metadata of the fields that are available.

search([location, query, sort_by, ...])

Search for objects of this type.

class pydov.search.interpretaties.HydrogeologischeStratigrafieSearch(objecttype=<class 'pydov.types.interpretaties.HydrogeologischeStratigrafie'>)[source]

Search class to retrieve hydrogeological interpretations

Methods

get_description()

Get the description of this search layer.

get_fields()

Get the metadata of the fields that are available.

search([location, query, sort_by, ...])

Search for objects of this type.

Initialisation.

Parameters:
objecttypesubclass of pydov.types.abstract.AbstractDovType

Reference to a class representing the HydrogeologischeStratigrafie type. Optional: defaults to the HydrogeologischeStratigrafie type containing the fields described in the documentation.

Methods

get_description()

Get the description of this search layer.

get_fields()

Get the metadata of the fields that are available.

search([location, query, sort_by, ...])

Search for objects of this type.

class pydov.search.interpretaties.InformeleHydrogeologischeStratigrafieSearch(objecttype=<class 'pydov.types.interpretaties.InformeleHydrogeologischeStratigrafie'>)[source]

Search class to retrieve information about informele hydrogeologische stratigrafie.

Parameters:
objecttypesubclass of pydov.types.abstract.AbstractDovType

Reference to a class representing the InformeleHydrogeologischeStratigrafie type. Optional: defaults to the InformeleHydrogeologischeStratigrafie type containing the fields described in the documentation.

Methods

get_description()

Get the description of this search layer.

get_fields()

Get the metadata of the fields that are available.

search([location, query, sort_by, ...])

Search for objects of this type.

Initialisation.

Methods

get_description()

Get the description of this search layer.

get_fields()

Get the metadata of the fields that are available.

search([location, query, sort_by, ...])

Search for objects of this type.

class pydov.search.interpretaties.InformeleStratigrafieSearch(objecttype=<class 'pydov.types.interpretaties.InformeleStratigrafie'>)[source]

Search class to retrieve information about ‘informele stratigrafie’.

Methods

get_description()

Get the description of this search layer.

get_fields()

Get the metadata of the fields that are available.

search([location, query, sort_by, ...])

Search for objects of this type.

Initialisation.

Parameters:
objecttypesubclass of pydov.types.abstract.AbstractDovType

Reference to a class representing the InformeleStratigrafie type. Optional: defaults to the InformeleStratigrafie type containing the fields described in the documentation.

Methods

get_description()

Get the description of this search layer.

get_fields()

Get the metadata of the fields that are available.

search([location, query, sort_by, ...])

Search for objects of this type.

class pydov.search.interpretaties.LithologischeBeschrijvingenSearch(objecttype=<class 'pydov.types.interpretaties.LithologischeBeschrijvingen'>)[source]

Search class to retrieve lithologische beschrijvingen

Methods

get_description()

Get the description of this search layer.

get_fields()

Get the metadata of the fields that are available.

search([location, query, sort_by, ...])

Search for objects of this type.

Initialisation.

Parameters:
objecttypesubclass of pydov.types.abstract.AbstractDovType

Reference to a class representing the LithologischeBeschrijvingen type. Optional: defaults to the LithologischeBeschrijvingen type containing the fields described in the documentation.

Methods

get_description()

Get the description of this search layer.

get_fields()

Get the metadata of the fields that are available.

search([location, query, sort_by, ...])

Search for objects of this type.

class pydov.search.interpretaties.QuartairStratigrafieSearch(objecttype=<class 'pydov.types.interpretaties.QuartairStratigrafie'>)[source]

Search class to retrieve the interpretation for Quartair stratigrafie

Methods

get_description()

Get the description of this search layer.

get_fields()

Get the metadata of the fields that are available.

search([location, query, sort_by, ...])

Search for objects of this type.

Initialisation.

Parameters:
objecttypesubclass of pydov.types.abstract.AbstractDovType

Reference to a class representing the QuartairStratigrafie type. Optional: defaults to the QuartairStratigrafie type containing the fields described in the documentation.

Methods

get_description()

Get the description of this search layer.

get_fields()

Get the metadata of the fields that are available.

search([location, query, sort_by, ...])

Search for objects of this type.

Grondmonster

Module containing the search classes to retrieve DOV borehole data.

class pydov.search.grondmonster.GrondmonsterSearch(objecttype=<class 'pydov.types.grondmonster.Grondmonster'>)[source]

Search class to retrieve the grain size distribution of ground samples (‘grondmonster’)

Methods

get_description()

Get the description of this search layer.

get_fields()

Get the metadata of the fields that are available.

search([location, query, sort_by, ...])

Search for objects of this type.

Initialisation.

Parameters:
objecttypesubclass of pydov.types.abstract.AbstractDovType

Reference to a class representing the Grondmonster type. Optional: defaults to the Grondmonster type containing the fields described in the documentation.

Methods

get_description()

Get the description of this search layer.

get_fields()

Get the metadata of the fields that are available.

search([location, query, sort_by, ...])

Search for objects of this type.

Bodemsite

Module containing the search classes to retrieve DOV bodemsite data.

class pydov.search.bodemsite.BodemsiteSearch(objecttype=<class 'pydov.types.bodemsite.Bodemsite'>)[source]

Search class to retrieve information about bodemlocaties.

Methods

get_description()

Get the description of this search layer.

get_fields()

Get the metadata of the fields that are available.

search([location, query, sort_by, ...])

Search for objects of this type.

Initialisation.

Parameters:
objecttypesubclass of pydov.types.abstract.AbstractDovType

Reference to a class representing the Bodemsite type. Optional: defaults to the Bodemsite type containing the fields described in the documentation.

Methods

get_description()

Get the description of this search layer.

get_fields()

Get the metadata of the fields that are available.

search([location, query, sort_by, ...])

Search for objects of this type.

Bodemlocatie

Module containing the search classes to retrieve DOV bodemlocatie data.

class pydov.search.bodemlocatie.BodemlocatieSearch(objecttype=<class 'pydov.types.bodemlocatie.Bodemlocatie'>)[source]

Search class to retrieve information about bodemlocaties.

Methods

get_description()

Get the description of this search layer.

get_fields()

Get the metadata of the fields that are available.

search([location, query, sort_by, ...])

Search for objects of this type.

Initialisation.

Parameters:
objecttypesubclass of pydov.types.abstract.AbstractDovType

Reference to a class representing the Bodemlocatie type. Optional: defaults to the Bodemlocatie type containing the fields described in the documentation.

Methods

get_description()

Get the description of this search layer.

get_fields()

Get the metadata of the fields that are available.

search([location, query, sort_by, ...])

Search for objects of this type.

Bodemdiepteinterval

Module containing the search classes to retrieve DOV bodemdiepteinterval data.

class pydov.search.bodemdiepteinterval.BodemdiepteintervalSearch(objecttype=<class 'pydov.types.bodemdiepteinterval.Bodemdiepteinterval'>)[source]

Search class to retrieve information about bodemdiepteintervallen.

Methods

get_description()

Get the description of this search layer.

get_fields()

Get the metadata of the fields that are available.

search([location, query, sort_by, ...])

Search for objects of this type.

Initialisation.

Parameters:
objecttypesubclass of pydov.types.abstract.AbstractDovType

Reference to a class representing the Bodemdiepteinterval type. Optional: defaults to the Bodemdiepteinterval type containing the fields described in the documentation.

Methods

get_description()

Get the description of this search layer.

get_fields()

Get the metadata of the fields that are available.

search([location, query, sort_by, ...])

Search for objects of this type.

Bodemmonster

Module containing the search classes to retrieve DOV bodemmonster data.

class pydov.search.bodemmonster.BodemmonsterSearch(objecttype=<class 'pydov.types.bodemmonster.Bodemmonster'>)[source]

Search class to retrieve information about bodemmonsters.

Methods

get_description()

Get the description of this search layer.

get_fields()

Get the metadata of the fields that are available.

search([location, query, sort_by, ...])

Search for objects of this type.

Initialisation.

Parameters:
objecttypesubclass of pydov.types.abstract.AbstractDovType

Reference to a class representing the Bodemmonster type. Optional: defaults to the Bodemmonster type containing the fields described in the documentation.

Methods

get_description()

Get the description of this search layer.

get_fields()

Get the metadata of the fields that are available.

search([location, query, sort_by, ...])

Search for objects of this type.

Bodemobservatie

Module containing the search classes to retrieve DOV bodemobservatie data.

class pydov.search.bodemobservatie.BodemobservatieSearch(objecttype=<class 'pydov.types.bodemobservatie.Bodemobservatie'>)[source]

Search class to retrieve information about bodemobservaties.

Methods

get_description()

Get the description of this search layer.

get_fields()

Get the metadata of the fields that are available.

search([location, query, sort_by, ...])

Search for objects of this type.

Initialisation.

Parameters:
objecttypesubclass of pydov.types.abstract.AbstractDovType

Reference to a class representing the Bodemobservatie type. Optional: defaults to the Bodemobservatie type containing the fields described in the documentation.

Methods

get_description()

Get the description of this search layer.

get_fields()

Get the metadata of the fields that are available.

search([location, query, sort_by, ...])

Search for objects of this type.

Bodemclassificatie

Module containing the search classes to retrieve DOV bodemclassificatie data.

class pydov.search.bodemclassificatie.BodemclassificatieSearch(objecttype=<class 'pydov.types.bodemclassificatie.Bodemclassificatie'>)[source]

Search class to retrieve information about bodemclassificaties.

Methods

get_description()

Get the description of this search layer.

get_fields()

Get the metadata of the fields that are available.

search([location, query, sort_by, ...])

Search for objects of this type.

Initialisation.

Parameters:
objecttypesubclass of pydov.types.abstract.AbstractDovType

Reference to a class representing the Bodemclassificatie type. Optional: defaults to the Bodemclassificatie type containing the fields described in the documentation.

Methods

get_description()

Get the description of this search layer.

get_fields()

Get the metadata of the fields that are available.

search([location, query, sort_by, ...])

Search for objects of this type.

Generic

Module containing generic search classes to retrieve DOV WFS data.

class pydov.search.generic.WfsSearch(layer)[source]

Search class for generic WFS layers from DOV.

Methods

get_description()

Get the description of this search layer.

get_fields()

Get the metadata of the fields that are available.

search([location, query, sort_by, ...])

Search for objects of this type.

Initialisation.

Create a new WfsSearch instance to query a generic WFS layer from DOV. Check out the available WFS layers via https://dov.vlaanderen.be/geonetwork

Parameters:
layerstr

Workspace qualified layername of the layer to query.

Methods

get_description()

Get the description of this search layer.

get_fields()

Get the metadata of the fields that are available.

search([location, query, sort_by, ...])

Search for objects of this type.

Object types

Module containing the base DOV data types.

class pydov.types.abstract.AbstractDovSubType[source]

Abstract DOV type grouping fields and methods common to all DOV subtypes. Not to be instantiated or used directly.

Raises:
RuntimeError

When the defined fields of this type are invalid.

Attributes:
rootpathstr

XPath expression of the root element of this subtype. Should return all elements of this subtype.

Methods

extend_fields(extra_fields)

Extend the fields of this type with given extra fields and return the new fieldset.

from_xml(xml_data)

Build instances of this subtype from XML data.

from_xml_element(element)

Build an instance of this subtype from a single XML element.

get_field_names()

Return the names of the fields available for this type.

get_fields()

Return the metadata of the fields available for this type.

get_name()

Return the name associated with this subtype.

Initialisation.

Parameters:
namestr

The name associated with this subtype.

Attributes:
rootpath

Methods

extend_fields(extra_fields)

Extend the fields of this type with given extra fields and return the new fieldset.

from_xml(xml_data)

Build instances of this subtype from XML data.

from_xml_element(element)

Build an instance of this subtype from a single XML element.

get_field_names()

Return the names of the fields available for this type.

get_fields()

Return the metadata of the fields available for this type.

get_name()

Return the name associated with this subtype.

classmethod from_xml(xml_data)[source]

Build instances of this subtype from XML data.

Parameters:
xml_databytes

Raw XML data of the DOV object that contains information about this subtype.

Yields:
An instance of this type for each occurrence of the rootpath in
the XML document.
classmethod from_xml_element(element)[source]

Build an instance of this subtype from a single XML element.

Parameters:
elementetree.Element

XML element representing a single record of this subtype.

Returns:
instance of this class

An instance of this class based on the data in the XML element.

classmethod get_field_names()[source]

Return the names of the fields available for this type.

Returns:
list<str>

List of the field names available for this type. These are also the names of the columns in the output dataframe for this type.

classmethod get_fields()[source]

Return the metadata of the fields available for this type.

Returns:
collections.OrderedDict<str,dict>

Ordered dictionary mapping the field (column) name to the dictionary containing the metadata of this field.

This metadata dictionary includes at least:

name (str)

The name of the field in the output data.

source (str)

The source of the field (either wfs or xml).

sourcefield (str)

The name of the field in the source (source + sourcefield identify the origin of the data).

type (str)

Datatype of the output data field (one of string, float, integer, date, datetime).

definition (str)

The definition of the field.

notnull (boolean)

Whether the field is mandatory (True) or can be null (False).

classmethod get_name()[source]

Return the name associated with this subtype.

Returns:
namestr

The name associated with this subtype.

class pydov.types.abstract.AbstractDovType(typename, pkey)[source]

Abstract DOV type grouping fields and methods common to all DOV object types. Not to be instantiated or used directly.

Attributes:
subtypeslist of subclass of pydov.types.abstract.AbstractDovSubType

List of subtypes of this type.

Methods

extend_fields(extra_fields)

Extend the fields of this type with given extra fields and return the new fieldset.

from_wfs(response, namespace)

Build instances of this type from a WFS response.

from_wfs_element(feature, namespace)

Build an instance of this type from a WFS feature element.

get_df_array([return_fields, session])

Return the data array of the instance of this type for inclusion in the resulting output dataframe of a search operation.

get_field_names([return_fields, ...])

Return the names of the fields available for this type.

get_fields([source, include_subtypes])

Return the metadata of the fields available for this type.

get_xsd_schemas()

Get a set of distinct XSD schema URLs for this type and its subtypes.

to_df_array(iterable[, return_fields])

Returns a dataframe array with one or more arrays (rows) for each instance in the given iterable.

Initialisation.

Parameters:
typenamestr

Name of the DOV object type.

pkeystr

Permanent key of this DOV object, being a URI of the form https://www.dov.vlaanderen.be/data/typename/id.

Raises:
RuntimeError

When the defined fields of this type are invalid.

Attributes:
pkey_fieldname

Methods

extend_fields(extra_fields)

Extend the fields of this type with given extra fields and return the new fieldset.

from_wfs(response, namespace)

Build instances of this type from a WFS response.

from_wfs_element(feature, namespace)

Build an instance of this type from a WFS feature element.

get_df_array([return_fields, session])

Return the data array of the instance of this type for inclusion in the resulting output dataframe of a search operation.

get_field_names([return_fields, ...])

Return the names of the fields available for this type.

get_fields([source, include_subtypes])

Return the metadata of the fields available for this type.

get_xsd_schemas()

Get a set of distinct XSD schema URLs for this type and its subtypes.

to_df_array(iterable[, return_fields])

Returns a dataframe array with one or more arrays (rows) for each instance in the given iterable.

classmethod from_wfs(response, namespace)[source]

Build instances of this type from a WFS response.

Parameters:
responsestr or bytes or etree.Element or iterable<etree.Element>

WFS response containing GML features.

Can either be a GML str or byte sequence, in which case it will be parsed and scanned for wfs20:member.

Can also be a single instance of etree.Element containing the parsed GML response.

It can also be an iterable (list, tuple or generator) of etree.Element in which case it will be looped over.

namespacestr

Namespace associated with this WFS featuretype.

Yields:
An instance of this type for each record in the WFS response.
classmethod from_wfs_element(feature, namespace)[source]

Build an instance of this type from a WFS feature element.

Parameters:
featureetree.Element

XML element representing a single record of the WFS layer.

namespacestr

Namespace associated with this WFS featuretype.

Returns:
cls

An instance of this class populated with the data from the WFS element.

get_df_array(return_fields=None, session=None)[source]

Return the data array of the instance of this type for inclusion in the resulting output dataframe of a search operation.

Parameters:
return_fieldslist<str> or tuple<str> or set<str> or iterable<str>

List of fields to include in the data array. The order is ignored, the default order of the fields of the datatype is used instead. Defaults to None, which will include all fields.

sessionrequests.Session

Session to use to perform HTTP requests for data. Defaults to None, which means a new session will be created for each request.

Returns:
list

List of the values of this instance in the same order as the field/column names, for inclusion in the result dataframe of a search operation.

classmethod get_field_names(return_fields=None, include_subtypes=True, include_wfs_injected=False, include_geometry=False)[source]

Return the names of the fields available for this type.

Parameters:
return_fieldsReturnFieldList

List of fields to include in the data array. The order is ignored, the default order of the fields of the datatype is used instead. Defaults to None, which will include all fields.

include_subtypesboolean

Whether to include fields defined in subtypes (True) or not ( False). Defaults to True.

include_wfs_injectedboolean

Whether to include fields defined in WFS only, not in the default dataframe for this type. Defaults to False.

include_geometryboolean

Whether to include geometry fields. Defaults to False.

Returns:
list<str>

List of the field names available for this type. These are also the names of the columns in the output dataframe for this type.

Raises:
AttributeError

If the type of return_fields is not one of None, list, tuple or set.

pydov.util.errors.InvalidFieldError

If at least one of the fields listed in return_fields is unknown.

classmethod get_fields(source=('wfs', 'xml'), include_subtypes=True)[source]

Return the metadata of the fields available for this type.

Parameters:
sourcelist<str> or tuple<str> or iterable<str>

A list of sources to include in the output. Can be a combination of one or more of wfs, xml or custom . Defaults to (`wfs, xml).

include_subtypesboolean

Whether to include fields defined in subtypes (True) or not ( False). Defaults to True.

Returns:
collections.OrderedDict<str,dict>

Ordered dictionary mapping the field (column) name to the dictionary containing the metadata of this field.

This metadata dictionary includes at least:

name (str)

The name of the field in the output data.

source (str)

The source of the field (either wfs, xml or custom).

type (str)

Datatype of the output data field (one of string, float, integer, date, datetime, boolean).

The metadata dictionary additionally includes for fields with source xml or wfs:

sourcefield (str)

The name of the field in the source (source + sourcefield identify the origin of the data).

The metadata dictionary additionally includes for fields with source xml or custom:

definition (str)

The definition of the field.

notnull (boolean)

Whether the field is mandatory (True) or can be null (False).

classmethod get_xsd_schemas()[source]

Get a set of distinct XSD schema URLs for this type and its subtypes.

Returns:
set of str

A set of XSD schema URLs.

classmethod to_df_array(iterable, return_fields=None)[source]

Returns a dataframe array with one or more arrays (rows) for each instance in the given iterable.

Uses parallel processing to speed up IO operations.

Parameters:
iterablelist<DovType> or tuple<DovType> or iterable<DovType>

A list of instances of a DOV type.

return_fieldslist<str> or tuple<str> or set<str> or iterable<str>

List of fields to include in the data array. The order is ignored, the default order of the fields of the datatype is used instead. Defaults to None, which will include all fields.

Returns:
list of list

Dataframe contents in the format of a twodimensional list (rows) of lists (columns). The values in the second list are in the same order as the field/column names, for inclusion in the resulting Pandas dataframe of a search operation.

class pydov.types.abstract.AbstractTypeCommon[source]

Class grouping methods common to AbstractDovType and AbstractDovSubType.

Attributes:
fieldslist of pydov.types.fields.AbstractField

List of fields of this type.

Methods

extend_fields(extra_fields)

Extend the fields of this type with given extra fields and return the new fieldset.

classmethod extend_fields(extra_fields)[source]

Extend the fields of this type with given extra fields and return the new fieldset.

Parameters:
extra_fieldslist of pydov.types.fields.AbstractField

Extra fields to be appended to the existing fields of this type.

Returns:
list of pydov.types.fields.AbstractField

List of the existing fields of this type, extended with the extra fields supplied in extra_fields.

Boring

Module containing the DOV data type for boreholes (Boring), including subtypes.

class pydov.types.boring.BoorMethode[source]

Bases: AbstractDovSubType

Initialisation.

Parameters:
namestr

The name associated with this subtype.

Methods

extend_fields(extra_fields)

Extend the fields of this type with given extra fields and return the new fieldset.

from_xml(xml_data)

Build instances of this subtype from XML data.

from_xml_element(element)

Build an instance of this subtype from a single XML element.

get_field_names()

Return the names of the fields available for this type.

get_fields()

Return the metadata of the fields available for this type.

get_name()

Return the name associated with this subtype.

class pydov.types.boring.Boring(pkey)[source]

Bases: AbstractDovType

Class representing the DOV data type for boreholes.

Methods

extend_fields(extra_fields)

Extend the fields of this type with given extra fields and return the new fieldset.

from_wfs(response, namespace)

Build instances of this type from a WFS response.

from_wfs_element(feature, namespace)

Build an instance of this type from a WFS feature element.

get_df_array([return_fields, session])

Return the data array of the instance of this type for inclusion in the resulting output dataframe of a search operation.

get_field_names([return_fields, ...])

Return the names of the fields available for this type.

get_fields([source, include_subtypes])

Return the metadata of the fields available for this type.

get_xsd_schemas()

Get a set of distinct XSD schema URLs for this type and its subtypes.

to_df_array(iterable[, return_fields])

Returns a dataframe array with one or more arrays (rows) for each instance in the given iterable.

Initialisation.

Parameters:
pkeystr

Permanent key of the Boring (borehole), being a URI of the form https://www.dov.vlaanderen.be/data/boring/<id>.

Methods

extend_fields(extra_fields)

Extend the fields of this type with given extra fields and return the new fieldset.

from_wfs(response, namespace)

Build instances of this type from a WFS response.

from_wfs_element(feature, namespace)

Build an instance of this type from a WFS feature element.

get_df_array([return_fields, session])

Return the data array of the instance of this type for inclusion in the resulting output dataframe of a search operation.

get_field_names([return_fields, ...])

Return the names of the fields available for this type.

get_fields([source, include_subtypes])

Return the metadata of the fields available for this type.

get_xsd_schemas()

Get a set of distinct XSD schema URLs for this type and its subtypes.

to_df_array(iterable[, return_fields])

Returns a dataframe array with one or more arrays (rows) for each instance in the given iterable.

Sondering

Module containing the DOV data type for CPT measurements (Sonderingen), including subtypes.

class pydov.types.sondering.Meetdata[source]

Bases: AbstractDovSubType

Initialisation.

Parameters:
namestr

The name associated with this subtype.

Methods

extend_fields(extra_fields)

Extend the fields of this type with given extra fields and return the new fieldset.

from_xml(xml_data)

Build instances of this subtype from XML data.

from_xml_element(element)

Build an instance of this subtype from a single XML element.

get_field_names()

Return the names of the fields available for this type.

get_fields()

Return the metadata of the fields available for this type.

get_name()

Return the name associated with this subtype.

class pydov.types.sondering.Sondering(pkey)[source]

Bases: AbstractDovType

Class representing the DOV data type for CPT measurements.

Methods

extend_fields(extra_fields)

Extend the fields of this type with given extra fields and return the new fieldset.

from_wfs(response, namespace)

Build instances of this type from a WFS response.

from_wfs_element(feature, namespace)

Build an instance of this type from a WFS feature element.

get_df_array([return_fields, session])

Return the data array of the instance of this type for inclusion in the resulting output dataframe of a search operation.

get_field_names([return_fields, ...])

Return the names of the fields available for this type.

get_fields([source, include_subtypes])

Return the metadata of the fields available for this type.

get_xsd_schemas()

Get a set of distinct XSD schema URLs for this type and its subtypes.

to_df_array(iterable[, return_fields])

Returns a dataframe array with one or more arrays (rows) for each instance in the given iterable.

Initialisation.

Parameters:
pkeystr

Permanent key of the Sondering (CPT measurement), being a URI of the form https://www.dov.vlaanderen.be/data/sondering/<id>.

Methods

extend_fields(extra_fields)

Extend the fields of this type with given extra fields and return the new fieldset.

from_wfs(response, namespace)

Build instances of this type from a WFS response.

from_wfs_element(feature, namespace)

Build an instance of this type from a WFS feature element.

get_df_array([return_fields, session])

Return the data array of the instance of this type for inclusion in the resulting output dataframe of a search operation.

get_field_names([return_fields, ...])

Return the names of the fields available for this type.

get_fields([source, include_subtypes])

Return the metadata of the fields available for this type.

get_xsd_schemas()

Get a set of distinct XSD schema URLs for this type and its subtypes.

to_df_array(iterable[, return_fields])

Returns a dataframe array with one or more arrays (rows) for each instance in the given iterable.

Grondwaterfilter

Module containing the DOV data type for screens (Filter), including subtypes.

class pydov.types.grondwaterfilter.GrondwaterFilter(pkey)[source]

Bases: AbstractDovType

Class representing the DOV data type for Groundwater screens.

Methods

extend_fields(extra_fields)

Extend the fields of this type with given extra fields and return the new fieldset.

from_wfs(response, namespace)

Build instances of this type from a WFS response.

from_wfs_element(feature, namespace)

Build an instance of this type from a WFS feature element.

get_df_array([return_fields, session])

Return the data array of the instance of this type for inclusion in the resulting output dataframe of a search operation.

get_field_names([return_fields, ...])

Return the names of the fields available for this type.

get_fields([source, include_subtypes])

Return the metadata of the fields available for this type.

get_xsd_schemas()

Get a set of distinct XSD schema URLs for this type and its subtypes.

to_df_array(iterable[, return_fields])

Returns a dataframe array with one or more arrays (rows) for each instance in the given iterable.

Initialisation.

Parameters:
pkeystr

Permanent key of the Filter (screen), being a URI of the form https://www.dov.vlaanderen.be/data/filter/<id>.

Methods

extend_fields(extra_fields)

Extend the fields of this type with given extra fields and return the new fieldset.

from_wfs(response, namespace)

Build instances of this type from a WFS response.

from_wfs_element(feature, namespace)

Build an instance of this type from a WFS feature element.

get_df_array([return_fields, session])

Return the data array of the instance of this type for inclusion in the resulting output dataframe of a search operation.

get_field_names([return_fields, ...])

Return the names of the fields available for this type.

get_fields([source, include_subtypes])

Return the metadata of the fields available for this type.

get_xsd_schemas()

Get a set of distinct XSD schema URLs for this type and its subtypes.

to_df_array(iterable[, return_fields])

Returns a dataframe array with one or more arrays (rows) for each instance in the given iterable.

class pydov.types.grondwaterfilter.Peilmeting[source]

Bases: AbstractDovSubType

Initialisation.

Parameters:
namestr

The name associated with this subtype.

Methods

extend_fields(extra_fields)

Extend the fields of this type with given extra fields and return the new fieldset.

from_xml(xml_data)

Build instances of this subtype from XML data.

from_xml_element(element)

Build an instance of this subtype from a single XML element.

get_field_names()

Return the names of the fields available for this type.

get_fields()

Return the metadata of the fields available for this type.

get_name()

Return the name associated with this subtype.

Grondwatermonster

Module containing the DOV data type for groundwater samples (GrondwaterMonsters), including subtypes.

class pydov.types.grondwatermonster.GrondwaterMonster(pkey)[source]

Bases: AbstractDovType

Class representing the DOV data type for Groundwater samples.

Methods

extend_fields(extra_fields)

Extend the fields of this type with given extra fields and return the new fieldset.

from_wfs(response, namespace)

Build instances of this type from a WFS response.

from_wfs_element(feature, namespace)

Build an instance of this type from a WFS feature element.

get_df_array([return_fields, session])

Return the data array of the instance of this type for inclusion in the resulting output dataframe of a search operation.

get_field_names([return_fields, ...])

Return the names of the fields available for this type.

get_fields([source, include_subtypes])

Return the metadata of the fields available for this type.

get_xsd_schemas()

Get a set of distinct XSD schema URLs for this type and its subtypes.

to_df_array(iterable[, return_fields])

Returns a dataframe array with one or more arrays (rows) for each instance in the given iterable.

Initialisation.

Parameters:
pkeystr

Permanent key of the GrondwaterMonster (groundwater sample), being a URI of the form https://www.dov.vlaanderen.be/data/watermonster/<id>.

Methods

extend_fields(extra_fields)

Extend the fields of this type with given extra fields and return the new fieldset.

from_wfs(response, namespace)

Build instances of this type from a WFS response.

from_wfs_element(feature, namespace)

Build an instance of this type from a WFS feature element.

get_df_array([return_fields, session])

Return the data array of the instance of this type for inclusion in the resulting output dataframe of a search operation.

get_field_names([return_fields, ...])

Return the names of the fields available for this type.

get_fields([source, include_subtypes])

Return the metadata of the fields available for this type.

get_xsd_schemas()

Get a set of distinct XSD schema URLs for this type and its subtypes.

to_df_array(iterable[, return_fields])

Returns a dataframe array with one or more arrays (rows) for each instance in the given iterable.

class pydov.types.grondwatermonster.Observatie[source]

Bases: AbstractDovSubType

Initialisation.

Parameters:
namestr

The name associated with this subtype.

Methods

extend_fields(extra_fields)

Extend the fields of this type with given extra fields and return the new fieldset.

from_xml(xml_data)

Build instances of this subtype from XML data.

from_xml_element(element)

Build an instance of this subtype from a single XML element.

get_field_names()

Return the names of the fields available for this type.

get_fields()

Return the metadata of the fields available for this type.

get_name()

Return the name associated with this subtype.

Grondwatervergunning

Module containing the DOV data type for GW permits.

class pydov.types.grondwatervergunning.GrondwaterVergunning(pkey)[source]

Bases: AbstractDovType

Class representing the DOV data type for groundwater abstraction permits.

Methods

extend_fields(extra_fields)

Extend the fields of this type with given extra fields and return the new fieldset.

from_wfs(response, namespace)

Build instances of this type from a WFS response.

from_wfs_element(feature, namespace)

Build an instance of this type from a WFS feature element.

get_df_array([return_fields, session])

Return the data array of the instance of this type for inclusion in the resulting output dataframe of a search operation.

get_field_names([return_fields, ...])

Return the names of the fields available for this type.

get_fields([source, include_subtypes])

Return the metadata of the fields available for this type.

get_xsd_schemas()

Get a set of distinct XSD schema URLs for this type and its subtypes.

to_df_array(iterable[, return_fields])

Returns a dataframe array with one or more arrays (rows) for each instance in the given iterable.

Initialisation.

Parameters:
pkeystr

Permanent key of the Gwvergunningen (permits), being a URI of the form https://www.dov.vlaanderen.be/data/installatie/<id>.

Methods

extend_fields(extra_fields)

Extend the fields of this type with given extra fields and return the new fieldset.

from_wfs(response, namespace)

Build instances of this type from a WFS response.

from_wfs_element(feature, namespace)

Build an instance of this type from a WFS feature element.

get_df_array([return_fields, session])

Return the data array of the instance of this type for inclusion in the resulting output dataframe of a search operation.

get_field_names([return_fields, ...])

Return the names of the fields available for this type.

get_fields([source, include_subtypes])

Return the metadata of the fields available for this type.

get_xsd_schemas()

Get a set of distinct XSD schema URLs for this type and its subtypes.

to_df_array(iterable[, return_fields])

Returns a dataframe array with one or more arrays (rows) for each instance in the given iterable.

Interpretaties

Module containing the DOV data types for interpretations, including subtypes.

class pydov.types.interpretaties.AbstractBoringInterpretatie(pkey)[source]

Bases: AbstractDovType

Abstract base class for interpretations that are linked to boreholes only.

Methods

extend_fields(extra_fields)

Extend the fields of this type with given extra fields and return the new fieldset.

from_wfs(response, namespace)

Build instances of this type from a WFS response.

from_wfs_element(feature, namespace)

Build an instance of this type from a WFS feature element.

get_df_array([return_fields, session])

Return the data array of the instance of this type for inclusion in the resulting output dataframe of a search operation.

get_field_names([return_fields, ...])

Return the names of the fields available for this type.

get_fields([source, include_subtypes])

Return the metadata of the fields available for this type.

get_xsd_schemas()

Get a set of distinct XSD schema URLs for this type and its subtypes.

to_df_array(iterable[, return_fields])

Returns a dataframe array with one or more arrays (rows) for each instance in the given iterable.

Initialisation.

Parameters:
pkeystr

Permanent key of the Interpretatie (interpretations), being a URI of the form https://www.dov.vlaanderen.be/data/interpretatie/<id>.

Methods

extend_fields(extra_fields)

Extend the fields of this type with given extra fields and return the new fieldset.

from_wfs(response, namespace)

Build instances of this type from a WFS response.

from_wfs_element(feature, namespace)

Build an instance of this type from a WFS feature element.

get_df_array([return_fields, session])

Return the data array of the instance of this type for inclusion in the resulting output dataframe of a search operation.

get_field_names([return_fields, ...])

Return the names of the fields available for this type.

get_fields([source, include_subtypes])

Return the metadata of the fields available for this type.

get_xsd_schemas()

Get a set of distinct XSD schema URLs for this type and its subtypes.

to_df_array(iterable[, return_fields])

Returns a dataframe array with one or more arrays (rows) for each instance in the given iterable.

classmethod from_wfs_element(feature, namespace)[source]

Build an instance of this type from a WFS feature element.

Parameters:
featureetree.Element

XML element representing a single record of the WFS layer.

namespacestr

Namespace associated with this WFS featuretype.

Returns:
cls

An instance of this class populated with the data from the WFS element.

class pydov.types.interpretaties.AbstractCommonInterpretatie(pkey)[source]

Bases: AbstractDovType

Abstract base class for interpretations that can be linked to boreholes or cone penetration tests.

Methods

extend_fields(extra_fields)

Extend the fields of this type with given extra fields and return the new fieldset.

from_wfs(response, namespace)

Build instances of this type from a WFS response.

from_wfs_element(feature, namespace)

Build an instance of this type from a WFS feature element.

get_df_array([return_fields, session])

Return the data array of the instance of this type for inclusion in the resulting output dataframe of a search operation.

get_field_names([return_fields, ...])

Return the names of the fields available for this type.

get_fields([source, include_subtypes])

Return the metadata of the fields available for this type.

get_xsd_schemas()

Get a set of distinct XSD schema URLs for this type and its subtypes.

to_df_array(iterable[, return_fields])

Returns a dataframe array with one or more arrays (rows) for each instance in the given iterable.

Initialisation.

Parameters:
pkeystr

Permanent key of the Interpretatie (interpretations), being a URI of the form https://www.dov.vlaanderen.be/data/interpretatie/<id>.

Methods

extend_fields(extra_fields)

Extend the fields of this type with given extra fields and return the new fieldset.

from_wfs(response, namespace)

Build instances of this type from a WFS response.

from_wfs_element(feature, namespace)

Build an instance of this type from a WFS feature element.

get_df_array([return_fields, session])

Return the data array of the instance of this type for inclusion in the resulting output dataframe of a search operation.

get_field_names([return_fields, ...])

Return the names of the fields available for this type.

get_fields([source, include_subtypes])

Return the metadata of the fields available for this type.

get_xsd_schemas()

Get a set of distinct XSD schema URLs for this type and its subtypes.

to_df_array(iterable[, return_fields])

Returns a dataframe array with one or more arrays (rows) for each instance in the given iterable.

class pydov.types.interpretaties.FormeleStratigrafie(pkey)[source]

Bases: AbstractCommonInterpretatie

Class representing the DOV data type for ‘Formele stratigrafie’ interpretations.

Methods

extend_fields(extra_fields)

Extend the fields of this type with given extra fields and return the new fieldset.

from_wfs(response, namespace)

Build instances of this type from a WFS response.

from_wfs_element(feature, namespace)

Build an instance of this type from a WFS feature element.

get_df_array([return_fields, session])

Return the data array of the instance of this type for inclusion in the resulting output dataframe of a search operation.

get_field_names([return_fields, ...])

Return the names of the fields available for this type.

get_fields([source, include_subtypes])

Return the metadata of the fields available for this type.

get_xsd_schemas()

Get a set of distinct XSD schema URLs for this type and its subtypes.

to_df_array(iterable[, return_fields])

Returns a dataframe array with one or more arrays (rows) for each instance in the given iterable.

Initialisation.

Parameters:
pkeystr

Permanent key of the Interpretatie (interpretations), being a URI of the form https://www.dov.vlaanderen.be/data/interpretatie/<id>.

Methods

extend_fields(extra_fields)

Extend the fields of this type with given extra fields and return the new fieldset.

from_wfs(response, namespace)

Build instances of this type from a WFS response.

from_wfs_element(feature, namespace)

Build an instance of this type from a WFS feature element.

get_df_array([return_fields, session])

Return the data array of the instance of this type for inclusion in the resulting output dataframe of a search operation.

get_field_names([return_fields, ...])

Return the names of the fields available for this type.

get_fields([source, include_subtypes])

Return the metadata of the fields available for this type.

get_xsd_schemas()

Get a set of distinct XSD schema URLs for this type and its subtypes.

to_df_array(iterable[, return_fields])

Returns a dataframe array with one or more arrays (rows) for each instance in the given iterable.

class pydov.types.interpretaties.FormeleStratigrafieLaag[source]

Bases: AbstractDovSubType

Initialisation.

Parameters:
namestr

The name associated with this subtype.

Methods

extend_fields(extra_fields)

Extend the fields of this type with given extra fields and return the new fieldset.

from_xml(xml_data)

Build instances of this subtype from XML data.

from_xml_element(element)

Build an instance of this subtype from a single XML element.

get_field_names()

Return the names of the fields available for this type.

get_fields()

Return the metadata of the fields available for this type.

get_name()

Return the name associated with this subtype.

class pydov.types.interpretaties.GecodeerdeLithologie(pkey)[source]

Bases: AbstractBoringInterpretatie

Class representing the DOV data type for ‘gecodeerde lithologie’ interpretations.

Methods

extend_fields(extra_fields)

Extend the fields of this type with given extra fields and return the new fieldset.

from_wfs(response, namespace)

Build instances of this type from a WFS response.

from_wfs_element(feature, namespace)

Build an instance of this type from a WFS feature element.

get_df_array([return_fields, session])

Return the data array of the instance of this type for inclusion in the resulting output dataframe of a search operation.

get_field_names([return_fields, ...])

Return the names of the fields available for this type.

get_fields([source, include_subtypes])

Return the metadata of the fields available for this type.

get_xsd_schemas()

Get a set of distinct XSD schema URLs for this type and its subtypes.

to_df_array(iterable[, return_fields])

Returns a dataframe array with one or more arrays (rows) for each instance in the given iterable.

Initialisation.

Parameters:
pkeystr

Permanent key of the Interpretatie (interpretations), being a URI of the form https://www.dov.vlaanderen.be/data/interpretatie/<id>.

Methods

extend_fields(extra_fields)

Extend the fields of this type with given extra fields and return the new fieldset.

from_wfs(response, namespace)

Build instances of this type from a WFS response.

from_wfs_element(feature, namespace)

Build an instance of this type from a WFS feature element.

get_df_array([return_fields, session])

Return the data array of the instance of this type for inclusion in the resulting output dataframe of a search operation.

get_field_names([return_fields, ...])

Return the names of the fields available for this type.

get_fields([source, include_subtypes])

Return the metadata of the fields available for this type.

get_xsd_schemas()

Get a set of distinct XSD schema URLs for this type and its subtypes.

to_df_array(iterable[, return_fields])

Returns a dataframe array with one or more arrays (rows) for each instance in the given iterable.

class pydov.types.interpretaties.GecodeerdeLithologieLaag[source]

Bases: AbstractDovSubType

Initialisation.

Parameters:
namestr

The name associated with this subtype.

Methods

extend_fields(extra_fields)

Extend the fields of this type with given extra fields and return the new fieldset.

from_xml(xml_data)

Build instances of this subtype from XML data.

from_xml_element(element)

Build an instance of this subtype from a single XML element.

get_field_names()

Return the names of the fields available for this type.

get_fields()

Return the metadata of the fields available for this type.

get_name()

Return the name associated with this subtype.

class pydov.types.interpretaties.GeotechnischeCodering(pkey)[source]

Bases: AbstractBoringInterpretatie

Class representing the DOV data type for ‘geotechnische codering’ interpretations.

Methods

extend_fields(extra_fields)

Extend the fields of this type with given extra fields and return the new fieldset.

from_wfs(response, namespace)

Build instances of this type from a WFS response.

from_wfs_element(feature, namespace)

Build an instance of this type from a WFS feature element.

get_df_array([return_fields, session])

Return the data array of the instance of this type for inclusion in the resulting output dataframe of a search operation.

get_field_names([return_fields, ...])

Return the names of the fields available for this type.

get_fields([source, include_subtypes])

Return the metadata of the fields available for this type.

get_xsd_schemas()

Get a set of distinct XSD schema URLs for this type and its subtypes.

to_df_array(iterable[, return_fields])

Returns a dataframe array with one or more arrays (rows) for each instance in the given iterable.

Initialisation.

Parameters:
pkeystr

Permanent key of the Interpretatie (interpretations), being a URI of the form https://www.dov.vlaanderen.be/data/interpretatie/<id>.

Methods

extend_fields(extra_fields)

Extend the fields of this type with given extra fields and return the new fieldset.

from_wfs(response, namespace)

Build instances of this type from a WFS response.

from_wfs_element(feature, namespace)

Build an instance of this type from a WFS feature element.

get_df_array([return_fields, session])

Return the data array of the instance of this type for inclusion in the resulting output dataframe of a search operation.

get_field_names([return_fields, ...])

Return the names of the fields available for this type.

get_fields([source, include_subtypes])

Return the metadata of the fields available for this type.

get_xsd_schemas()

Get a set of distinct XSD schema URLs for this type and its subtypes.

to_df_array(iterable[, return_fields])

Returns a dataframe array with one or more arrays (rows) for each instance in the given iterable.

class pydov.types.interpretaties.GeotechnischeCoderingLaag[source]

Bases: AbstractDovSubType

Initialisation.

Parameters:
namestr

The name associated with this subtype.

Methods

extend_fields(extra_fields)

Extend the fields of this type with given extra fields and return the new fieldset.

from_xml(xml_data)

Build instances of this subtype from XML data.

from_xml_element(element)

Build an instance of this subtype from a single XML element.

get_field_names()

Return the names of the fields available for this type.

get_fields()

Return the metadata of the fields available for this type.

get_name()

Return the name associated with this subtype.

class pydov.types.interpretaties.HydrogeologischeStratigrafie(pkey)[source]

Bases: AbstractBoringInterpretatie

Class representing the DOV data type for ‘hydrogeologische stratigrafie’ interpretations.

Methods

extend_fields(extra_fields)

Extend the fields of this type with given extra fields and return the new fieldset.

from_wfs(response, namespace)

Build instances of this type from a WFS response.

from_wfs_element(feature, namespace)

Build an instance of this type from a WFS feature element.

get_df_array([return_fields, session])

Return the data array of the instance of this type for inclusion in the resulting output dataframe of a search operation.

get_field_names([return_fields, ...])

Return the names of the fields available for this type.

get_fields([source, include_subtypes])

Return the metadata of the fields available for this type.

get_xsd_schemas()

Get a set of distinct XSD schema URLs for this type and its subtypes.

to_df_array(iterable[, return_fields])

Returns a dataframe array with one or more arrays (rows) for each instance in the given iterable.

Initialisation.

Parameters:
pkeystr

Permanent key of the Interpretatie (interpretations), being a URI of the form https://www.dov.vlaanderen.be/data/interpretatie/<id>.

Methods

extend_fields(extra_fields)

Extend the fields of this type with given extra fields and return the new fieldset.

from_wfs(response, namespace)

Build instances of this type from a WFS response.

from_wfs_element(feature, namespace)

Build an instance of this type from a WFS feature element.

get_df_array([return_fields, session])

Return the data array of the instance of this type for inclusion in the resulting output dataframe of a search operation.

get_field_names([return_fields, ...])

Return the names of the fields available for this type.

get_fields([source, include_subtypes])

Return the metadata of the fields available for this type.

get_xsd_schemas()

Get a set of distinct XSD schema URLs for this type and its subtypes.

to_df_array(iterable[, return_fields])

Returns a dataframe array with one or more arrays (rows) for each instance in the given iterable.

class pydov.types.interpretaties.HydrogeologischeStratigrafieLaag[source]

Bases: AbstractDovSubType

Initialisation.

Parameters:
namestr

The name associated with this subtype.

Methods

extend_fields(extra_fields)

Extend the fields of this type with given extra fields and return the new fieldset.

from_xml(xml_data)

Build instances of this subtype from XML data.

from_xml_element(element)

Build an instance of this subtype from a single XML element.

get_field_names()

Return the names of the fields available for this type.

get_fields()

Return the metadata of the fields available for this type.

get_name()

Return the name associated with this subtype.

class pydov.types.interpretaties.InformeleHydrogeologischeStratigrafie(pkey)[source]

Bases: AbstractBoringInterpretatie

Class representing the DOV data type for ‘informele stratigrafie’ interpretations.

Methods

extend_fields(extra_fields)

Extend the fields of this type with given extra fields and return the new fieldset.

from_wfs(response, namespace)

Build instances of this type from a WFS response.

from_wfs_element(feature, namespace)

Build an instance of this type from a WFS feature element.

get_df_array([return_fields, session])

Return the data array of the instance of this type for inclusion in the resulting output dataframe of a search operation.

get_field_names([return_fields, ...])

Return the names of the fields available for this type.

get_fields([source, include_subtypes])

Return the metadata of the fields available for this type.

get_xsd_schemas()

Get a set of distinct XSD schema URLs for this type and its subtypes.

to_df_array(iterable[, return_fields])

Returns a dataframe array with one or more arrays (rows) for each instance in the given iterable.

Initialisation.

Parameters:
pkeystr

Permanent key of the Interpretatie (interpretations), being a URI of the form https://www.dov.vlaanderen.be/data/interpretatie/<id>.

Methods

extend_fields(extra_fields)

Extend the fields of this type with given extra fields and return the new fieldset.

from_wfs(response, namespace)

Build instances of this type from a WFS response.

from_wfs_element(feature, namespace)

Build an instance of this type from a WFS feature element.

get_df_array([return_fields, session])

Return the data array of the instance of this type for inclusion in the resulting output dataframe of a search operation.

get_field_names([return_fields, ...])

Return the names of the fields available for this type.

get_fields([source, include_subtypes])

Return the metadata of the fields available for this type.

get_xsd_schemas()

Get a set of distinct XSD schema URLs for this type and its subtypes.

to_df_array(iterable[, return_fields])

Returns a dataframe array with one or more arrays (rows) for each instance in the given iterable.

class pydov.types.interpretaties.InformeleHydrogeologischeStratigrafieLaag[source]

Bases: AbstractDovSubType

Initialisation.

Parameters:
namestr

The name associated with this subtype.

Methods

extend_fields(extra_fields)

Extend the fields of this type with given extra fields and return the new fieldset.

from_xml(xml_data)

Build instances of this subtype from XML data.

from_xml_element(element)

Build an instance of this subtype from a single XML element.

get_field_names()

Return the names of the fields available for this type.

get_fields()

Return the metadata of the fields available for this type.

get_name()

Return the name associated with this subtype.

class pydov.types.interpretaties.InformeleStratigrafie(pkey)[source]

Bases: AbstractCommonInterpretatie

Class representing the DOV data type for ‘informele stratigrafie’ interpretations.

Methods

extend_fields(extra_fields)

Extend the fields of this type with given extra fields and return the new fieldset.

from_wfs(response, namespace)

Build instances of this type from a WFS response.

from_wfs_element(feature, namespace)

Build an instance of this type from a WFS feature element.

get_df_array([return_fields, session])

Return the data array of the instance of this type for inclusion in the resulting output dataframe of a search operation.

get_field_names([return_fields, ...])

Return the names of the fields available for this type.

get_fields([source, include_subtypes])

Return the metadata of the fields available for this type.

get_xsd_schemas()

Get a set of distinct XSD schema URLs for this type and its subtypes.

to_df_array(iterable[, return_fields])

Returns a dataframe array with one or more arrays (rows) for each instance in the given iterable.

Initialisation.

Parameters:
pkeystr

Permanent key of the Interpretatie (interpretations), being a URI of the form https://www.dov.vlaanderen.be/data/interpretatie/<id>.

Methods

extend_fields(extra_fields)

Extend the fields of this type with given extra fields and return the new fieldset.

from_wfs(response, namespace)

Build instances of this type from a WFS response.

from_wfs_element(feature, namespace)

Build an instance of this type from a WFS feature element.

get_df_array([return_fields, session])

Return the data array of the instance of this type for inclusion in the resulting output dataframe of a search operation.

get_field_names([return_fields, ...])

Return the names of the fields available for this type.

get_fields([source, include_subtypes])

Return the metadata of the fields available for this type.

get_xsd_schemas()

Get a set of distinct XSD schema URLs for this type and its subtypes.

to_df_array(iterable[, return_fields])

Returns a dataframe array with one or more arrays (rows) for each instance in the given iterable.

class pydov.types.interpretaties.InformeleStratigrafieLaag[source]

Bases: AbstractDovSubType

Initialisation.

Parameters:
namestr

The name associated with this subtype.

Methods

extend_fields(extra_fields)

Extend the fields of this type with given extra fields and return the new fieldset.

from_xml(xml_data)

Build instances of this subtype from XML data.

from_xml_element(element)

Build an instance of this subtype from a single XML element.

get_field_names()

Return the names of the fields available for this type.

get_fields()

Return the metadata of the fields available for this type.

get_name()

Return the name associated with this subtype.

class pydov.types.interpretaties.LithologischeBeschrijvingLaag[source]

Bases: AbstractDovSubType

Initialisation.

Parameters:
namestr

The name associated with this subtype.

Methods

extend_fields(extra_fields)

Extend the fields of this type with given extra fields and return the new fieldset.

from_xml(xml_data)

Build instances of this subtype from XML data.

from_xml_element(element)

Build an instance of this subtype from a single XML element.

get_field_names()

Return the names of the fields available for this type.

get_fields()

Return the metadata of the fields available for this type.

get_name()

Return the name associated with this subtype.

class pydov.types.interpretaties.LithologischeBeschrijvingen(pkey)[source]

Bases: AbstractBoringInterpretatie

Class representing the DOV data type for ‘lithologische beschrijvingen’ interpretations.

Methods

extend_fields(extra_fields)

Extend the fields of this type with given extra fields and return the new fieldset.

from_wfs(response, namespace)

Build instances of this type from a WFS response.

from_wfs_element(feature, namespace)

Build an instance of this type from a WFS feature element.

get_df_array([return_fields, session])

Return the data array of the instance of this type for inclusion in the resulting output dataframe of a search operation.

get_field_names([return_fields, ...])

Return the names of the fields available for this type.

get_fields([source, include_subtypes])

Return the metadata of the fields available for this type.

get_xsd_schemas()

Get a set of distinct XSD schema URLs for this type and its subtypes.

to_df_array(iterable[, return_fields])

Returns a dataframe array with one or more arrays (rows) for each instance in the given iterable.

Initialisation.

Parameters:
pkeystr

Permanent key of the Interpretatie (interpretations), being a URI of the form https://www.dov.vlaanderen.be/data/interpretatie/<id>.

Methods

extend_fields(extra_fields)

Extend the fields of this type with given extra fields and return the new fieldset.

from_wfs(response, namespace)

Build instances of this type from a WFS response.

from_wfs_element(feature, namespace)

Build an instance of this type from a WFS feature element.

get_df_array([return_fields, session])

Return the data array of the instance of this type for inclusion in the resulting output dataframe of a search operation.

get_field_names([return_fields, ...])

Return the names of the fields available for this type.

get_fields([source, include_subtypes])

Return the metadata of the fields available for this type.

get_xsd_schemas()

Get a set of distinct XSD schema URLs for this type and its subtypes.

to_df_array(iterable[, return_fields])

Returns a dataframe array with one or more arrays (rows) for each instance in the given iterable.

class pydov.types.interpretaties.PkeyBoringField[source]

Bases: _CustomWfsField

Custom field to populate pkey_boring in case the interpretation is linked with a Boring.

Methods

calculate(instance)

Calculate the value of this custom field for the given instance.

clear()

copy()

fromkeys(iterable[, value])

Create a new dictionary with keys from iterable and values set to value.

get(key[, default])

Return the value for key if key is in the dictionary, else default.

items()

keys()

pop(key[, default])

If key is not found, default is returned if given, otherwise KeyError is raised

popitem(/)

Remove and return a (key, value) pair as a 2-tuple.

requires_wfs_fields()

Get a list of WFS fields that are required by (the calculation of) this custom field.

setdefault(key[, default])

Insert key with a value of default if key is not in the dictionary.

update([E, ]**F)

If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

values()

Initialise a custom field.

Parameters:
namestr

Name of this field in the return dataframe.

datatypeone of ‘string’, ‘integer’, ‘float’, ‘date’, ‘datetime’ or ‘boolean’

Datatype of the values of this field in the return dataframe.

definitionstr, optional

Definition of this field.

notnullbool, optional, defaults to False

True if this field is always present (mandatory), False otherwise.

Methods

calculate(instance)

Calculate the value of this custom field for the given instance.

clear()

copy()

fromkeys(iterable[, value])

Create a new dictionary with keys from iterable and values set to value.

get(key[, default])

Return the value for key if key is in the dictionary, else default.

items()

keys()

pop(key[, default])

If key is not found, default is returned if given, otherwise KeyError is raised

popitem(/)

Remove and return a (key, value) pair as a 2-tuple.

requires_wfs_fields()

Get a list of WFS fields that are required by (the calculation of) this custom field.

setdefault(key[, default])

Insert key with a value of default if key is not in the dictionary.

update([E, ]**F)

If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

values()

calculate(instance)[source]

Calculate the value of this custom field for the given instance.

Parameters:
instanceAbstractDovType

Instance of the corresponding type, containing all WFS values in its data dictionary.

Returns:
Value to be used for this custom field for this instance. Its datatype
should match the one set in the initialisation of the custom field.
Raises:
NotImplementedError

Implement this in a subclass.

requires_wfs_fields()[source]

Get a list of WFS fields that are required by (the calculation of) this custom field.

Returns:
list of str

List of WFS fieldnames that is required by this custom field.

Raises:
NotImplementedError

Implement this in a subclass.

class pydov.types.interpretaties.PkeySonderingField[source]

Bases: _CustomWfsField

Custom field to populate pkey_sondering in case the interpretation is linked with a Sondering.

Methods

calculate(instance)

Calculate the value of this custom field for the given instance.

clear()

copy()

fromkeys(iterable[, value])

Create a new dictionary with keys from iterable and values set to value.

get(key[, default])

Return the value for key if key is in the dictionary, else default.

items()

keys()

pop(key[, default])

If key is not found, default is returned if given, otherwise KeyError is raised

popitem(/)

Remove and return a (key, value) pair as a 2-tuple.

requires_wfs_fields()

Get a list of WFS fields that are required by (the calculation of) this custom field.

setdefault(key[, default])

Insert key with a value of default if key is not in the dictionary.

update([E, ]**F)

If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

values()

Initialise a custom field.

Parameters:
namestr

Name of this field in the return dataframe.

datatypeone of ‘string’, ‘integer’, ‘float’, ‘date’, ‘datetime’ or ‘boolean’

Datatype of the values of this field in the return dataframe.

definitionstr, optional

Definition of this field.

notnullbool, optional, defaults to False

True if this field is always present (mandatory), False otherwise.

Methods

calculate(instance)

Calculate the value of this custom field for the given instance.

clear()

copy()

fromkeys(iterable[, value])

Create a new dictionary with keys from iterable and values set to value.

get(key[, default])

Return the value for key if key is in the dictionary, else default.

items()

keys()

pop(key[, default])

If key is not found, default is returned if given, otherwise KeyError is raised

popitem(/)

Remove and return a (key, value) pair as a 2-tuple.

requires_wfs_fields()

Get a list of WFS fields that are required by (the calculation of) this custom field.

setdefault(key[, default])

Insert key with a value of default if key is not in the dictionary.

update([E, ]**F)

If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

values()

calculate(instance)[source]

Calculate the value of this custom field for the given instance.

Parameters:
instanceAbstractDovType

Instance of the corresponding type, containing all WFS values in its data dictionary.

Returns:
Value to be used for this custom field for this instance. Its datatype
should match the one set in the initialisation of the custom field.
Raises:
NotImplementedError

Implement this in a subclass.

requires_wfs_fields()[source]

Get a list of WFS fields that are required by (the calculation of) this custom field.

Returns:
list of str

List of WFS fieldnames that is required by this custom field.

Raises:
NotImplementedError

Implement this in a subclass.

class pydov.types.interpretaties.QuartairStratigrafie(pkey)[source]

Bases: AbstractBoringInterpretatie

Class representing the DOV data type for ‘Quartairstratigrafie’ interpretations.

Methods

extend_fields(extra_fields)

Extend the fields of this type with given extra fields and return the new fieldset.

from_wfs(response, namespace)

Build instances of this type from a WFS response.

from_wfs_element(feature, namespace)

Build an instance of this type from a WFS feature element.

get_df_array([return_fields, session])

Return the data array of the instance of this type for inclusion in the resulting output dataframe of a search operation.

get_field_names([return_fields, ...])

Return the names of the fields available for this type.

get_fields([source, include_subtypes])

Return the metadata of the fields available for this type.

get_xsd_schemas()

Get a set of distinct XSD schema URLs for this type and its subtypes.

to_df_array(iterable[, return_fields])

Returns a dataframe array with one or more arrays (rows) for each instance in the given iterable.

Initialisation.

Parameters:
pkeystr

Permanent key of the Interpretatie (interpretations), being a URI of the form https://www.dov.vlaanderen.be/data/interpretatie/<id>.

Methods

extend_fields(extra_fields)

Extend the fields of this type with given extra fields and return the new fieldset.

from_wfs(response, namespace)

Build instances of this type from a WFS response.

from_wfs_element(feature, namespace)

Build an instance of this type from a WFS feature element.

get_df_array([return_fields, session])

Return the data array of the instance of this type for inclusion in the resulting output dataframe of a search operation.

get_field_names([return_fields, ...])

Return the names of the fields available for this type.

get_fields([source, include_subtypes])

Return the metadata of the fields available for this type.

get_xsd_schemas()

Get a set of distinct XSD schema URLs for this type and its subtypes.

to_df_array(iterable[, return_fields])

Returns a dataframe array with one or more arrays (rows) for each instance in the given iterable.

class pydov.types.interpretaties.QuartairStratigrafieLaag[source]

Bases: AbstractDovSubType

Initialisation.

Parameters:
namestr

The name associated with this subtype.

Methods

extend_fields(extra_fields)

Extend the fields of this type with given extra fields and return the new fieldset.

from_xml(xml_data)

Build instances of this subtype from XML data.

from_xml_element(element)

Build an instance of this subtype from a single XML element.

get_field_names()

Return the names of the fields available for this type.

get_fields()

Return the metadata of the fields available for this type.

get_name()

Return the name associated with this subtype.

Grondmonster

Module containing the DOV data type for grondmonster, including subtypes.

class pydov.types.grondmonster.Grondmonster(pkey)[source]

Bases: AbstractDovType

Class representing the DOV data type for ground samples.

Methods

extend_fields(extra_fields)

Extend the fields of this type with given extra fields and return the new fieldset.

from_wfs(response, namespace)

Build instances of this type from a WFS response.

from_wfs_element(feature, namespace)

Build an instance of this type from a WFS feature element.

get_df_array([return_fields, session])

Return the data array of the instance of this type for inclusion in the resulting output dataframe of a search operation.

get_field_names([return_fields, ...])

Return the names of the fields available for this type.

get_fields([source, include_subtypes])

Return the metadata of the fields available for this type.

get_xsd_schemas()

Get a set of distinct XSD schema URLs for this type and its subtypes.

to_df_array(iterable[, return_fields])

Returns a dataframe array with one or more arrays (rows) for each instance in the given iterable.

Initialisation.

Parameters:
pkeystr

Permanent key of the Grondmonster, being a URI of the form https://www.dov.vlaanderen.be/data/grondmonster/<id>.

Methods

extend_fields(extra_fields)

Extend the fields of this type with given extra fields and return the new fieldset.

from_wfs(response, namespace)

Build instances of this type from a WFS response.

from_wfs_element(feature, namespace)

Build an instance of this type from a WFS feature element.

get_df_array([return_fields, session])

Return the data array of the instance of this type for inclusion in the resulting output dataframe of a search operation.

get_field_names([return_fields, ...])

Return the names of the fields available for this type.

get_fields([source, include_subtypes])

Return the metadata of the fields available for this type.

get_xsd_schemas()

Get a set of distinct XSD schema URLs for this type and its subtypes.

to_df_array(iterable[, return_fields])

Returns a dataframe array with one or more arrays (rows) for each instance in the given iterable.

class pydov.types.grondmonster.Korrelverdeling[source]

Bases: AbstractDovSubType

Initialisation.

Parameters:
namestr

The name associated with this subtype.

Methods

extend_fields(extra_fields)

Extend the fields of this type with given extra fields and return the new fieldset.

from_xml(xml_data)

Build instances of this subtype from XML data.

from_xml_element(element)

Build an instance of this subtype from a single XML element.

get_field_names()

Return the names of the fields available for this type.

get_fields()

Return the metadata of the fields available for this type.

get_name()

Return the name associated with this subtype.

Bodemsite

Module containing the DOV data type for bodemsites, including subtypes.

class pydov.types.bodemsite.Bodemsite(pkey)[source]

Bases: AbstractDovType

Class representing the DOV data type for bodemsites.

Methods

extend_fields(extra_fields)

Extend the fields of this type with given extra fields and return the new fieldset.

from_wfs(response, namespace)

Build instances of this type from a WFS response.

from_wfs_element(feature, namespace)

Build an instance of this type from a WFS feature element.

get_df_array([return_fields, session])

Return the data array of the instance of this type for inclusion in the resulting output dataframe of a search operation.

get_field_names([return_fields, ...])

Return the names of the fields available for this type.

get_fields([source, include_subtypes])

Return the metadata of the fields available for this type.

get_xsd_schemas()

Get a set of distinct XSD schema URLs for this type and its subtypes.

to_df_array(iterable[, return_fields])

Returns a dataframe array with one or more arrays (rows) for each instance in the given iterable.

Initialisation.

Parameters:
pkeystr

Permanent key of the Bodemsite, being a URI of the form https://www.dov.vlaanderen.be/data/bodemsite/<id>.

Methods

extend_fields(extra_fields)

Extend the fields of this type with given extra fields and return the new fieldset.

from_wfs(response, namespace)

Build instances of this type from a WFS response.

from_wfs_element(feature, namespace)

Build an instance of this type from a WFS feature element.

get_df_array([return_fields, session])

Return the data array of the instance of this type for inclusion in the resulting output dataframe of a search operation.

get_field_names([return_fields, ...])

Return the names of the fields available for this type.

get_fields([source, include_subtypes])

Return the metadata of the fields available for this type.

get_xsd_schemas()

Get a set of distinct XSD schema URLs for this type and its subtypes.

to_df_array(iterable[, return_fields])

Returns a dataframe array with one or more arrays (rows) for each instance in the given iterable.

Bodemlocatie

Module containing the DOV data type for bodemlocaties, including subtypes.

class pydov.types.bodemlocatie.Bodemlocatie(pkey)[source]

Bases: AbstractDovType

Class representing the DOV data type for bodemlocaties.

Methods

extend_fields(extra_fields)

Extend the fields of this type with given extra fields and return the new fieldset.

from_wfs(response, namespace)

Build instances of this type from a WFS response.

from_wfs_element(feature, namespace)

Build an instance of this type from a WFS feature element.

get_df_array([return_fields, session])

Return the data array of the instance of this type for inclusion in the resulting output dataframe of a search operation.

get_field_names([return_fields, ...])

Return the names of the fields available for this type.

get_fields([source, include_subtypes])

Return the metadata of the fields available for this type.

get_xsd_schemas()

Get a set of distinct XSD schema URLs for this type and its subtypes.

to_df_array(iterable[, return_fields])

Returns a dataframe array with one or more arrays (rows) for each instance in the given iterable.

Initialisation.

Parameters:
pkeystr

Permanent key of the Bodemlocatie, being a URI of the form https://www.dov.vlaanderen.be/data/bodemlocatie/<id>.

Methods

extend_fields(extra_fields)

Extend the fields of this type with given extra fields and return the new fieldset.

from_wfs(response, namespace)

Build instances of this type from a WFS response.

from_wfs_element(feature, namespace)

Build an instance of this type from a WFS feature element.

get_df_array([return_fields, session])

Return the data array of the instance of this type for inclusion in the resulting output dataframe of a search operation.

get_field_names([return_fields, ...])

Return the names of the fields available for this type.

get_fields([source, include_subtypes])

Return the metadata of the fields available for this type.

get_xsd_schemas()

Get a set of distinct XSD schema URLs for this type and its subtypes.

to_df_array(iterable[, return_fields])

Returns a dataframe array with one or more arrays (rows) for each instance in the given iterable.

Bodemdiepteinterval

Module containing the DOV data type for bodemdiepteintervallen, including subtypes.

class pydov.types.bodemdiepteinterval.Bodemdiepteinterval(pkey)[source]

Bases: AbstractDovType

Class representing the DOV data type for bodemdiepteinterval.

Methods

extend_fields(extra_fields)

Extend the fields of this type with given extra fields and return the new fieldset.

from_wfs(response, namespace)

Build instances of this type from a WFS response.

from_wfs_element(feature, namespace)

Build an instance of this type from a WFS feature element.

get_df_array([return_fields, session])

Return the data array of the instance of this type for inclusion in the resulting output dataframe of a search operation.

get_field_names([return_fields, ...])

Return the names of the fields available for this type.

get_fields([source, include_subtypes])

Return the metadata of the fields available for this type.

get_xsd_schemas()

Get a set of distinct XSD schema URLs for this type and its subtypes.

to_df_array(iterable[, return_fields])

Returns a dataframe array with one or more arrays (rows) for each instance in the given iterable.

Initialisation.

Parameters:
pkeystr

Permanent key of the Bodemdiepteinterval, being a URI of the form https://www.dov.vlaanderen.be/data/bodemdiepteinterval/<id>.

Methods

extend_fields(extra_fields)

Extend the fields of this type with given extra fields and return the new fieldset.

from_wfs(response, namespace)

Build instances of this type from a WFS response.

from_wfs_element(feature, namespace)

Build an instance of this type from a WFS feature element.

get_df_array([return_fields, session])

Return the data array of the instance of this type for inclusion in the resulting output dataframe of a search operation.

get_field_names([return_fields, ...])

Return the names of the fields available for this type.

get_fields([source, include_subtypes])

Return the metadata of the fields available for this type.

get_xsd_schemas()

Get a set of distinct XSD schema URLs for this type and its subtypes.

to_df_array(iterable[, return_fields])

Returns a dataframe array with one or more arrays (rows) for each instance in the given iterable.

Bodemmonster

Module containing the DOV data type for bodemmonsters, including subtypes.

class pydov.types.bodemmonster.Bodemmonster(pkey)[source]

Bases: AbstractDovType

Class representing the DOV data type for bodemmonsters.

Methods

extend_fields(extra_fields)

Extend the fields of this type with given extra fields and return the new fieldset.

from_wfs(response, namespace)

Build instances of this type from a WFS response.

from_wfs_element(feature, namespace)

Build an instance of this type from a WFS feature element.

get_df_array([return_fields, session])

Return the data array of the instance of this type for inclusion in the resulting output dataframe of a search operation.

get_field_names([return_fields, ...])

Return the names of the fields available for this type.

get_fields([source, include_subtypes])

Return the metadata of the fields available for this type.

get_xsd_schemas()

Get a set of distinct XSD schema URLs for this type and its subtypes.

to_df_array(iterable[, return_fields])

Returns a dataframe array with one or more arrays (rows) for each instance in the given iterable.

Initialisation.

Parameters:
pkeystr

Permanent key of the Bodemmonster, being a URI of the form https://www.dov.vlaanderen.be/data/bodemmonster/<id>.

Methods

extend_fields(extra_fields)

Extend the fields of this type with given extra fields and return the new fieldset.

from_wfs(response, namespace)

Build instances of this type from a WFS response.

from_wfs_element(feature, namespace)

Build an instance of this type from a WFS feature element.

get_df_array([return_fields, session])

Return the data array of the instance of this type for inclusion in the resulting output dataframe of a search operation.

get_field_names([return_fields, ...])

Return the names of the fields available for this type.

get_fields([source, include_subtypes])

Return the metadata of the fields available for this type.

get_xsd_schemas()

Get a set of distinct XSD schema URLs for this type and its subtypes.

to_df_array(iterable[, return_fields])

Returns a dataframe array with one or more arrays (rows) for each instance in the given iterable.

Bodemobservatie

Module containing the DOV data type for bodemobservaties, including subtypes.

class pydov.types.bodemobservatie.Bodemobservatie(pkey)[source]

Bases: AbstractDovType

Class representing the DOV data type for bodemobservaties.

Methods

extend_fields(extra_fields)

Extend the fields of this type with given extra fields and return the new fieldset.

from_wfs(response, namespace)

Build instances of this type from a WFS response.

from_wfs_element(feature, namespace)

Build an instance of this type from a WFS feature element.

get_df_array([return_fields, session])

Return the data array of the instance of this type for inclusion in the resulting output dataframe of a search operation.

get_field_names([return_fields, ...])

Return the names of the fields available for this type.

get_fields([source, include_subtypes])

Return the metadata of the fields available for this type.

get_xsd_schemas()

Get a set of distinct XSD schema URLs for this type and its subtypes.

to_df_array(iterable[, return_fields])

Returns a dataframe array with one or more arrays (rows) for each instance in the given iterable.

Initialisation.

Parameters:
pkeystr

Permanent key of the Bodemobservatie, being a URI of the form https://www.dov.vlaanderen.be/data/bodemobservatie/<id>.

Methods

extend_fields(extra_fields)

Extend the fields of this type with given extra fields and return the new fieldset.

from_wfs(response, namespace)

Build instances of this type from a WFS response.

from_wfs_element(feature, namespace)

Build an instance of this type from a WFS feature element.

get_df_array([return_fields, session])

Return the data array of the instance of this type for inclusion in the resulting output dataframe of a search operation.

get_field_names([return_fields, ...])

Return the names of the fields available for this type.

get_fields([source, include_subtypes])

Return the metadata of the fields available for this type.

get_xsd_schemas()

Get a set of distinct XSD schema URLs for this type and its subtypes.

to_df_array(iterable[, return_fields])

Returns a dataframe array with one or more arrays (rows) for each instance in the given iterable.

class pydov.types.bodemobservatie.Fractiemeting[source]

Bases: AbstractDovSubType

Initialisation.

Parameters:
namestr

The name associated with this subtype.

Methods

extend_fields(extra_fields)

Extend the fields of this type with given extra fields and return the new fieldset.

from_xml(xml_data)

Build instances of this subtype from XML data.

from_xml_element(element)

Build an instance of this subtype from a single XML element.

get_field_names()

Return the names of the fields available for this type.

get_fields()

Return the metadata of the fields available for this type.

get_name()

Return the name associated with this subtype.

Bodemclassificatie

Module containing the DOV data type for bodemclassificatie.

class pydov.types.bodemclassificatie.Bodemclassificatie(pkey)[source]

Bases: AbstractDovType

Class representing the DOV data type for bodemclassificaties.

Methods

extend_fields(extra_fields)

Extend the fields of this type with given extra fields and return the new fieldset.

from_wfs(response, namespace)

Build instances of this type from a WFS response.

from_wfs_element(feature, namespace)

Build an instance of this type from a WFS feature element.

get_df_array([return_fields, session])

Return the data array of the instance of this type for inclusion in the resulting output dataframe of a search operation.

get_field_names([return_fields, ...])

Return the names of the fields available for this type.

get_fields([source, include_subtypes])

Return the metadata of the fields available for this type.

get_xsd_schemas()

Get a set of distinct XSD schema URLs for this type and its subtypes.

to_df_array(iterable[, return_fields])

Returns a dataframe array with one or more arrays (rows) for each instance in the given iterable.

Initialisation.

Parameters:
pkeystr

Permanent key of the Bodemclassificatie, being a URI of the form https://www.dov.vlaanderen.be/data/**classificatie/<id>.

Methods

extend_fields(extra_fields)

Extend the fields of this type with given extra fields and return the new fieldset.

from_wfs(response, namespace)

Build instances of this type from a WFS response.

from_wfs_element(feature, namespace)

Build an instance of this type from a WFS feature element.

get_df_array([return_fields, session])

Return the data array of the instance of this type for inclusion in the resulting output dataframe of a search operation.

get_field_names([return_fields, ...])

Return the names of the fields available for this type.

get_fields([source, include_subtypes])

Return the metadata of the fields available for this type.

get_xsd_schemas()

Get a set of distinct XSD schema URLs for this type and its subtypes.

to_df_array(iterable[, return_fields])

Returns a dataframe array with one or more arrays (rows) for each instance in the given iterable.

Generic

Module containing the generic DOV data types.

class pydov.types.generic.WfsTypeFactory[source]

Bases: object

Class to generate pydov type classes at runtime for given WFS layers.

Methods

get_wfs_type(layer)

Generate a new pydov WfsType class for the given layer.

static get_wfs_type(layer)[source]

Generate a new pydov WfsType class for the given layer.

Parameters:
layerstr

Workspace qualified layer name, uniquely identifying the layer within the DOV WFS service.

Returns:
class

WfsType class for the given layer.

Fields

Module grouping all classes related to pydov field definitions.

class pydov.types.fields.AbstractField(name, source, datatype, **kwargs)[source]

Bases: dict

Abstract base class for pydov field definitions. Not to be instantiated directly.

Methods

clear()

copy()

fromkeys(iterable[, value])

Create a new dictionary with keys from iterable and values set to value.

get(key[, default])

Return the value for key if key is in the dictionary, else default.

items()

keys()

pop(key[, default])

If key is not found, default is returned if given, otherwise KeyError is raised

popitem(/)

Remove and return a (key, value) pair as a 2-tuple.

setdefault(key[, default])

Insert key with a value of default if key is not in the dictionary.

update([E, ]**F)

If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

values()

Initialise a field.

Parameters:
namestr

Name of this field in the return dataframe.

sourceone of ‘wfs’, ‘xml’, ‘custom_wfs’, ‘custom_xml’

Source of this field.

datatypeone of ‘string’, ‘integer’, ‘float’, ‘date’, ‘datetime’ or ‘boolean’

Datatype of the values of this field in the return dataframe.

Methods

clear()

copy()

fromkeys(iterable[, value])

Create a new dictionary with keys from iterable and values set to value.

get(key[, default])

Return the value for key if key is in the dictionary, else default.

items()

keys()

pop(key[, default])

If key is not found, default is returned if given, otherwise KeyError is raised

popitem(/)

Remove and return a (key, value) pair as a 2-tuple.

setdefault(key[, default])

Insert key with a value of default if key is not in the dictionary.

update([E, ]**F)

If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

values()

class pydov.types.fields.AbstractReturnField(name)[source]

Bases: object

Base class of ReturnField and GeometryReturnField.

Methods

from_field_name(name)

Initialise a new instance from a field name.

Initialisation.

Parameters:
namestr

Name of the return field.

Methods

from_field_name(name)

Initialise a new instance from a field name.

classmethod from_field_name(name)[source]

Initialise a new instance from a field name.

Parameters:
namestr

Field name.

Returns:
Instance of this class.

Instance of ReturnField or GeometryReturnField.

class pydov.types.fields.GeometryReturnField(geometry_field, epsg=None)[source]

Bases: AbstractReturnField

Initialise a geometry return field.

Parameters:
geometry_fieldstr

Name of the geometry field.

epsgint, optional

EPSG code of the CRS of the geometries that will be returned. Defaults to None, which means the default CRS of the WFS layer.

Methods

from_field_name(name)

Initialise a new instance from a field name.

class pydov.types.fields.ReturnField(name)[source]

Bases: AbstractReturnField

Normal (non-geometry) return field.

Methods

from_field_name(name)

Initialise a new instance from a field name.

Initialisation.

Parameters:
namestr

Name of the return field.

Methods

from_field_name(name)

Initialise a new instance from a field name.

class pydov.types.fields.ReturnFieldList(iterable=(), /)[source]

Bases: list

List of return fields used in search methods.

Methods

append(object, /)

Append object to the end of the list.

clear(/)

Remove all items from list.

copy(/)

Return a shallow copy of the list.

count(value, /)

Return number of occurrences of value.

extend(iterable, /)

Extend list by appending elements from the iterable.

from_field_names(*return_fields)

Initiale a ReturnFieldList from a list of return field names.

get_names()

Return a list with all the names of the fields in this ReturnFieldList.

index(value[, start, stop])

Return first index of value.

insert(index, object, /)

Insert object before index.

pop([index])

Remove and return item at index (default last).

remove(value, /)

Remove first occurrence of value.

reverse(/)

Reverse IN PLACE.

sort(*[, key, reverse])

Sort the list in ascending order and return None.

classmethod from_field_names(*return_fields)[source]

Initiale a ReturnFieldList from a list of return field names.

Parameters:
return_fieldslist or set or tuple of str

List, set or tuple of return field names.

Returns:
ReturnFieldList

Equivalent ReturnFieldList.

Raises:
AttributeError

If the value of return_fields is not a list, set or tuple.

get_names()[source]

Return a list with all the names of the fields in this ReturnFieldList.

Returns:
list of str

List of field names.

class pydov.types.fields.WfsField(name, source_field, datatype)[source]

Bases: AbstractField

Class for a field available in the WFS service.

Methods

clear()

copy()

fromkeys(iterable[, value])

Create a new dictionary with keys from iterable and values set to value.

get(key[, default])

Return the value for key if key is in the dictionary, else default.

items()

keys()

pop(key[, default])

If key is not found, default is returned if given, otherwise KeyError is raised

popitem(/)

Remove and return a (key, value) pair as a 2-tuple.

setdefault(key[, default])

Insert key with a value of default if key is not in the dictionary.

update([E, ]**F)

If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

values()

Initialise a WFS field.

Parameters:
namestr

Name of this field in the return dataframe.

source_fieldstr

Name of this field in the source WFS service.

datatypeone of ‘string’, ‘integer’, ‘float’, ‘date’, ‘datetime’ or ‘boolean’

Datatype of the values of this field in the return dataframe.

Methods

clear()

copy()

fromkeys(iterable[, value])

Create a new dictionary with keys from iterable and values set to value.

get(key[, default])

Return the value for key if key is in the dictionary, else default.

items()

keys()

pop(key[, default])

If key is not found, default is returned if given, otherwise KeyError is raised

popitem(/)

Remove and return a (key, value) pair as a 2-tuple.

setdefault(key[, default])

Insert key with a value of default if key is not in the dictionary.

update([E, ]**F)

If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

values()

class pydov.types.fields.XmlField(name, source_xpath, datatype, definition='', notnull=False, xsd_type=None)[source]

Bases: AbstractField

Class for a field available in the XML document.

Methods

clear()

copy()

fromkeys(iterable[, value])

Create a new dictionary with keys from iterable and values set to value.

get(key[, default])

Return the value for key if key is in the dictionary, else default.

items()

keys()

pop(key[, default])

If key is not found, default is returned if given, otherwise KeyError is raised

popitem(/)

Remove and return a (key, value) pair as a 2-tuple.

setdefault(key[, default])

Insert key with a value of default if key is not in the dictionary.

update([E, ]**F)

If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

values()

Initialise an XML field.

Parameters:
namestr

Name of this field in the return dataframe.

source_xpathstr

XPath expression of the values of this field in the source XML document.

datatypeone of ‘string’, ‘integer’, ‘float’, ‘date’, ‘datetime’ or ‘boolean’

Datatype of the values of this field in the return dataframe.

definitionstr, optional

Definition of this field.

notnullbool, optional, defaults to False

True if this field is always present (mandatory), False otherwise.

xsd_typepydov.types.abstract.XsdType, optional

XSD type associated with this field.

Methods

clear()

copy()

fromkeys(iterable[, value])

Create a new dictionary with keys from iterable and values set to value.

get(key[, default])

Return the value for key if key is in the dictionary, else default.

items()

keys()

pop(key[, default])

If key is not found, default is returned if given, otherwise KeyError is raised

popitem(/)

Remove and return a (key, value) pair as a 2-tuple.

setdefault(key[, default])

Insert key with a value of default if key is not in the dictionary.

update([E, ]**F)

If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

values()

class pydov.types.fields.XsdType(xsd_schema, typename)[source]

Bases: object

Class for specifying an XSD type from an XSD schema. This will be resolved at runtime in a list of possible values and their definitions.

Initialise a XSD type reference.

Parameters:
xsd_schemastr

URL of XSD schema record containing the specified typename.

typenamestr

Name of the type.

Module containing generic fields for the location (ligging) of objects.

class pydov.types.ligging.MvMtawField(definition)[source]

Field for retrieving the mv_mtaw value from the height of the point in relevant cases.

Methods

calculate(cls, tree)

Calculate the value of this custom field from the given XML tree.

clear()

copy()

fromkeys(iterable[, value])

Create a new dictionary with keys from iterable and values set to value.

get(key[, default])

Return the value for key if key is in the dictionary, else default.

items()

keys()

pop(key[, default])

If key is not found, default is returned if given, otherwise KeyError is raised

popitem(/)

Remove and return a (key, value) pair as a 2-tuple.

setdefault(key[, default])

Insert key with a value of default if key is not in the dictionary.

update([E, ]**F)

If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

values()

Initialise a MvMtawField (mv_mtaw) with given definition.

Parameters:
definitionstring

Type-specific definition of the mv_mtaw field.

Methods

calculate(cls, tree)

Calculate the value of this custom field from the given XML tree.

clear()

copy()

fromkeys(iterable[, value])

Create a new dictionary with keys from iterable and values set to value.

get(key[, default])

Return the value for key if key is in the dictionary, else default.

items()

keys()

pop(key[, default])

If key is not found, default is returned if given, otherwise KeyError is raised

popitem(/)

Remove and return a (key, value) pair as a 2-tuple.

setdefault(key[, default])

Insert key with a value of default if key is not in the dictionary.

update([E, ]**F)

If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

values()

calculate(cls, tree)[source]

Calculate the value of this custom field from the given XML tree.

Parameters:
clsAbstractDovType

Class of the type this field belongs to.

treeetree.ElementTree

ElementTree of the DOV XML for this instance.

Returns:
Value to be used for this custom field for this instance. Its datatype
should match the one set in the initialisation of the custom field.
Raises:
NotImplementedError

Implement this in a subclass.

Search utilities

Query

Module containing extra query classes to build attribute search queries.

class pydov.util.query.Join(dataframe, on, using=None)[source]

Filter expression to join different searches together.

Internally translates to a PropertyInList:

Join(df, ‘pkey_boring’) is equivalent to

PropertyInList(‘pkey_boring’, list(df[‘pkey_boring’)) which is equivalent to

Or([PropertyIsEqualTo(‘pkey_boring’, x), PropertyIsEqualTo( ‘pkey_boring’, y), …]) for every x, y, in df[‘pkey_boring’]

Methods

toXML()

Return the XML representation of the PropertyInList query.

Initialisation.

Parameters:
dataframepandas.DataFrame

Dataframe to use a basis for joining.

onstr

Name of the column in the queried datatype to join on.

usingstr, optional

Name of the column in the dataframe to use for joining. By default, the same column name as in on is assumed.

Raises:
ValueError

If the using column is not present in the dataframe.

If using is None and the on column is not present in the dataframe.

If the dataframe does not contain at least a single non-null value in the using column.

Methods

toXML()

Return the XML representation of the PropertyInList query.

class pydov.util.query.PropertyInList(propertyname, lst)[source]

Filter expression to test whether a given property has one of the values from a list.

Internally translates to an Or combination of PropertyIsEqualTo expressions:

PropertyInList(‘methode’, [‘spade’, ‘spoelboring’]) is equivalent to

Or([PropertyIsEqualTo(‘methode’, ‘spade’), PropertyIsEqualTo(‘methode’, ‘spoelboring’)])

Methods

toXML()

Return the XML representation of the PropertyInList query.

Initialisation.

Parameters:
propertynamestr

Name of the attribute to query.

lstlist of str

List of literals to match against (exact matches).

Raises:
ValueError

If the given list does not contain at least a single item.

Methods

toXML()

Return the XML representation of the PropertyInList query.

toXML()[source]

Return the XML representation of the PropertyInList query.

Returns:
xmletree.ElementTree

XML representation of the PropertyInList

Location

Module grouping classes for location based filters used for searching.

This module is designed to comply with the WFS 2.0.0 standard, implying Filter Encoding 2.0 and GML 3.2.

class pydov.util.location.AbstractBinarySpatialFilter(type, location)[source]

Bases: AbstractLocationFilter

Class representing a binary spatial filter.

Binary spatial filters are ogc:BinarySpatialOpType elements, i.e. one of Equals, Disjoint, Touches, Within, Overlaps, Crosses, Intersects or Contains.

Methods

set_geometry_column(geometry_column)

Set the name of the geometry column to query.

toXML()

Return the XML representation of the location filter.

Initialise a Binary spatial filter.

Parameters:
typestr

Type of this filter: one of Equals, Disjoint, Touches, Within, Overlaps, Crosses, Intersects or Contains.

locationAbstractLocation

An instance of a location to use as location for the spatial filter.

Methods

set_geometry_column(geometry_column)

Set the name of the geometry column to query.

toXML()

Return the XML representation of the location filter.

set_geometry_column(geometry_column)[source]

Set the name of the geometry column to query.

Parameters:
geometry_columnstr

The name of the geometry column to query.

toXML()[source]

Return the XML representation of the location filter.

Should raise a RuntimeError when called before the geometry column is set through set_geometry_column: location filters without the geometry column name are invalid.

Returns:
etree.Element

XML element of this location filter.

Raises:
RuntimeError

When called before the geometry column name is set: location filters without the geometry column name are invalid.

class pydov.util.location.AbstractLocation[source]

Bases: object

Abstract base class for location types (f.ex. point, box, polygon).

Locations are GML elements, for inclusion in the WFS GetFeature request. As described in the Filter Encoding 2.0 standard, locations are expressed using GML 3.2.

The initialisation should require all necessary parameters to construct a valid location of this type: i.e. all locations should be valid after initialisation.

Methods

get_element()

Return the GML representation of the location.

get_element()[source]

Return the GML representation of the location.

Returns:
etree.Element

XML element of the GML representation of this location.

class pydov.util.location.AbstractLocationFilter[source]

Bases: object

Abstract base class for location filters (f.ex. within, dwithin).

Location filters are ogc:SpatialOpsType elements, for inclusion in the WFS GetFeature request.

The initialisation should accept at least a (subclass of) AbstractLocation and require all additional parameters that are required for a valid location filter of this type.

One exception is the name of the geometry column to query: this is set automatically upon building the WFS GetFeature request using the set_geometry_column method.

Methods

set_geometry_column(geometry_column)

Set the name of the geometry column to query.

toXML()

Return the XML representation of the location filter.

set_geometry_column(geometry_column)[source]

Set the name of the geometry column to query.

Parameters:
geometry_columnstr

The name of the geometry column to query.

toXML()[source]

Return the XML representation of the location filter.

Should raise a RuntimeError when called before the geometry column is set through set_geometry_column: location filters without the geometry column name are invalid.

Returns:
etree.Element

XML element of this location filter.

Raises:
RuntimeError

When called before the geometry column name is set: location filters without the geometry column name are invalid.

class pydov.util.location.Box(minx, miny, maxx, maxy, epsg=31370)[source]

Bases: AbstractLocation

Class representing a box location, also known as bounding box, envelope, extent.

Methods

get_element()

Return the GML representation of the location.

Initialise a Box.

To initialise a Box using GPS coordinates in decimal degrees, use epsg=4326 and enter the longitude range as minx and maxx and the latitude range as miny and maxy.

Parameters:
minxfloat

X coordinate of the lower left corner of the box.

minyfloat

Y coordinate of the lower left corner of the box.

maxxfloat

X coordinate of the upper right corner of the box.

maxyfloat

Y coordinate of the upper right corner of the box.

epsgint, optional

EPSG code of the coordinate reference system (CRS) of the coordinates specified in minx, miny, maxx, maxy. Defaults to 31370 (Belgian Lambert72).

Raises:
ValueError

If maxx is lower than or equal to minx. If maxy is lower than or equal to miny.

Methods

get_element()

Return the GML representation of the location.

get_element()[source]

Return the GML representation of the location.

Returns:
etree.Element

XML element of the GML representation of this location.

class pydov.util.location.Disjoint(location)[source]

Bases: AbstractBinarySpatialFilter

Class representing a spatial Disjoint filter.

A spatial Disjoint will return all points that are disjoint from a polygon or box location: i.e. that are not inside nor on the boundary.

A spatial Disjoint is the inverse of a spatial Intersects.

Methods

set_geometry_column(geometry_column)

Set the name of the geometry column to query.

toXML()

Return the XML representation of the location filter.

Initialise a Disjoint filter.

Parameters:
locationAbstractLocation

An instance of a location to use as location for the Disjoint filter.

Methods

set_geometry_column(geometry_column)

Set the name of the geometry column to query.

toXML()

Return the XML representation of the location filter.

class pydov.util.location.Equals(location)[source]

Bases: AbstractBinarySpatialFilter

Class representing a spatial Equals filter.

A spatial Equals will return all points that are equal to another point.

Methods

set_geometry_column(geometry_column)

Set the name of the geometry column to query.

toXML()

Return the XML representation of the location filter.

Initialise an Equals filter.

Parameters:
locationAbstractLocation

An instance of a location to use as location for the Equals filter.

Methods

set_geometry_column(geometry_column)

Set the name of the geometry column to query.

toXML()

Return the XML representation of the location filter.

class pydov.util.location.GeometryFilter(geometry, location_filter, location_filter_kwargs=None, combinator=<class 'owslib.fes2.Or'>)[source]

Bases: GmlFilter

Class for construction a spatial filter expression from any Geometry Fiona can convert to a GML 3.2 document.

This class requires the fiona package to be installed.

Methods

set_geometry_column(geometry_column)

Set the name of the geometry column to query.

toXML()

Return the XML representation of the location filter.

Initialise a spatial filter expression from a given Geometry.

Parameters:
geometrystr

A path to a vector file on disk.

location_filterclass<AbstractLocationFilter>

Location filter to use for the geometries in the GML document.

location_filter_kwargsdict, optional

Keyword-based arguments to pass to the location_filter on initialisation (with the exception of the location parameter, which is automatically parsed from the geomery). Can be skipped in cases where the location_filter takes no extra arguments besides location.

combinatorclass<BinaryLogicOpType>, optional, defaults to Or

One of (Or, And) used to combine filters for different geometries in the geometry document.

Raises:
ValueError

When no geometries could be parsed from the given geometry.

Methods

set_geometry_column(geometry_column)

Set the name of the geometry column to query.

toXML()

Return the XML representation of the location filter.

class pydov.util.location.GeopandasFilter(geodataframe, location_filter, location_filter_kwargs=None, combinator=<class 'owslib.fes2.Or'>)[source]

Bases: GmlFilter

Class for construction a spatial filter expression from a GeoPandas object.

This class requires the geopandas package to be installed.

Methods

set_geometry_column(geometry_column)

Set the name of the geometry column to query.

toXML()

Return the XML representation of the location filter.

Initialise a spatial filter expression from a GeoPandas GeoDataFrame.

Parameters:
geodataframeGeoPandas.GeoDataFrame

A GeoDataFrame with a valid crs.

location_filterclass<AbstractLocationFilter>

Location filter to use for the geometries in the GML document.

location_filter_kwargsdict, optional

Keyword-based arguments to pass to the location_filter on initialisation (with the exception of the location parameter, which is automatically parsed from the geomery). Can be skipped in cases where the location_filter takes no extra arguments besides location.

combinatorclass<BinaryLogicOpType>, optional, defaults to Or

One of (Or, And) used to combine filters for different geometries in the geometry document.

Raises:
ValueError

When no geometries could be parsed from the given geometry.

Methods

set_geometry_column(geometry_column)

Set the name of the geometry column to query.

toXML()

Return the XML representation of the location filter.

class pydov.util.location.GmlFilter(gml, location_filter, location_filter_kwargs=None, combinator=<class 'owslib.fes2.Or'>)[source]

Bases: AbstractLocationFilter

Class for construction a spatial filter expression from a GML3.2 document.

Methods

set_geometry_column(geometry_column)

Set the name of the geometry column to query.

toXML()

Return the XML representation of the location filter.

Initialise a spatial filter expression from a GML3.2 string.

Parameters:
gmlstr

Either a string representation of the GML document to parse, or a path to a GML3.2 file on disk.

location_filterclass<AbstractLocationFilter>

Location filter to use for the geometries in the GML document.

location_filter_kwargsdict, optional

Keyword-based arguments to pass to the location_filter on initialisation (with the exception of the location parameter, which is automatically parsed from the GML). Can be skipped in cases where the location_filter takes no extra arguments besides location.

combinatorclass<BinaryLogicOpType>, optional, defaults to Or

One of (Or, And) used to combine filters for different geometries in the GML document.

Raises:
ValueError

When no geometries could be parsed from the given GML record.

Methods

set_geometry_column(geometry_column)

Set the name of the geometry column to query.

toXML()

Return the XML representation of the location filter.

set_geometry_column(geometry_column)[source]

Set the name of the geometry column to query.

Parameters:
geometry_columnstr

The name of the geometry column to query.

toXML()[source]

Return the XML representation of the location filter.

Should raise a RuntimeError when called before the geometry column is set through set_geometry_column: location filters without the geometry column name are invalid.

Returns:
etree.Element

XML element of this location filter.

Raises:
RuntimeError

When called before the geometry column name is set: location filters without the geometry column name are invalid.

class pydov.util.location.GmlObject(gml_element)[source]

Bases: AbstractLocation

Class representing a raw GML3.2 location, f.ex. gml32:Surface or gml32:MultiSurface.

Methods

get_element()

Return the GML representation of the location.

Initialise a GmlObject.

Initialise a GmlObject from an existing XML element representing a GML3.2 location.

Parameters:
gml_elementetree.Element or str or bytes

XML element of the GML3.2 location, either as etree.Element, bytes or string representation.

Methods

get_element()

Return the GML representation of the location.

get_element()[source]

Return the GML representation of the location.

Returns:
etree.Element

XML element of the GML representation of this location.

class pydov.util.location.Intersects(location)[source]

Bases: AbstractBinarySpatialFilter

Class representing a spatial Intersects filter.

A spatial Intersects will return all points that are within or on the boundary of a polygon or box location.

A spatial Intersects is the inverse of a spatial Disjoint.

Methods

set_geometry_column(geometry_column)

Set the name of the geometry column to query.

toXML()

Return the XML representation of the location filter.

Initialise an Intersects filter.

Parameters:
locationAbstractLocation

An instance of a location to use as location for the Intersects filter.

Methods

set_geometry_column(geometry_column)

Set the name of the geometry column to query.

toXML()

Return the XML representation of the location filter.

class pydov.util.location.Point(x, y, epsg=31370)[source]

Bases: AbstractLocation

Class representing a point location.

Methods

get_element()

Return the GML representation of the location.

Initialise a Point.

To initialise a Point using GPS coordinates in decimal degrees, use epsg=4326 and enter the longitude as x and the latitude as y.

Parameters:
xfloat

X coordinate (or longitude) of the point.

yfloat

Y coordinate (or latitude) of the point.

epsgint, optional

EPSG code of the coordinate reference system (CRS) of the coordinates specified in x, y. Defaults to 31370 (Belgian Lambert72).

Methods

get_element()

Return the GML representation of the location.

get_element()[source]

Return the GML representation of the location.

Returns:
etree.Element

XML element of the GML representation of this location.

class pydov.util.location.Touches(location)[source]

Bases: AbstractBinarySpatialFilter

Class representing a spatial Touches filter.

A spatial Touches will return all points that touch a polygon or box location: i.e. that are on the boundary but not inside.

Methods

set_geometry_column(geometry_column)

Set the name of the geometry column to query.

toXML()

Return the XML representation of the location filter.

Initialise a Touches filter.

Parameters:
locationAbstractLocation

An instance of a location to use as location for the Touches filter.

Methods

set_geometry_column(geometry_column)

Set the name of the geometry column to query.

toXML()

Return the XML representation of the location filter.

class pydov.util.location.Within(location)[source]

Bases: AbstractBinarySpatialFilter

Class representing a spatial Within filter.

A spatial Within will return all points that are entirely within a polygon or box location (i.e. are not on the boundary).

Methods

set_geometry_column(geometry_column)

Set the name of the geometry column to query.

toXML()

Return the XML representation of the location filter.

Initialise a Within filter.

Parameters:
locationAbstractLocation

An instance of a location to use as location for the Within filter.

Methods

set_geometry_column(geometry_column)

Set the name of the geometry column to query.

toXML()

Return the XML representation of the location filter.

class pydov.util.location.WithinDistance(location, distance, distance_unit='meter')[source]

Bases: AbstractLocationFilter

Class representing a spatial DWithin filter.

A spatial DWithin will return all points that are within a given distance of a certain location.

Methods

set_geometry_column(geometry_column)

Set the name of the geometry column to query.

toXML()

Return the XML representation of the location filter.

Initialise a WithinDistance filter.

Parameters:
locationAbstractLocation

An instance of a location to use as location for the WithinDistance filter.

distancefloat

Amount of distance units to use for the filter.

distance_unitstring, optional, defaults to ‘meter’

The distance unit of the value of distance.

Methods

set_geometry_column(geometry_column)

Set the name of the geometry column to query.

toXML()

Return the XML representation of the location filter.

set_geometry_column(geometry_column)[source]

Set the name of the geometry column to query.

Parameters:
geometry_columnstr

The name of the geometry column to query.

toXML()[source]

Return the XML representation of the location filter.

Should raise a RuntimeError when called before the geometry column is set through set_geometry_column: location filters without the geometry column name are invalid.

Returns:
etree.Element

XML element of this location filter.

Raises:
RuntimeError

When called before the geometry column name is set: location filters without the geometry column name are invalid.

OWS utilities

Module grouping utility functions for OWS services.

pydov.util.owsutil.get_csw_base_url(contentmetadata)[source]

Get the CSW base url for the remote metadata associated with the layer described in contentmetadata.

Parameters:
contentmetadataowslib.feature.wfs110.ContentMetadata

Content metadata associated with a WFS layer.

Returns:
urlstr or None

Base URL of the CSW service where the remote metadata and feature catalogue can be requested or None when no metadata URL could be found.

pydov.util.owsutil.get_featurecatalogue_uuid(md_metadata)[source]

Get the UUID of the feature catalogue associated with the metadata.

Parameters:
md_metadataowslib.iso.MD_Metadata

Metadata parsed according to the ISO 19115/19139 format.

Returns:
uuidstr or None

Universally unique identifier of the feature catalogue associated with the metadata or None when there is no feature catalogue available.

pydov.util.owsutil.get_namespace(wfs, layer)[source]

Request the namespace associated with a layer by performing a DescribeFeatureType request.

Parameters:
wfsowslib.wfs.WebFeatureService

WFS service to use, associated with the layer.

layerstr

Workspace-qualified name of the layer to get the namespace of ( typename).

Returns:
namespacestr

URI of the namespace associated with the given layer.

pydov.util.owsutil.get_remote_featurecatalogue(csw_url, fc_uuid)[source]

Request and parse the remote feature catalogue described by the CSW base url and feature catalogue UUID.

Parameters:
csw_urlstr

Base URL of the CSW service to query, should end with ‘csw’.

fc_uuidstr

Universally unique identifier of the feature catalogue.

Returns:
dict or None

Dictionary with fields described in the feature catalogue, using the following schema, or None when no feature catalogue with the given UUID could not be found:

>>>   {'definition' : 'feature type definition',
>>>    'attributes' : {'name':
>>>      {'definition' : 'attribute definition',
>>>       'values' : ['list of', 'values'],
>>>       'multiplicity': (lower, upper)}
>>>    }
>>>   }

Where the lower multiplicity is always and integer and the upper multiplicity is either an integer or the str ‘Inf’ indicating an infinate value.

pydov.util.owsutil.get_remote_metadata(contentmetadata)[source]

Request and parse the remote metadata associated with the layer described in contentmetadata.

Parameters:
contentmetadataowslib.feature.wfs110.ContentMetadata

Content metadata associated with a WFS layer, containing the associated metadataUrls.

Returns:
owslib.iso.MD_Metadata or None

Parsed remote metadata describing the WFS layer in more detail, in the ISO 19115/19139 format, or None when no metadata could be found or parsed.

pydov.util.owsutil.get_url(url)[source]

Perform a GET request to an OWS service an return the result.

Parameters:
urlstr

URL to request.

Returns:
bytes

Response containing the result of the GET request.

pydov.util.owsutil.get_wfs_capabilities(url)[source]

Perform a GET request to get the WFS capabilities.

Parameters:
urlstr

URL to request.

Returns:
bytes

Response containing the result of the WFS capabilities request.

pydov.util.owsutil.get_wfs_max_features(capabilities)[source]

Get the default maximum number of features the WFS service will return.

Parameters:
capabilitiesbytes

WFS 2.0.0 capabilities document.

pydov.util.owsutil.set_geometry_column(location, geometry_column)[source]

Set the geometry column of the location query recursively.

Parameters:
locationpydov.util.location.AbstractLocationFilter or owslib.fes2.BinaryLogicOpType<AbstractLocationFilter> or owslib.fes2.UnaryLogicOpType<AbstractLocationFilter>

Location filter limiting the features to retrieve. Can either be a single instance of a subclass of AbstractLocationFilter, or a combination using And, Or, Not of AbstractLocationFilters.

geometry_columnstr

The name of the geometry column to query.

Returns:
etree.Element

XML element of this location filter.

pydov.util.owsutil.unique_gml_ids(location)[source]

Make sure the location query has unique GML id’s for all features.

Parameters:
locationetree.ElementTree

XML tree of the location filter.

Returns
——-
etree.ElementTree

XML tree of the location filter with unique GML ids.

pydov.util.owsutil.wfs_build_getfeature_request(typename, geometry_column=None, location=None, filter=None, sort_by=None, propertyname=None, max_features=None, start_index=0, crs=None)[source]

Build a WFS 2.0 GetFeature request in XML to be used as payload in a WFS 2.0 GetFeature request using POST.

Parameters:
typenamestr

Typename to query.

geometry_columnstr, optional

Name of the geometry column to use in the spatial filter. Required if the location parameter is supplied.

locationpydov.util.location.AbstractLocationFilter

Location filter limiting the features to retrieve. Requires geometry_column to be supplied as well.

filterstr of owslib.fes2.FilterRequest, optional

Filter request to search on attribute values.

sort_bystr of owslib.fes2.SortBy, optional

List of properties to sort by.

propertynamelist<str>, optional

List of properties to return. Defaults to all properties.

max_featuresint

Limit the maximum number of features to request.

start_indexint

The index of the first feature to return.

crsstr

EPSG code of the CRS of the geometries that will be returned. Defaults to None, which means the default CRS of the WFS layer.

Returns:
elementetree.Element

XML element representing the WFS GetFeature request.

Raises:
AttributeError

If bbox is given without geometry_column. If max_features has an invalid value. If start_index had an invalid value.

TypeError

If crs is not a string.

ValueError

If crs does not start with ‘EPSG’.

pydov.util.owsutil.wfs_get_feature(baseurl, get_feature_request, session=None)[source]

Perform a WFS request using POST.

Parameters:
baseurlstr

Base URL of the WFS service.

get_feature_requestetree.Element

XML element representing the WFS GetFeature request.

sessionrequests.Session

Session to use to perform HTTP requests for data. Defaults to None, which means a new session will be created for each request.

Returns:
bytes

Response of the WFS service.

DOV utilities

Module grouping utility functions for DOV XML services.

pydov.util.dovutil.build_dov_url(path)[source]

Build the DOV url consisting of the fixed DOV base url, appended with the given path.

Returns:
str

The absolute DOV url.

pydov.util.dovutil.get_dov_xml(url, session=None)[source]

Request the XML from the remote DOV webservices and return it.

Parameters:
urlstr

URL of the DOV object to download.

sessionrequests.Session

Session to use to perform HTTP requests for data. Defaults to None, which means a new session will be created for each request.

Returns:
xmlbytes

The raw XML data of this DOV object as bytes.

pydov.util.dovutil.get_remote_url(url, session=None)[source]

Request the URL from the remote service and return its contents.

Parameters:
urlstr

URL to download.

sessionrequests.Session

Session to use to perform HTTP requests for data. Defaults to None, which means a new session will be created for each request.

Returns:
xmlbytes

The raw XML data as bytes.

pydov.util.dovutil.get_xsd_schema(url)[source]

Request the XSD schema from DOV webservices and return it.

Parameters:
urlstr

URL of the XSD schema to download.

Returns:
xmlbytes

The raw XML data of this XSD schema as bytes.

pydov.util.dovutil.parse_dov_xml(xml_data)[source]

Parse the given XML data into an ElementTree.

Parameters:
xml_databytes

The raw XML data of a DOV object as bytes.

Returns:
treeetree.ElementTree

Parsed XML tree of the DOV object.

Caching

Module implementing a local cache for downloaded XML files.

class pydov.util.caching.AbstractCache[source]

Bases: object

Abstract base class for caching of downloaded XML files from DOV.

Attributes:
stale_on_errorbool, default to True

Whether to return stale responses from the cache in case of a network error prevents downloading a fresh copy.

Methods

clean()

Clean the cache by removing old records from the cache.

get(url[, session])

Get the XML data for the DOV object referenced by the given URL.

remove()

Remove the entire cache.

Initialisation.

Methods

clean()

Clean the cache by removing old records from the cache.

get(url[, session])

Get the XML data for the DOV object referenced by the given URL.

remove()

Remove the entire cache.

clean()[source]

Clean the cache by removing old records from the cache.

Since during normal use the cache only grows by adding new objects and overwriting existing ones with a new version, you can use this function to clean the cache. It will remove all records older than the maximum age from the cache.

get(url, session=None)[source]

Get the XML data for the DOV object referenced by the given URL.

Because of parallel processing, this method will be called simultaneously from multiple threads. Make sure your implementation is threadsafe or uses locking.

If a valid version exists in the cache, it will be loaded and returned. If no valid version exists, the XML will be downloaded from the DOV webservice, saved in the cache and returned.

Parameters:
urlstr

Permanent URL to a DOV object.

sessionrequests.Session

Session to use to perform HTTP requests for data. Defaults to None, which means a new session will be created for each request.

Returns:
xmlbytes

The raw XML data of this DOV object as bytes.

remove()[source]

Remove the entire cache.

class pydov.util.caching.AbstractFileCache(max_age=datetime.timedelta(days=14), cachedir=None)[source]

Bases: AbstractCache

Abstract class for filebased caching of downloaded XML files from DOV.

Methods

clean()

Clean the cache by removing old records from the cache.

get(url[, session])

Get the XML data for the DOV object referenced by the given URL.

remove()

Remove the entire cache directory.

Initialisation.

Set up the instance variables and create the cache directory if it does not exists already.

Parameters:
max_agedatetime.timedelta, optional

The maximum age of a cached XML file to be valid. If the last modification date of the file is before this time, it will be redownloaded. Defaults to two weeks.

cachedirstr, optional

Path of the directory that will be used to save the cached XML files. Be sure to use a directory that will only be used for this PyDOV cache. Default to a temporary directory provided by the operating system.

Methods

clean()

Clean the cache by removing old records from the cache.

get(url[, session])

Get the XML data for the DOV object referenced by the given URL.

remove()

Remove the entire cache directory.

clean()[source]

Clean the cache by removing old records from the cache.

Since during normal use the cache only grows by adding new objects and overwriting existing ones with a new version, you can use this function to clean the cache. It will remove all records older than the maximum age from the cache.

Note that this method is currently not called anywhere in the code, but it is provided as reference.

get(url, session=None)[source]

Get the XML data for the DOV object referenced by the given URL.

Because of parallel processing, this method will be called simultaneously from multiple threads. Make sure your implementation is threadsafe or uses locking.

If a valid version exists in the cache, it will be loaded and returned. If no valid version exists, the XML will be downloaded from the DOV webservice, saved in the cache and returned.

Parameters:
urlstr

Permanent URL to a DOV object.

sessionrequests.Session

Session to use to perform HTTP requests for data. Defaults to None, which means a new session will be created for each request.

Returns:
xmlbytes

The raw XML data of this DOV object as bytes.

remove()[source]

Remove the entire cache directory.

Note that the default directory to save the cache is a temporary location provided by the operating system, and as a subsequence the OS will normally take care of its removal.

Note that this method is currently not called anywhere in the code, but it is provided as reference.

class pydov.util.caching.GzipTextFileCache(max_age=datetime.timedelta(days=14), cachedir=None)[source]

Bases: AbstractFileCache

Class for GZipped text caching of downloaded XML files from DOV.

Methods

clean()

Clean the cache by removing old records from the cache.

get(url[, session])

Get the XML data for the DOV object referenced by the given URL.

remove()

Remove the entire cache directory.

Initialisation.

Set up the instance variables and create the cache directory if it does not exists already.

Parameters:
max_agedatetime.timedelta, optional

The maximum age of a cached XML file to be valid. If the last modification date of the file is before this time, it will be redownloaded. Defaults to two weeks.

cachedirstr, optional

Path of the directory that will be used to save the cached XML files. Be sure to use a directory that will only be used for this PyDOV cache. Default to a temporary directory provided by the operating system.

Methods

clean()

Clean the cache by removing old records from the cache.

get(url[, session])

Get the XML data for the DOV object referenced by the given URL.

remove()

Remove the entire cache directory.

class pydov.util.caching.PlainTextFileCache(max_age=datetime.timedelta(days=14), cachedir=None)[source]

Bases: AbstractFileCache

Class for plain text caching of downloaded XML files from DOV.

Methods

clean()

Clean the cache by removing old records from the cache.

get(url[, session])

Get the XML data for the DOV object referenced by the given URL.

remove()

Remove the entire cache directory.

Initialisation.

Set up the instance variables and create the cache directory if it does not exists already.

Parameters:
max_agedatetime.timedelta, optional

The maximum age of a cached XML file to be valid. If the last modification date of the file is before this time, it will be redownloaded. Defaults to two weeks.

cachedirstr, optional

Path of the directory that will be used to save the cached XML files. Be sure to use a directory that will only be used for this PyDOV cache. Default to a temporary directory provided by the operating system.

Methods

clean()

Clean the cache by removing old records from the cache.

get(url[, session])

Get the XML data for the DOV object referenced by the given URL.

remove()

Remove the entire cache directory.

Hooks

Module implementing a simple hooks system to allow late-binding actions to PyDOV events.

class pydov.util.hooks.AbstractInjectHook[source]

Bases: object

Abstract base class for custom hook implementations.

This class contains all inject hooks: i.e. hooks receiving events and possibly returning custom data for injection into pydov’s execution stack.

Inject hooks allow you to capture and intercept remote server calls, influencing pydov’s inner workings. Use with care! If you reached this part of the code, it is probably wise to open an issue in Github, since this is most likely not what you need.

Provides all available methods with a default implementation to do nothing. This allows for hook subclasses to only implement the events they need.

Methods

inject_meta_response(url)

Inject a response for a metadata request.

inject_wfs_getfeature_response(query)

Inject a response for a WFS GetFeature request.

inject_xml_response(pkey_object)

Inject a response for a DOV XML request.

inject_meta_response(url)[source]

Inject a response for a metadata request.

This allows to intercept a metadata request and return a response of your choice.

When at least one registered hook returns a response for a given URL, the remote call is not executed and instead the response from the last registered hook (that is non-null) is used instead.

Metadata calls include amongst others: WFS GetCapabilities, requests for MD_Metadata, FC_FeatureCatalogue and XSD schemas.

These are all calls except for WFS GetFeature requests and XML downloads of DOV data - these are other hooks.

Parameters:
urlstr

URL of the metadata request.

Returns:
bytes, optional

The response to use in favor of resolving the URL. Return None to disable this inject hook.

inject_wfs_getfeature_response(query)[source]

Inject a response for a WFS GetFeature request.

This allows to intercept a WFS GetFeature request and return a response of your choice.

When at least one registered hook returns a response for a given query, the remote call is not executed and instead the response from the last registered hook (that is non-null) is used instead.

Because of parallel processing, this method will be called simultaneously from multiple threads. Make sure your implementation is threadsafe or uses locking.

Parameters:
queryetree.ElementTree

The WFS GetFeature request sent to the WFS server.

Returns:
xml: bytes, optional

The GetFeature response to use in favor of resolving the URL. Return None to disable this inject hook.

inject_xml_response(pkey_object)[source]

Inject a response for a DOV XML request.

This allows to intercept a DOV XML request and return a response of your choice.

When at least one registered hook returns a response for a given pkey, the remote call is not executed and instead the response from the last registered hook (that is non-null) is used instead.

Because of parallel processing, this method will be called simultaneously from multiple threads. Make sure your implementation is threadsafe or uses locking.

Parameters:
queryetree.ElementTree

The WFS GetFeature request sent to the WFS server.

Returns:
xmlbytes, optional

The XML response to use in favor of resolving the URL. Return None to disable this inject hook.

class pydov.util.hooks.AbstractReadHook[source]

Bases: object

Abstract base class for custom hook implementations.

This class contains all read-only hooks: i.e. hooks receiving events but otherwise not interfering with pydov’s execution stack.

Provides all available methods with a default implementation to do nothing. This allows for hook subclasses to only implement the events they need.

Methods

meta_received(url, response)

Called when a response for a metadata requests is received.

wfs_search_init(params)

Called upon starting a WFS search.

wfs_search_result(number_matched, ...)

Called after a WFS search query finished.

wfs_search_result_received(query, features)

Called after a WFS search finished.

xml_cache_hit(pkey_object)

Called when the XML document of an object is retrieved from the cache.

xml_downloaded(pkey_object)

Called when the XML document of an object is downloaded from the DOV services.

xml_fetch_error(pkey_object)

Called when the XML document of an object failed to be retrieved from the DOV service and no stale version could be returned from the cache.

xml_received(pkey_object, xml)

Called when the XML of a given object is received, either from the cache or from the remote DOV service.

xml_stale_hit(pkey_object)

Called when the XML document of an object failed to be retrieved from the DOV service and a stale version has been returned from the cache.

meta_received(url, response)[source]

Called when a response for a metadata requests is received.

Metadata calls include amongst others: WFS GetCapabilities, requests for MD_Metadata, FC_FeatureCatalogue and XSD schemas.

These are all calls except for WFS GetFeature requests and XML downloads of DOV data - these are other hooks.

Parameters:
urlstr

URL of the metadata request.

responsebytes

The raw response as received from resolving the URL.

wfs_search_init(params)[source]

Called upon starting a WFS search.

Parameters:
paramsdict
Parameters used to initiate WFS search. These include:
typenamestr

Typename in the WFS service to query.

locationpydov.util.location.AbstractLocationFilter or None

Location filter limiting the features to retrieve.

filterstr (xml) or None

Attribute filter limiting the features to retrieve.

sort_bystr (xml) or None

SortBy clause listing fields to sort by.

max_featuresint

Limit the maximum number of features to request.

propertynameslist of str

List of WFS propertynames (attributes) to retrieve.

geometry_columnstr

Name of the column/attribute containing the geometry.

wfs_search_result(number_matched, number_returned)[source]

Called after a WFS search query finished.

Because of parallel processing, this method will be called simultaneously from multiple threads. Make sure your implementation is threadsafe or uses locking.

Parameters:
number_matchedint

The number of features matched by the WFS search query.

number_returnedint

The number of features returned by the WFS search query. Due to server limitations this can be less than number_matched.

wfs_search_result_received(query, features)[source]

Called after a WFS search finished.

Includes both the GetFeature query as well as the response from the WFS server.

Because of parallel processing, this method will be called simultaneously from multiple threads. Make sure your implementation is threadsafe or uses locking.

Parameters:
queryetree.ElementTree

The WFS GetFeature request sent to the WFS server.

featuresetree.ElementTree

The WFS GetFeature response containings the features.

xml_cache_hit(pkey_object)[source]

Called when the XML document of an object is retrieved from the cache.

Because of parallel processing, this method will be called simultaneously from multiple threads. Make sure your implementation is threadsafe or uses locking.

Parameters:
pkey_objectstr

Permanent key of the requested object.

xml_downloaded(pkey_object)[source]

Called when the XML document of an object is downloaded from the DOV services.

Because of parallel processing, this method will be called simultaneously from multiple threads. Make sure your implementation is threadsafe or uses locking.

Parameters:
pkey_objectstr

Permanent key of the requested object.

xml_fetch_error(pkey_object)[source]

Called when the XML document of an object failed to be retrieved from the DOV service and no stale version could be returned from the cache.

Because of parallel processing, this method will be called simultaneously from multiple threads. Make sure your implementation is threadsafe or uses locking.

Parameters:
pkey_objectstr

Permanent key of the requested object.

xml_received(pkey_object, xml)[source]

Called when the XML of a given object is received, either from the cache or from the remote DOV service.

Includes the permanent key of the DOV object as well as the full XML representation.

Because of parallel processing, this method will be called simultaneously from multiple threads. Make sure your implementation is threadsafe or uses locking.

Parameters:
pkey_objectstr

Permanent key of the retrieved object.

xmlbytes

The raw XML data of this DOV object as bytes.

xml_stale_hit(pkey_object)[source]

Called when the XML document of an object failed to be retrieved from the DOV service and a stale version has been returned from the cache.

Because of parallel processing, this method will be called simultaneously from multiple threads. Make sure your implementation is threadsafe or uses locking.

Parameters:
pkey_objectstr

Permanent key of the requested object.

class pydov.util.hooks.HookRunner[source]

Bases: object

Class for executing registered hooks.

Methods

execute_inject_meta_response(url)

Execute the inject_meta_response method for all registered hooks.

execute_inject_wfs_getfeature_response(query)

Execute the inject_wfs_getfeature_response method for all registered hooks.

execute_inject_xml_response(pkey_object)

Execute the inject_xml_response method for all registered hooks.

execute_meta_received(url, response)

Execute the meta_received method for all registered hooks.

execute_wfs_search_init(params)

Execute the wfs_search_init method for all registered hooks.

execute_wfs_search_result(number_matched, ...)

Execute the wfs_search_result method for all registered hooks.

execute_wfs_search_result_received(query, ...)

Execute the wfs_search_result_received method for all registered hooks.

execute_xml_cache_hit(pkey_object)

Execute the xml_cache_hit method for all registered hooks.

execute_xml_downloaded(pkey_object)

Execute the xml_downloaded method for all registered hooks.

execute_xml_fetch_error(pkey_object)

Execute the xml_fetch_error method for all registered hooks.

execute_xml_received(pkey_object, xml)

Execute the xml_received method for all registered hooks.

execute_xml_stale_hit(pkey_object)

Execute the xml_stale_hit method for all registered hooks.

static execute_inject_meta_response(url)[source]

Execute the inject_meta_response method for all registered hooks.

Parameters:
urlstr

URL of the metadata request.

Returns:
bytes, optional

The response to use in favor of resolving the URL. Returns None if this inject hook is unused.

static execute_inject_wfs_getfeature_response(query)[source]

Execute the inject_wfs_getfeature_response method for all registered hooks.

Parameters:
queryetree.ElementTree

The WFS GetFeature request sent to the WFS server.

Returns:
xml: bytes, optional

The GetFeature response to use in favor of resolving the URL. Returns None if this inject hook is unused.

static execute_inject_xml_response(pkey_object)[source]

Execute the inject_xml_response method for all registered hooks.

Parameters:
queryetree.ElementTree

The WFS GetFeature request sent to the WFS server.

Returns:
xmlbytes, optional

The XML response to use in favor of resolving the URL. Returns None if this inject hook is unused.

static execute_meta_received(url, response)[source]

Execute the meta_received method for all registered hooks.

Parameters:
urlstr

URL of the metadata request.

responsebytes

The raw response as received from resolving the URL.

static execute_wfs_search_init(params)[source]

Execute the wfs_search_init method for all registered hooks.

Parameters:
paramsdict
Parameters used to initiate WFS search. These include:
typenamestr

Typename in the WFS service to query.

locationpydov.util.location.AbstractLocationFilter or None

Location filter limiting the features to retrieve.

filterstr (xml) or None

Attribute filter limiting the features to retrieve.

sort_bystr (xml) or None

SortBy clause listing fields to sort by.

max_featuresint

Limit the maximum number of features to request.

propertynameslist of str

List of WFS propertynames (attributes) to retrieve.

geometry_columnstr

Name of the column/attribute containing the geometry.

static execute_wfs_search_result(number_matched, number_returned)[source]

Execute the wfs_search_result method for all registered hooks.

Parameters:
number_matchedint

The number of features matched by the WFS search query.

number_returnedint

The number of features returned by the WFS search query. Due to server limitations this can be less than number_matched.

static execute_wfs_search_result_received(query, features)[source]

Execute the wfs_search_result_received method for all registered hooks.

Parameters:
queryetree.ElementTree

The WFS GetFeature request sent to the WFS server.

featuresetree.ElementTree

The WFS GetFeature response containing the features.

static execute_xml_cache_hit(pkey_object)[source]

Execute the xml_cache_hit method for all registered hooks.

Parameters:
pkey_objectstr

Permanent key of the requested object.

static execute_xml_downloaded(pkey_object)[source]

Execute the xml_downloaded method for all registered hooks.

Parameters:
pkey_objectstr

Permanent key of the requested object.

static execute_xml_fetch_error(pkey_object)[source]

Execute the xml_fetch_error method for all registered hooks.

Parameters:
pkey_objectstr

Permanent key of the requested object.

static execute_xml_received(pkey_object, xml)[source]

Execute the xml_received method for all registered hooks.

Parameters:
pkey_objectstr

Permanent key of the retrieved object.

xmlbytes

The raw XML data of this DOV object as bytes.

static execute_xml_stale_hit(pkey_object)[source]

Execute the xml_stale_hit method for all registered hooks.

Parameters:
pkey_objectstr

Permanent key of the requested object.

class pydov.util.hooks.Hooks(iterable=(), /)[source]

Bases: list

Runtime representation of registered pydov hooks, i.e. a list of instances of AbstractReadHook and/or AbstractInjectHook.

Methods

append(object, /)

Append object to the end of the list.

clear(/)

Remove all items from list.

copy(/)

Return a shallow copy of the list.

count(value, /)

Return number of occurrences of value.

extend(iterable, /)

Extend list by appending elements from the iterable.

get_inject_hooks()

Get the registered inject hooks (i.e. hooks that are subclasses of AbstractInjectHook), in the order they are defined in the list.

get_read_hooks()

Get the registered read hooks (i.e. hooks that are subclasses of AbstractReadHook), in the order they are defined in the list.

index(value[, start, stop])

Return first index of value.

insert(index, object, /)

Insert object before index.

pop([index])

Remove and return item at index (default last).

remove(value, /)

Remove first occurrence of value.

reverse(/)

Reverse IN PLACE.

sort(*[, key, reverse])

Sort the list in ascending order and return None.

get_inject_hooks()[source]

Get the registered inject hooks (i.e. hooks that are subclasses of AbstractInjectHook), in the order they are defined in the list.

Returns:
tuple of AbstractInjectHook

A tuple with the registered inject hooks.

get_read_hooks()[source]

Get the registered read hooks (i.e. hooks that are subclasses of AbstractReadHook), in the order they are defined in the list.

Returns:
tuple of AbstractReadHook

A tuple with the registered read hooks.

class pydov.util.hooks.RepeatableLogRecorder(log_directory)[source]

Bases: AbstractReadHook, AbstractInjectHook

Class for recording a pydov session into a ZIP archive.

This enables to save (the results of) all metadata and data requests from the DOV services locally on disk.

The saved ZIP archive can subsequently be used in the RepeatableLogReplayer to replay the saved session allowing fully reproducible pydov runs.

Methods

inject_meta_response(url)

Inject a response for a metadata request.

inject_wfs_getfeature_response(query)

Inject a response for a WFS GetFeature request.

inject_xml_response(pkey_object)

Inject a response for a DOV XML request.

meta_received(url, response)

Called when a response for a metadata requests is received.

wfs_search_init(params)

Called upon starting a WFS search.

wfs_search_result(number_matched, ...)

Called after a WFS search query finished.

wfs_search_result_received(query, features)

Called after a WFS search finished.

xml_cache_hit(pkey_object)

Called when the XML document of an object is retrieved from the cache.

xml_downloaded(pkey_object)

Called when the XML document of an object is downloaded from the DOV services.

xml_fetch_error(pkey_object)

Called when the XML document of an object failed to be retrieved from the DOV service and no stale version could be returned from the cache.

xml_received(pkey_object, xml)

Called when the XML of a given object is received, either from the cache or from the remote DOV service.

xml_stale_hit(pkey_object)

Called when the XML document of an object failed to be retrieved from the DOV service and a stale version has been returned from the cache.

Initialise a RepeatableLogRecorder hook.

It will save a ZIP archive with the current pydov session’s data in the given log directory.

Replays previously saved responses in the current session too to enable full reproducibility between the session being saved and replays of the saved ZIP archive. When this would be omitted they would not necessarily yield the same results due to timing issues (albeit quite far fetched).

Parameters:
log_directorystr

Path to a directory on disk where the ZIP archive containing the pydov session will be saved. Will be created if it does not exist.

Methods

inject_meta_response(url)

Inject a response for a metadata request.

inject_wfs_getfeature_response(query)

Inject a response for a WFS GetFeature request.

inject_xml_response(pkey_object)

Inject a response for a DOV XML request.

meta_received(url, response)

Called when a response for a metadata requests is received.

wfs_search_init(params)

Called upon starting a WFS search.

wfs_search_result(number_matched, ...)

Called after a WFS search query finished.

wfs_search_result_received(query, features)

Called after a WFS search finished.

xml_cache_hit(pkey_object)

Called when the XML document of an object is retrieved from the cache.

xml_downloaded(pkey_object)

Called when the XML document of an object is downloaded from the DOV services.

xml_fetch_error(pkey_object)

Called when the XML document of an object failed to be retrieved from the DOV service and no stale version could be returned from the cache.

xml_received(pkey_object, xml)

Called when the XML of a given object is received, either from the cache or from the remote DOV service.

xml_stale_hit(pkey_object)

Called when the XML document of an object failed to be retrieved from the DOV service and a stale version has been returned from the cache.

inject_meta_response(url)[source]

Inject a response for a metadata request.

Create a stable hash based on the URL and inject a previously saved response if available. If no previous response is available, return None to resume normal pydov flow.

Parameters:
urlstr

URL of the metadata request.

Returns:
bytes, optional

The response to use in favor of resolving the URL. Returns None if no previously recorded response is available for this request.

inject_wfs_getfeature_response(query)[source]

Inject a response for a WFS GetFeature request.

Create a stable hash based on the query and inject a previously saved response if available. If no previous response is available, return None to resume normal pydov flow.

Parameters:
queryetree.ElementTree

The WFS GetFeature request sent to the WFS server.

Returns:
xml: bytes, optional

The GetFeature response to use in favor of resolving the URL. Return None to disable this inject hook.

inject_xml_response(pkey_object)[source]

Inject a response for a DOV XML request.

Create a stable hash based on the pkey_object and inject a previously saved response if available. If no previous response is available, return None to resume normal pydov flow.

Parameters:
pkey_objectstr

The permanent key of the DOV object.

Returns:
xmlbytes, optional

The XML response to use in favor of resolving the URL. Return None to disable this inject hook.

meta_received(url, response)[source]

Called when a response for a metadata requests is received.

Create a stable hash based on the URL and archive the response.

Parameters:
urlstr

URL of the metadata request.

responsebytes

The raw response as received from resolving the URL.

wfs_search_result_received(query, features)[source]

Called after a WFS search finished.

Create a stable hash based on the query and archive the feature response.

Parameters:
queryetree.ElementTree

The WFS GetFeature request sent to the WFS server.

featuresetree.ElementTree

The WFS GetFeature response containings the features.

xml_received(pkey_object, xml)[source]

Called when the XML of a given object is received, either from the cache or from the remote DOV service.

Create a stable hash based on the pkey_object and archive the xml response.

Parameters:
pkey_objectstr

Permanent key of the retrieved object.

xmlbytes

The raw XML data of this DOV object as bytes.

class pydov.util.hooks.RepeatableLogReplayer(log_archive)[source]

Bases: AbstractInjectHook

Class for replaying a saved pydov session from a ZIP archive.

This will reroute all external requests to the saved results in the ZIP archive, enabling fully reproducable pydov runs.

Methods

inject_meta_response(url)

Inject a response for a metadata request.

inject_wfs_getfeature_response(query)

Inject a response for a WFS GetFeature request.

inject_xml_response(pkey_object)

Inject a response for a DOV XML request.

Initialise a RepeatableLogReplayer hook.

It will reroute all external requests to the saved results in the given ZIP archive.

Parameters:
log_archivestr

Path to the ZIP archive to use for replay.

Methods

inject_meta_response(url)

Inject a response for a metadata request.

inject_wfs_getfeature_response(query)

Inject a response for a WFS GetFeature request.

inject_xml_response(pkey_object)

Inject a response for a DOV XML request.

inject_meta_response(url)[source]

Inject a response for a metadata request.

Create a stable hash based on the URL and inject the previously saved response.

Parameters:
urlstr

URL of the metadata request.

Returns:
bytes, optional

The response to use in favor of resolving the URL.

Raises:
pydov.util.errors.LogReplayError

When the response required for this URL could not be found in the archive. This happens for instance when replaying an archive for a different pydov session than the one it was saved for.

inject_wfs_getfeature_response(query)[source]

Inject a response for a WFS GetFeature request.

Create a stable hash based on the query and inject the previously saved response.

Parameters:
queryetree.ElementTree

The WFS GetFeature request sent to the WFS server.

Returns:
xml: bytes, optional

The GetFeature response to use in favor of resolving the URL.

Raises:
pydov.util.errors.LogReplayError

When the response required for this URL could not be found in the archive. This happens for instance when replaying an archive for a different pydov session than the one it was saved for.

inject_xml_response(pkey_object)[source]

Inject a response for a DOV XML request.

Create a stable hash based on the pkey_object and inject the previously saved response.

Parameters:
pkey_objectstr

The permanent key of the DOV object.

Returns:
xmlbytes, optional

The XML response to use in favor of resolving the URL. Return None to disable this inject hook.

Raises:
pydov.util.errors.LogReplayError

When the response required for this URL could not be found in the archive. This happens for instance when replaying an archive for a different pydov session than the one it was saved for.

class pydov.util.hooks.SimpleStatusHook[source]

Bases: AbstractReadHook

Simple hook implementation to print progress to stdout.

Methods

ProgressState()

Simple class for storing progress state.

meta_received(url, response)

Called when a response for a metadata requests is received.

wfs_search_init(params)

When a new WFS search is started, reset all counters to 0 and set the maximum requested results.

wfs_search_result(number_matched, ...)

When the WFS search completes, set the total result count.

wfs_search_result_received(query, features)

Called after a WFS search finished.

xml_cache_hit(pkey_object)

When an XML document is retrieved from the cache, print 'c' to the progress output.

xml_downloaded(pkey_object)

When an XML document is downloaded from the DOV services, print '.' to the progress output.

xml_fetch_error(pkey_object)

When an XML document failed to be fetched from DOV, print 'E' to the progress output.

xml_received(pkey_object, xml)

Called when the XML of a given object is received, either from the cache or from the remote DOV service.

xml_stale_hit(pkey_object)

When a stale XML document is retrieved from the cache, print 'S' to the progress output.

Initialisation.

Initialise all variables to default.

Methods

ProgressState()

Simple class for storing progress state.

meta_received(url, response)

Called when a response for a metadata requests is received.

wfs_search_init(params)

When a new WFS search is started, reset all counters to 0 and set the maximum requested results.

wfs_search_result(number_matched, ...)

When the WFS search completes, set the total result count.

wfs_search_result_received(query, features)

Called after a WFS search finished.

xml_cache_hit(pkey_object)

When an XML document is retrieved from the cache, print 'c' to the progress output.

xml_downloaded(pkey_object)

When an XML document is downloaded from the DOV services, print '.' to the progress output.

xml_fetch_error(pkey_object)

When an XML document failed to be fetched from DOV, print 'E' to the progress output.

xml_received(pkey_object, xml)

Called when the XML of a given object is received, either from the cache or from the remote DOV service.

xml_stale_hit(pkey_object)

When a stale XML document is retrieved from the cache, print 'S' to the progress output.

class ProgressState[source]

Bases: object

Simple class for storing progress state.

Methods

reset()

Reset the progress state.

Initialise a new progress state, with all variable to default.

Methods

reset()

Reset the progress state.

reset()[source]

Reset the progress state. Resets all variables to default.

wfs_search_init(params)[source]

When a new WFS search is started, reset all counters to 0 and set the maximum requested results.

Parameters:
paramsdict
Parameters used to initiate WFS search. These include:
typenamestr

Typename in the WFS service to query.

locationpydov.util.location.AbstractLocationFilter or None

Location filter limiting the features to retrieve.

filterstr (xml) or None

Attribute filter limiting the features to retrieve.

sort_bystr (xml) or None

SortBy clause listing fields to sort by.

max_featuresint or None

Limit the maximum number of features to request.

propertynameslist of str

List of WFS propertynames (attributes) to retrieve.

geometry_columnstr

Name of the column/attribute containing the geometry.

wfs_search_result(number_matched, number_returned)[source]

When the WFS search completes, set the total result count.

Parameters:
number_matchedint

The number of features matched by the WFS search query.

number_returnedint

The number of features returned by the WFS search query. Due to server limitations this can be less than number_matched.

xml_cache_hit(pkey_object)[source]

When an XML document is retrieved from the cache, print ‘c’ to the progress output.

Parameters:
pkey_objectstr

Permanent key of the requested object.

xml_downloaded(pkey_object)[source]

When an XML document is downloaded from the DOV services, print ‘.’ to the progress output.

Parameters:
pkey_objectstr

Permanent key of the requested object.

xml_fetch_error(pkey_object)[source]

When an XML document failed to be fetched from DOV, print ‘E’ to the progress output.

Parameters:
pkey_objectstr

Permanent key of the requested object.

xml_stale_hit(pkey_object)[source]

When a stale XML document is retrieved from the cache, print ‘S’ to the progress output.

Parameters:
pkey_objectstr

Permanent key of the requested object.

Network utilities

Module grouping network-related utilities and functions.

class pydov.util.net.LocalSessionThread(input_queue)[source]

Bases: Thread

Worker thread using a local Session to execute functions.

Attributes:
daemon

A boolean value indicating whether this thread is a daemon thread.

ident

Thread identifier of this thread or None if it has not been started.

name

A string used for identification purposes only.

native_id

Native integral thread ID of this thread, or None if it has not been started.

Methods

is_alive()

Return whether the thread is alive.

join([timeout])

Wait until the thread terminates.

run()

Executed while the thread is running.

start()

Start the thread's activity.

stop()

Stop the worker thread at the next occasion.

getName

isDaemon

setDaemon

setName

Initialisation.

Bind to the input queue and create a Session.

Parameters:
input_queuequeue.Queue

Queue to poll for input, this should be in the form of a tuple with 3 items: function to call, list with arguments and WorkerResult instance to store the output. The list with arguments will be automatically extended with the local Session instance.

Attributes:
daemon

A boolean value indicating whether this thread is a daemon thread.

ident

Thread identifier of this thread or None if it has not been started.

name

A string used for identification purposes only.

native_id

Native integral thread ID of this thread, or None if it has not been started.

Methods

is_alive()

Return whether the thread is alive.

join([timeout])

Wait until the thread terminates.

run()

Executed while the thread is running.

start()

Start the thread's activity.

stop()

Stop the worker thread at the next occasion.

getName

isDaemon

setDaemon

setName

run()[source]

Executed while the thread is running. This is called implicitly when starting the thread.

stop()[source]

Stop the worker thread at the next occasion. This can take up to 500 ms.

class pydov.util.net.LocalSessionThreadPool(workers=4)[source]

Bases: object

Thread pool of LocalSessionThreads used to perform HTTP I/O operations in parallel.

Methods

execute(fn, args)

Execute the given function with its arguments in a worker thread.

join()

Wait for all the jobs to be executed and return the results of all jobs in a list.

stop()

Stop all worker threads.

Initialisation.

Set up the pool and start all workers.

Parameters:
workersint, optional

Number of worker threads to use, defaults to 4.

Methods

execute(fn, args)

Execute the given function with its arguments in a worker thread.

join()

Wait for all the jobs to be executed and return the results of all jobs in a list.

stop()

Stop all worker threads.

execute(fn, args)[source]

Execute the given function with its arguments in a worker thread.

This will add the job to the queue and will not wait for the result. Use join() to retrieve the result.

Parameters:
fnfunction

Function to execute. It should take all arguments from args, and after that a single argument with the requests Session.

argstuple

Arguments that will be passed to the function.

join()[source]

Wait for all the jobs to be executed and return the results of all jobs in a list.

Yields:
WorkerResult

Results of the executed functions in the order they were submitted.

stop()[source]

Stop all worker threads.

class pydov.util.net.SessionFactory[source]

Bases: object

Class for generating pydov configured requests Sessions. They are used to send HTTP requests using our user-agent and with added retry-logic.

One global session is used for all requests, and additionally one session is used per thread executing XML requests in parallel.

Methods

get_session()

Request a new session.

static get_session()[source]

Request a new session.

Returns:
requests.Session

pydov configured requests Session.

class pydov.util.net.TimeoutHTTPAdapter(*args, **kwargs)[source]

Bases: HTTPAdapter

HTTPAdapter which adds a default timeout to requests. Allows timeout to be overridden on a per-request basis.

Methods

add_headers(request, **kwargs)

Add any headers needed by the connection.

build_connection_pool_key_attributes(...[, cert])

Build the PoolKey attributes used by urllib3 to return a connection.

build_response(req, resp)

Builds a Response object from a urllib3 response.

cert_verify(conn, url, verify, cert)

Verify a SSL certificate.

close()

Disposes of any internal state.

get_connection(url[, proxies])

DEPRECATED: Users should move to get_connection_with_tls_context for all subclasses of HTTPAdapter using Requests>=2.32.2.

get_connection_with_tls_context(request, verify)

Returns a urllib3 connection for the given request and TLS settings.

init_poolmanager(connections, maxsize[, block])

Initializes a urllib3 PoolManager.

proxy_headers(proxy)

Returns a dictionary of the headers to add to any request sent through a proxy.

proxy_manager_for(proxy, **proxy_kwargs)

Return urllib3 ProxyManager for the given proxy.

request_url(request, proxies)

Obtain the url to use when making the final request.

send(request, **kwargs)

Sends PreparedRequest object.

Initialisation.

Methods

add_headers(request, **kwargs)

Add any headers needed by the connection.

build_connection_pool_key_attributes(...[, cert])

Build the PoolKey attributes used by urllib3 to return a connection.

build_response(req, resp)

Builds a Response object from a urllib3 response.

cert_verify(conn, url, verify, cert)

Verify a SSL certificate.

close()

Disposes of any internal state.

get_connection(url[, proxies])

DEPRECATED: Users should move to get_connection_with_tls_context for all subclasses of HTTPAdapter using Requests>=2.32.2.

get_connection_with_tls_context(request, verify)

Returns a urllib3 connection for the given request and TLS settings.

init_poolmanager(connections, maxsize[, block])

Initializes a urllib3 PoolManager.

proxy_headers(proxy)

Returns a dictionary of the headers to add to any request sent through a proxy.

proxy_manager_for(proxy, **proxy_kwargs)

Return urllib3 ProxyManager for the given proxy.

request_url(request, proxies)

Obtain the url to use when making the final request.

send(request, **kwargs)

Sends PreparedRequest object.

send(request, **kwargs)[source]

Sends PreparedRequest object. Returns Response object.

Parameters:
requestrequests.PreparedRequest

The PreparedRequest being sent.

Returns:
requests.Response

The Response of the request.

class pydov.util.net.WorkerResult[source]

Bases: object

Class for storing the result of a job execution in the result queue.

This allows putting a result instance in the queue on job submission and fill in the result later when the job completes. This ensures the result output is in the same order as the jobs were submitted.

Methods

get_error()

Retrieve the error, if any, of this job.

get_result()

Retrieve the result of this job.

set_error(error)

Set the error, in case the jobs fails with an exception.

set_result(value)

Set the result of this job.

Initialisation.

Methods

get_error()

Retrieve the error, if any, of this job.

get_result()

Retrieve the result of this job.

set_error(error)

Set the error, in case the jobs fails with an exception.

set_result(value)

Set the result of this job.

get_error()[source]

Retrieve the error, if any, of this job.

Returns:
Exception

The exception raised while executing this job.

get_result()[source]

Retrieve the result of this job.

Returns:
any

The result of the execution of the job.

set_error(error)[source]

Set the error, in case the jobs fails with an exception.

Parameters:
errorException

The exception raised while executing this job.

set_result(value)[source]

Set the result of this job.

Parameters:
valueany

The result of the execution of the job.

pydov.util.net.proxy_autoconfiguration()[source]

Try proxy autoconfiguration via PAC.

This function tries to autodetect the required proxy server using PAC, and sets the HTTP_PROXY and HTTPS_PROXY environment variables accordingly.

These variables should subsequently be picked up by the requests sessions used by pydov and owslib.

Errors and warnings

Module grouping Exception classes.

exception pydov.util.errors.DOVError[source]

Bases: Exception

General error within PyDOV.

exception pydov.util.errors.DOVWarning[source]

Bases: Warning

General warning in PyDOV.

exception pydov.util.errors.DataParseWarning[source]

Bases: DOVWarning

Emitted when some data retrieved from DOV failed to be parsed according to the datatypes in pydov. The data that failed to be parsed is removed, resulting in an incomplete dataframe.

exception pydov.util.errors.InvalidFieldError[source]

Bases: DOVError

Error that occurs when using a field outside its scope.

exception pydov.util.errors.InvalidSearchParameterError[source]

Bases: DOVError

Error that occurs when given invalid parameters to the DOV search.

exception pydov.util.errors.LayerNotFoundError[source]

Bases: OWSError

Error that occurs when a specific layer could not be found.

exception pydov.util.errors.LogReplayError[source]

Bases: Exception

exception pydov.util.errors.OWSError[source]

Bases: DOVError

Error regarding the OGC web services.

exception pydov.util.errors.RemoteFetchError[source]

Bases: DOVError

General error while fetching remote data from DOV webservices.

exception pydov.util.errors.WfsGetFeatureError[source]

Bases: OWSError

Error that occurs when requesting features using WFS GetFeature.

exception pydov.util.errors.XmlFetchWarning[source]

Bases: DOVWarning

Emitted when an XML document fails to be fetched from the DOV webservice, resulting in an incomplete dataframe.

exception pydov.util.errors.XmlParseError[source]

Bases: DOVError

Error that occurs when the parsing of a DOV XML document failed.

exception pydov.util.errors.XmlParseWarning[source]

Bases: DOVWarning

Emitted when the failure to parse an XML document results in an incomplete dataframe.

exception pydov.util.errors.XmlStaleWarning[source]

Bases: DOVWarning

Emitted when an XML document fails to be fetched from the DOV webservice and an older stale version is used from the cache, resulting in an out-of-date dataframe.

exception pydov.util.errors.XsdFetchWarning[source]

Bases: DOVWarning

Emitted when an XSD document fails to be fetched from the DOV webservice, resulting in the fields metadata to be incomplete.