{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Example of DOV search methods for boreholes (boringen)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"[](https://mybinder.org/v2/gh/DOV-Vlaanderen/pydov/master?filepath=docs%2Fnotebooks%2Fsearch_boringen.ipynb)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Use cases explained below\n",
"* Get boreholes in a bounding box\n",
"* Get boreholes with specific properties\n",
"* Get boreholes in a bounding box based on specific properties\n",
"* Select boreholes in a municipality and return depth\n",
"* Get boreholes based on fields not available in the standard output dataframe\n",
"* Get borehole data, returning fields not available in the standard output dataframe\n",
"* Get boreholes in a municipality and where groundwater related data are available"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"%matplotlib inline\n",
"import inspect, sys\n",
"import warnings; warnings.simplefilter('ignore')"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"# check pydov path\n",
"import pydov"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Get information about the datatype 'Boring'"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"from pydov.search.boring import BoringSearch\n",
"boring = BoringSearch()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"A description is provided for the 'Boring' datatype:"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'In de DOV-databank is elke waarneming van grondlagen een boring. Bij de meeste boringen wordt er met een boortoestel een gat gemaakt in de ondergrond om de verschillende grondlagen te kunnen beschrijven. Aan de hand van een boring krijg je een beeld van het materiaal in de ondergrond met toenemende diepte. Afhankelijk van het doel waarvoor de boring geplaatst wordt, zal men een geschikte boormethode toepassen. Boringen worden geplaatst voor verkennend bodemonderzoek, monstername van het sediment en/of grondwater, bepaling van bodemfysische parameters, milieuhygiënisch onderzoek,… Afhankelijk van de diepte, soort materiaal, en het al dan niet boren tot onder de grondwatertafel kan men kiezen uit verscheidene systemen voor handmatig of machinaal te boren. Het bodemmateriaal dat vrijkomt, kan gebruikt worden om een profiel van de ondergrond op te stellen of om er grondmonsters van te nemen om verdere analyses op uit te voeren. Vaak is het de bedoeling een put uit te bouwen zodat water kan gewonnen worden (zie ook grondwatermeetnet en grondwatervergunningen). Soms worden boringen uitgevoerd om een aantal geotechnische karakteristieken te bepalen of om wetenschappelijk onderzoek uit te voeren. Oppervlakkige waarnemingen van de ondergrond noemen we ook boringen. Vooral rond 1900 beschreven een aantal geologen vaak de oppervlakkige lagen. In de databank staan er dan ook verschillende boringen met een diepte van 0 meter. Het gaat vooral om weginsnijdingen of om zichtbare lithologische kenmerken langs de oppervlakte.'"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"boring.get_description()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The different fields that are available for objects of the 'Boring' datatype can be requested with the get_fields() method:"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"id\n",
"boornummer\n",
"pkey_boring\n",
"rapport\n",
"diepte_boring_tot\n",
"datum_aanvang\n",
"namen\n",
"putnummer\n",
"x\n",
"y\n",
"start_boring_mtaw\n",
"gemeente\n",
"uitvoerder\n",
"doel\n",
"methode\n",
"erkenning\n",
"opdrachtgever\n",
"informele_stratigrafie\n",
"formele_stratigrafie\n",
"lithologische_beschrijving\n",
"gecodeerde_lithologie\n",
"hydrogeologische_stratigrafie\n",
"quartaire_stratigrafie\n",
"geotechnische_codering\n",
"informele_hydrostratigrafie\n",
"doorheen_quartair\n",
"dikte_quartair\n",
"tertiair_onder_quartair\n",
"opdrachten\n",
"mv_mtaw\n",
"diepte_boring_van\n",
"boorgatmeting\n",
"diepte_methode_van\n",
"diepte_methode_tot\n",
"boormethode\n"
]
}
],
"source": [
"fields = boring.get_fields()\n",
"\n",
"# print available fields\n",
"for f in fields.values():\n",
" print(f['name'])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"You can get more information of a field by requesting it from the fields dictionary:\n",
"* *name*: name of the field\n",
"* *definition*: definition of this field\n",
"* *cost*: currently this is either 1 or 10, depending on the datasource of the field. It is an indication of the expected time it will take to retrieve this field in the output dataframe.\n",
"* *notnull*: whether the field is mandatory or not\n",
"* *type*: datatype of the values of this field"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'name': 'diepte_boring_tot',\n",
" 'definition': 'Maximumdiepte van de boring ten opzichte van het aanvangspeil, in meter.',\n",
" 'type': 'float',\n",
" 'notnull': False,\n",
" 'query': True,\n",
" 'cost': 1}"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"fields['diepte_boring_tot']"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Optionally, if the values of the field have a specific domain the possible values are listed as *values*:"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'Meerdere technieken': None,\n",
" 'avegaarboring': None,\n",
" 'droge boring': None,\n",
" 'edelmanboring': None,\n",
" 'geen boring': None,\n",
" 'gestoken boring': None,\n",
" 'graafmachine': None,\n",
" 'handboring': None,\n",
" 'kernboring': None,\n",
" 'lansen': None,\n",
" 'lepelboring': None,\n",
" 'luchthamer': None,\n",
" 'luchthevelboren of air-lift boren': None,\n",
" 'meerdere technieken': None,\n",
" 'omgek. spoelboring': None,\n",
" 'onbekend': None,\n",
" 'pulsboring': None,\n",
" 'ramkernboring': None,\n",
" 'rollerbit': None,\n",
" 'slagboring': None,\n",
" 'spade': None,\n",
" 'spiraalboring': None,\n",
" 'spoelboring': None,\n",
" 'steenboring': None,\n",
" 'trilboring': None,\n",
" 'zuigboring': None}"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"fields['methode']['values']"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example use cases"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Get boreholes in a bounding box"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Get data for all the boreholes that are geographically located within the bounds of the specified box.\n",
"\n",
"The coordinates are in the Belgian Lambert72 (EPSG:31370) coordinate system and are given in the order of lower left x, lower left y, upper right x, upper right y."
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[000/001] c\n"
]
},
{
"data": {
"text/html": [
"
\n",
"\n",
"
\n",
" \n",
"
\n",
"
\n",
"
pkey_boring
\n",
"
boornummer
\n",
"
x
\n",
"
y
\n",
"
mv_mtaw
\n",
"
start_boring_mtaw
\n",
"
gemeente
\n",
"
diepte_boring_van
\n",
"
diepte_boring_tot
\n",
"
datum_aanvang
\n",
"
uitvoerder
\n",
"
boorgatmeting
\n",
"
diepte_methode_van
\n",
"
diepte_methode_tot
\n",
"
boormethode
\n",
"
\n",
" \n",
" \n",
"
\n",
"
0
\n",
"
https://www.dov.vlaanderen.be/data/boring/1974...
\n",
"
GEO-74/254-b1
\n",
"
153147.0
\n",
"
206931.0
\n",
"
14.12
\n",
"
14.12
\n",
"
Antwerpen
\n",
"
0.0
\n",
"
14.05
\n",
"
1974-07-02
\n",
"
Rijksinstituut voor Grondmechanica
\n",
"
False
\n",
"
0.0
\n",
"
1.30
\n",
"
lepelboring
\n",
"
\n",
"
\n",
"
1
\n",
"
https://www.dov.vlaanderen.be/data/boring/1974...
\n",
"
GEO-74/254-b1
\n",
"
153147.0
\n",
"
206931.0
\n",
"
14.12
\n",
"
14.12
\n",
"
Antwerpen
\n",
"
0.0
\n",
"
14.05
\n",
"
1974-07-02
\n",
"
Rijksinstituut voor Grondmechanica
\n",
"
False
\n",
"
1.3
\n",
"
13.50
\n",
"
pulsboring
\n",
"
\n",
"
\n",
"
2
\n",
"
https://www.dov.vlaanderen.be/data/boring/1974...
\n",
"
GEO-74/254-b1
\n",
"
153147.0
\n",
"
206931.0
\n",
"
14.12
\n",
"
14.12
\n",
"
Antwerpen
\n",
"
0.0
\n",
"
14.05
\n",
"
1974-07-02
\n",
"
Rijksinstituut voor Grondmechanica
\n",
"
False
\n",
"
13.5
\n",
"
14.05
\n",
"
lepelboring
\n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" pkey_boring boornummer x \\\n",
"0 https://www.dov.vlaanderen.be/data/boring/1974... GEO-74/254-b1 153147.0 \n",
"1 https://www.dov.vlaanderen.be/data/boring/1974... GEO-74/254-b1 153147.0 \n",
"2 https://www.dov.vlaanderen.be/data/boring/1974... GEO-74/254-b1 153147.0 \n",
"\n",
" y mv_mtaw start_boring_mtaw gemeente diepte_boring_van \\\n",
"0 206931.0 14.12 14.12 Antwerpen 0.0 \n",
"1 206931.0 14.12 14.12 Antwerpen 0.0 \n",
"2 206931.0 14.12 14.12 Antwerpen 0.0 \n",
"\n",
" diepte_boring_tot datum_aanvang uitvoerder \\\n",
"0 14.05 1974-07-02 Rijksinstituut voor Grondmechanica \n",
"1 14.05 1974-07-02 Rijksinstituut voor Grondmechanica \n",
"2 14.05 1974-07-02 Rijksinstituut voor Grondmechanica \n",
"\n",
" boorgatmeting diepte_methode_van diepte_methode_tot boormethode \n",
"0 False 0.0 1.30 lepelboring \n",
"1 False 1.3 13.50 pulsboring \n",
"2 False 13.5 14.05 lepelboring "
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from pydov.util.location import Within, Box\n",
"\n",
"df = boring.search(location=Within(Box(153145, 206930, 153150, 206935)))\n",
"df.head()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The dataframe contains one borehole where three methods ('boormethode') were applied for its construction. The available data are flattened to represent unique attributes per row of the dataframe.\n",
"\n",
"Using the *pkey_boring* field one can request the details of this borehole in a webbrowser:"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"https://www.dov.vlaanderen.be/data/boring/1974-010351\n"
]
}
],
"source": [
"for pkey_boring in set(df.pkey_boring):\n",
" print(pkey_boring)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Get boreholes with specific properties"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Next to querying boreholes based on their geographic location within a bounding box, we can also search for boreholes matching a specific set of properties. For this we can build a query using a combination of the 'Boring' fields and operators provided by the WFS protocol.\n",
"\n",
"A list of possible operators can be found below:"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['PropertyIsBetween',\n",
" 'PropertyIsEqualTo',\n",
" 'PropertyIsGreaterThan',\n",
" 'PropertyIsGreaterThanOrEqualTo',\n",
" 'PropertyIsLessThan',\n",
" 'PropertyIsLessThanOrEqualTo',\n",
" 'PropertyIsLike',\n",
" 'PropertyIsNotEqualTo',\n",
" 'PropertyIsNull',\n",
" 'SortProperty']"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"[i for i,j in inspect.getmembers(sys.modules['owslib.fes'], inspect.isclass) if 'Property' in i]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"In this example we build a query using the *PropertyIsEqualTo* operator to find all boreholes that are within the community (gemeente) of 'Herstappe':"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[000/002] cc\n"
]
},
{
"data": {
"text/html": [
"
\n",
"\n",
"
\n",
" \n",
"
\n",
"
\n",
"
pkey_boring
\n",
"
boornummer
\n",
"
x
\n",
"
y
\n",
"
mv_mtaw
\n",
"
start_boring_mtaw
\n",
"
gemeente
\n",
"
diepte_boring_van
\n",
"
diepte_boring_tot
\n",
"
datum_aanvang
\n",
"
uitvoerder
\n",
"
boorgatmeting
\n",
"
diepte_methode_van
\n",
"
diepte_methode_tot
\n",
"
boormethode
\n",
"
\n",
" \n",
" \n",
"
\n",
"
0
\n",
"
https://www.dov.vlaanderen.be/data/boring/2016...
\n",
"
kb33d106e-B236
\n",
"
224687.4
\n",
"
158191.0
\n",
"
124.0
\n",
"
124.0
\n",
"
Herstappe
\n",
"
0.0
\n",
"
6.0
\n",
"
NaN
\n",
"
Belgische Geologische Dienst (BGD)
\n",
"
False
\n",
"
0.0
\n",
"
6.0
\n",
"
gestoken boring
\n",
"
\n",
"
\n",
"
1
\n",
"
https://www.dov.vlaanderen.be/data/boring/1993...
\n",
"
kb41d120e-B1027
\n",
"
224820.0
\n",
"
157794.0
\n",
"
132.0
\n",
"
132.0
\n",
"
Herstappe
\n",
"
0.0
\n",
"
50.0
\n",
"
1993-09-02
\n",
"
Peeters-Ramsel
\n",
"
False
\n",
"
0.0
\n",
"
50.0
\n",
"
onbekend
\n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" pkey_boring boornummer \\\n",
"0 https://www.dov.vlaanderen.be/data/boring/2016... kb33d106e-B236 \n",
"1 https://www.dov.vlaanderen.be/data/boring/1993... kb41d120e-B1027 \n",
"\n",
" x y mv_mtaw start_boring_mtaw gemeente \\\n",
"0 224687.4 158191.0 124.0 124.0 Herstappe \n",
"1 224820.0 157794.0 132.0 132.0 Herstappe \n",
"\n",
" diepte_boring_van diepte_boring_tot datum_aanvang \\\n",
"0 0.0 6.0 NaN \n",
"1 0.0 50.0 1993-09-02 \n",
"\n",
" uitvoerder boorgatmeting diepte_methode_van \\\n",
"0 Belgische Geologische Dienst (BGD) False 0.0 \n",
"1 Peeters-Ramsel False 0.0 \n",
"\n",
" diepte_methode_tot boormethode \n",
"0 6.0 gestoken boring \n",
"1 50.0 onbekend "
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from owslib.fes import PropertyIsEqualTo\n",
"\n",
"query = PropertyIsEqualTo(propertyname='gemeente',\n",
" literal='Herstappe')\n",
"df = boring.search(query=query)\n",
"\n",
"df.head()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Once again we can use the *pkey_boring* as a permanent link to the information of these boreholes:"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"https://www.dov.vlaanderen.be/data/boring/2016-125511\n",
"https://www.dov.vlaanderen.be/data/boring/1993-096210\n"
]
}
],
"source": [
"for pkey_boring in set(df.pkey_boring):\n",
" print(pkey_boring)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Get boreholes in a bounding box based on specific properties"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"We can combine a query on attributes with a query on geographic location to get the boreholes within a bounding box that have specific properties.\n",
"\n",
"The following example requests the boreholes with a depth greater than or equal to 2000 meters within the given bounding box.\n",
"\n",
"(Note that the datatype of the *literal* parameter should be a string, regardless of the datatype of this field in the output dataframe.)"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[000/006] cccccc\n"
]
},
{
"data": {
"text/html": [
"
\n",
"\n",
"
\n",
" \n",
"
\n",
"
\n",
"
pkey_boring
\n",
"
boornummer
\n",
"
x
\n",
"
y
\n",
"
mv_mtaw
\n",
"
start_boring_mtaw
\n",
"
gemeente
\n",
"
diepte_boring_van
\n",
"
diepte_boring_tot
\n",
"
datum_aanvang
\n",
"
uitvoerder
\n",
"
boorgatmeting
\n",
"
diepte_methode_van
\n",
"
diepte_methode_tot
\n",
"
boormethode
\n",
"
\n",
" \n",
" \n",
"
\n",
"
0
\n",
"
https://www.dov.vlaanderen.be/data/boring/2016...
\n",
"
B/1-102782
\n",
"
201775.5
\n",
"
212960.0
\n",
"
25.0
\n",
"
25.0
\n",
"
Mol
\n",
"
0.0
\n",
"
3600.0
\n",
"
NaN
\n",
"
NaN
\n",
"
False
\n",
"
0.0
\n",
"
0.0
\n",
"
onbekend
\n",
"
\n",
"
\n",
"
1
\n",
"
https://www.dov.vlaanderen.be/data/boring/2016...
\n",
"
B/1-102783
\n",
"
201798.0
\n",
"
212963.0
\n",
"
25.0
\n",
"
25.0
\n",
"
Mol
\n",
"
0.0
\n",
"
3600.0
\n",
"
NaN
\n",
"
NaN
\n",
"
False
\n",
"
0.0
\n",
"
0.0
\n",
"
onbekend
\n",
"
\n",
"
\n",
"
2
\n",
"
https://www.dov.vlaanderen.be/data/boring/2016...
\n",
"
B/1-102784
\n",
"
201768.0
\n",
"
212959.0
\n",
"
25.0
\n",
"
25.0
\n",
"
Mol
\n",
"
0.0
\n",
"
4905.0
\n",
"
2017-12-13
\n",
"
THV Daldrup - Smet
\n",
"
True
\n",
"
0.0
\n",
"
207.0
\n",
"
zuigboring
\n",
"
\n",
"
\n",
"
3
\n",
"
https://www.dov.vlaanderen.be/data/boring/2016...
\n",
"
B/1-102784
\n",
"
201768.0
\n",
"
212959.0
\n",
"
25.0
\n",
"
25.0
\n",
"
Mol
\n",
"
0.0
\n",
"
4905.0
\n",
"
2017-12-13
\n",
"
THV Daldrup - Smet
\n",
"
True
\n",
"
207.0
\n",
"
4905.0
\n",
"
spoelboring
\n",
"
\n",
"
\n",
"
4
\n",
"
https://www.dov.vlaanderen.be/data/boring/2016...
\n",
"
B/1-102785
\n",
"
201790.5
\n",
"
212962.0
\n",
"
25.0
\n",
"
25.0
\n",
"
Mol
\n",
"
0.0
\n",
"
4341.0
\n",
"
2016-03-02
\n",
"
THV Daldrup - Smet
\n",
"
True
\n",
"
0.0
\n",
"
4341.0
\n",
"
spoelboring
\n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" pkey_boring boornummer x \\\n",
"0 https://www.dov.vlaanderen.be/data/boring/2016... B/1-102782 201775.5 \n",
"1 https://www.dov.vlaanderen.be/data/boring/2016... B/1-102783 201798.0 \n",
"2 https://www.dov.vlaanderen.be/data/boring/2016... B/1-102784 201768.0 \n",
"3 https://www.dov.vlaanderen.be/data/boring/2016... B/1-102784 201768.0 \n",
"4 https://www.dov.vlaanderen.be/data/boring/2016... B/1-102785 201790.5 \n",
"\n",
" y mv_mtaw start_boring_mtaw gemeente diepte_boring_van \\\n",
"0 212960.0 25.0 25.0 Mol 0.0 \n",
"1 212963.0 25.0 25.0 Mol 0.0 \n",
"2 212959.0 25.0 25.0 Mol 0.0 \n",
"3 212959.0 25.0 25.0 Mol 0.0 \n",
"4 212962.0 25.0 25.0 Mol 0.0 \n",
"\n",
" diepte_boring_tot datum_aanvang uitvoerder boorgatmeting \\\n",
"0 3600.0 NaN NaN False \n",
"1 3600.0 NaN NaN False \n",
"2 4905.0 2017-12-13 THV Daldrup - Smet True \n",
"3 4905.0 2017-12-13 THV Daldrup - Smet True \n",
"4 4341.0 2016-03-02 THV Daldrup - Smet True \n",
"\n",
" diepte_methode_van diepte_methode_tot boormethode \n",
"0 0.0 0.0 onbekend \n",
"1 0.0 0.0 onbekend \n",
"2 0.0 207.0 zuigboring \n",
"3 207.0 4905.0 spoelboring \n",
"4 0.0 4341.0 spoelboring "
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from owslib.fes import PropertyIsGreaterThanOrEqualTo\n",
"\n",
"query = PropertyIsGreaterThanOrEqualTo(\n",
" propertyname='diepte_boring_tot',\n",
" literal='2000')\n",
"\n",
"df = boring.search(\n",
" location=Within(Box(200000, 211000, 205000, 214000)),\n",
" query=query\n",
" )\n",
"\n",
"df.head()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"We can look at one of the boreholes in a webbrowser using its *pkey_boring*:"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"https://www.dov.vlaanderen.be/data/boring/2016-148767\n",
"https://www.dov.vlaanderen.be/data/boring/2016-148770\n",
"https://www.dov.vlaanderen.be/data/boring/2016-148765\n",
"https://www.dov.vlaanderen.be/data/boring/2016-148766\n",
"https://www.dov.vlaanderen.be/data/boring/2016-148764\n",
"https://www.dov.vlaanderen.be/data/boring/2016-148763\n"
]
}
],
"source": [
"for pkey_boring in set(df.pkey_boring):\n",
" print(pkey_boring)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Select boreholes in a municipality and return depth"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"We can limit the columns in the output dataframe by specifying the *return_fields* parameter in our search.\n",
"\n",
"In this example we query all the boreholes in the city of Ghent and return their depth:"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"
"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"ax = df[df.diepte_boring_tot != 0].boxplot()\n",
"ax.set_ylabel(\"Depth (m)\");\n",
"ax.set_title(\"Distribution borehole depth Gent\");"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Get boreholes based on fields not available in the standard output dataframe"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"To keep the output dataframe size acceptable, not all available WFS fields are included in the standard output. However, one can use this information to select boreholes as illustrated below.\n",
"\n",
"For example, make a selection of the boreholes in municipality the of Antwerp, for which a hydrogeological interpretation was performed:"
]
},
{
"cell_type": "code",
"execution_count": 52,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"
\n",
"\n",
"
\n",
" \n",
"
\n",
"
\n",
"
pkey_boring
\n",
"
boornummer
\n",
"
x
\n",
"
y
\n",
"
diepte_boring_tot
\n",
"
datum_aanvang
\n",
"
\n",
" \n",
" \n",
"
\n",
"
0
\n",
"
https://www.dov.vlaanderen.be/data/boring/1937...
\n",
"
kb7d14e-B82
\n",
"
145457.0
\n",
"
224973.5
\n",
"
10.0
\n",
"
1937-01-01
\n",
"
\n",
"
\n",
"
1
\n",
"
https://www.dov.vlaanderen.be/data/boring/1969...
\n",
"
kb7d14e-B110
\n",
"
143700.4
\n",
"
228086.3
\n",
"
12.0
\n",
"
1969-01-01
\n",
"
\n",
"
\n",
"
2
\n",
"
https://www.dov.vlaanderen.be/data/boring/1966...
\n",
"
kb7d14e-B115
\n",
"
143067.0
\n",
"
227707.6
\n",
"
66.0
\n",
"
1966-01-01
\n",
"
\n",
"
\n",
"
3
\n",
"
https://www.dov.vlaanderen.be/data/boring/1966...
\n",
"
kb7d14e-B117
\n",
"
144770.5
\n",
"
223430.6
\n",
"
49.0
\n",
"
1966-01-01
\n",
"
\n",
"
\n",
"
4
\n",
"
https://www.dov.vlaanderen.be/data/boring/1970...
\n",
"
kb7d14e-B121
\n",
"
143597.8
\n",
"
223498.6
\n",
"
11.9
\n",
"
1970-01-01
\n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" pkey_boring boornummer x \\\n",
"0 https://www.dov.vlaanderen.be/data/boring/1937... kb7d14e-B82 145457.0 \n",
"1 https://www.dov.vlaanderen.be/data/boring/1969... kb7d14e-B110 143700.4 \n",
"2 https://www.dov.vlaanderen.be/data/boring/1966... kb7d14e-B115 143067.0 \n",
"3 https://www.dov.vlaanderen.be/data/boring/1966... kb7d14e-B117 144770.5 \n",
"4 https://www.dov.vlaanderen.be/data/boring/1970... kb7d14e-B121 143597.8 \n",
"\n",
" y diepte_boring_tot datum_aanvang \n",
"0 224973.5 10.0 1937-01-01 \n",
"1 228086.3 12.0 1969-01-01 \n",
"2 227707.6 66.0 1966-01-01 \n",
"3 223430.6 49.0 1966-01-01 \n",
"4 223498.6 11.9 1970-01-01 "
]
},
"execution_count": 52,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from owslib.fes import And\n",
"\n",
"query = And([PropertyIsEqualTo(propertyname='gemeente',\n",
" literal='Antwerpen'),\n",
" PropertyIsEqualTo(propertyname='hydrogeologische_stratigrafie', \n",
" literal='True')]\n",
" )\n",
"df = boring.search(query=query,\n",
" return_fields=('pkey_boring', 'boornummer', 'x', 'y', 'diepte_boring_tot', 'datum_aanvang'))\n",
"df.head()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Get borehole data, returning fields not available in the standard output dataframe"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"As denoted in the previous example, not all available fields are available in the default output frame to keep its size limited. However, you can request any available field by including it in the *return_fields* parameter of the search:"
]
},
{
"cell_type": "code",
"execution_count": 53,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"