Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
6c9484d
Add Weka Hills Leapfrog demo data and setup marimo notebook
JoostGevaert Jun 26, 2025
705ca46
Merge branch 'main' into weka-hills-example
JoostGevaert Jun 26, 2025
5023848
Merge remote-tracking branch 'origin/dev' into weka-hills-example
JoostGevaert Jun 26, 2025
40c54a2
Minimal Weka Hills GI example marimo notebook
JoostGevaert Jun 26, 2025
b37ff50
Use a dict with hardcoded file names in weka-hills example
JulesBlm Jun 27, 2025
858a8de
Tweak CITATION file
JoostGevaert Jul 21, 2025
56e3330
Add a few more keywords to the CITATION.cff
JoostGevaert Jul 24, 2025
9ff7678
Make the links at the top of the README prettier: better emojis & no …
JoostGevaert Sep 1, 2025
666beff
Create an experimental marimo nb for creating relational dbs with a p…
JoostGevaert Sep 1, 2025
bb41654
Merge remote-tracking branch 'origin/weka-hills-example' into dev
JoostGevaert Sep 1, 2025
5bf876a
Update windows-latest to windows-2025 in GitHub Actions. windows-late…
JoostGevaert Sep 1, 2025
351526a
Upgrade package versions
JoostGevaert Sep 1, 2025
f89e5a7
Do additional tests for ellips - ortho transformations
JoostGevaert Sep 12, 2025
540ac2e
FIX ellips - ortho height transformations with pyproj with network ac…
JoostGevaert Sep 12, 2025
75a3e45
Upgrade package versions
JoostGevaert Oct 20, 2025
819c37a
Make a start on Overhoeks Amsterdam example and add context.gpkg and …
JoostGevaert Oct 20, 2025
fab7601
Create kinda nice app to select an area from which you want to downlo…
JoostGevaert Oct 21, 2025
29f4ebb
Rename marimo notebook such that it doesn't conflict with Jules' CPT …
JoostGevaert Nov 10, 2025
3a99cdd
Merge branch 'main' into dev
JoostGevaert Nov 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
os: [ubuntu-latest, windows-2025]
python-version: ['3.10', '3.12']

steps:
Expand Down
9 changes: 6 additions & 3 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,12 @@ identifiers:
repository-code: 'https://github.com/bedrock-engineer/bedrock-ge'
url: 'https://bedrock.engineer/'
keywords:
- ground investigation
- geotechnical engineering
- ground engineering
- "ground investigation"
- "geotechnical engineering"
- "ground engineering"
- geotechnics
- "civil engineering"
- python
- geospatial
- gis
- bim
Expand Down
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@

---

🌐 **Website:** <https://bedrock.engineer/>
🌐 **Website:** <https://bedrock.engineer>

📃 **Documentation:** <https://bedrock.engineer/docs>
📖 **Documentation:** <https://bedrock.engineer/getting-started>

📃 **API Reference:** <https://bedrock.engineer/reference/>
📑 **API Reference:** <https://bedrock.engineer/reference>

🐍 **`bedrock-ge` on PyPI:** <https://pypi.org/project/bedrock-ge/>
🖥️ **Source Code:** <https://github.com/bedrock-engineer/bedrock-ge>

🐍 **`bedrock-ge` on PyPI:** <https://pypi.org/project/bedrock-ge>

🔗 **LinkedIn:** <https://www.linkedin.com/company/bedrock-engineer>

Expand Down
Binary file added examples/nl_amsterdam/context.gpkg
Binary file not shown.
1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000037783.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000060419.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000061388.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000061389.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000061390.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000061397.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000061398.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000061518.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000061548.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000061549.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000198147.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000198148.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000198149.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000198154.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000198155.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000198156.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000198157.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000198158.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000198159.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000198160.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000198161.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000198162.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000198163.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000198164.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000198165.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000198166.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000198167.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000198168.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000198169.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000198173.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000198174.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000198175.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000198176.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000198177.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000202087.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000202240.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000202241.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000202286.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000202327.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000203445.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000203457.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000203491.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000203502.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000204199.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000204208.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000204225.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000204240.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000204246.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000204248.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000204273.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000204310.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000204357.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000204363.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000204377.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000204382.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000204388.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000204395.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000204513.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000205801.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000205817.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000205835.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000205856.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000205857.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000205873.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000205937.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000205973.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000205985.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000205986.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000206072.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000206112.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000206113.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000206148.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000206206.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000206209.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000206221.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000206226.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000206238.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000206248.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000206252.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000206260.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000206273.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000206331.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000206335.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000206344.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000206353.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000251519.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000251552.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000251617.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000251670.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000251774.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/nl_amsterdam/data/CPT000000251863.xml

Large diffs are not rendered by default.

329 changes: 329 additions & 0 deletions examples/nl_amsterdam/get_cpts_from_bro.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,329 @@
# /// script
# requires-python = ">=3.10"
# dependencies = [
# "folium==0.20.0",
# "geopandas==1.1.1",
# "mapclassify==2.8.1",
# "marimo",
# "matplotlib==3.10.7",
# "pygef==0.13.0",
# ]
# ///

import marimo

__generated_with = "0.17.0"
app = marimo.App(width="columns")


@app.cell(column=0, hide_code=True)
def _(mo):
mo.md(
r"""
How to access BRO data: [Handreiking Afname BRO Gegevens](https://www.bro-productomgeving.nl/bpo/latest/handreiking-afname-bro-gegevens)

1. [BROloket](https://www.broloket.nl/ondergrondgegevens)
2. BRO APIs
1. SOAP - impractical, because requires a digital "PKI" certificate.
2. [REST](https://www.bro-productomgeving.nl/bpo/latest/url-s-publieke-rest-services)
1. CPT: <https://publiek.broservices.nl/sr/cpt/v1>
2. Goetechnical boreholes: <https://publiek.broservices.nl/sr/bhrgt/v2>
3. [PDOK](https://app.pdok.nl/viewer)
1. WMS - This is useful for quickly viewing the location of historic CPTs or geotechnical boreholes.
2. ATOM feed - For downloading the whole dataset, i.e. to download all CPTs or all geotechnical boreholes in BRO.
"""
)
return


@app.cell(hide_code=True)
def _(Request, bounds, datetime, json, minidom, mo, pl, urlopen, xmltodict):
cpt_search_url = "https://publiek.broservices.nl/sr/cpt/v1/characteristics/searches"
api_request_data = json.dumps(
{
"registrationPeriod": {
"beginDate": "2017-01-01",
"endDate": datetime.date.today().isoformat(),
},
"area": {
"boundingBox": {
"lowerCorner": {
"lon": bounds[0],
"lat": bounds[1],
},
"upperCorner": {
"lon": bounds[2],
"lat": bounds[3],
},
}
},
}
).encode("utf-8")

cpt_search_req = Request(
cpt_search_url,
data=api_request_data,
headers={"Content-Type": "application/json"},
method="POST",
)
with urlopen(cpt_search_req, timeout=30) as cpt_search_resp:
xml = cpt_search_resp.read()

cpt_search_dict = xmltodict.parse(
xml,
xml_attribs=False,
process_namespaces=True,
namespaces={
"http://www.opengis.net/gml/3.2": None,
"http://www.broservices.nl/xsd/dscpt/1.1": None,
"http://www.broservices.nl/xsd/brocommon/3.0": None,
},
)

def to_bool(col: str) -> pl.Expr:
truthy = ["ja", "yes", "true", "1"]
return pl.col(col).str.to_lowercase().is_in(truthy)

def parse_pos(col: str) -> pl.Expr:
return (
pl.col(col)
.struct.field("pos")
.str.split(" ")
.cast(pl.Array(float, 2))
.alias(col)
)

cpt_search_df = (
pl.DataFrame(
cpt_search_dict["dispatchCharacteristicsResponse"]["dispatchDocument"]
)
.unnest("CPT_C")
.with_columns(
# Casts
pl.col("deliveryAccountableParty").cast(int),
pl.col("objectRegistrationTime").cast(pl.Datetime),
pl.col("offset").cast(float),
pl.col("startTime").cast(pl.Date),
pl.col("predrilledDepth").cast(float),
pl.col("finalDepth").cast(float),
# "ja" / "nee" -> boolean
to_bool("deregistered"),
to_bool("underReview"),
to_bool("dissipationTestPerformed"),
# {"pos":"lon lat"} -> pl.Array[float,2 ] (keeps [lon, lat])
parse_pos("standardizedLocation"),
parse_pos("deliveredLocation"),
# {"date":"YYYY-MM-DD"} -> pl.Date
pl.col("researchReportDate")
.struct.field("date")
.cast(pl.Date)
.alias("researchReportDate"),
)
)
cpt_search_table = mo.ui.table(cpt_search_df)

tabs = mo.ui.tabs(
{
"DataFrame": cpt_search_table,
"XML": mo.md(
f"```xml\n{minidom.parseString(xml).toprettyxml(indent=' ')}\n```"
),
"JSON": xmltodict.parse(xml),
"JSON, no XML attributes": cpt_search_dict,
}
)

tabs
return (cpt_search_df,)


@app.cell
def _(BytesIO, Request, cpt_search_df, pl, read_cpt, urlopen):
cpts = []
cpt_data = []
for bro_id in cpt_search_df["broId"]:
cpt_get_url = f"https://publiek.broservices.nl/sr/cpt/v1/objects/{bro_id}"
cpt_get_req = Request(cpt_get_url, method="GET")
with urlopen(cpt_get_req, timeout=30) as resp:
cpt_xml = resp.read()
cpt_obj = read_cpt(BytesIO(cpt_xml))
cpt_data.append(
cpt_obj.data.with_columns(pl.lit(cpt_obj.bro_id).alias("broId"))
)
cpt_dict = cpt_obj.__dict__.copy()
del cpt_dict["data"]
cpt_dict["delivered_location"] = [
cpt_dict["delivered_location"].x,
cpt_dict["delivered_location"].y,
]
cpt_dict["standardized_location"] = [
cpt_dict["standardized_location"].x,
cpt_dict["standardized_location"].y,
]
cpt_dict["delivered_vertical_position_datum"] = cpt_dict["delivered_vertical_position_datum"]._name_
cpts.append(cpt_dict)

cpts_df = pl.DataFrame(cpts).cast(
{
"delivered_location": pl.Array(float, 2),
"standardized_location": pl.Array(float, 2),
}
)
cpt_data_df = pl.concat(cpt_data, how="diagonal_relaxed")
return (cpt_data_df,)


@app.cell(hide_code=True)
def _():
import datetime
import json
import xml.dom.minidom as minidom
from io import BytesIO
from urllib.request import Request, urlopen

import folium
import geopandas as gpd
import marimo as mo
import polars as pl
import xmltodict

from folium.plugins import Draw
from lxml import etree
from pygef import read_cpt
from pygef.plotting import plot_cpt

cwd = mo.notebook_location()
return (
BytesIO,
Draw,
Request,
datetime,
folium,
gpd,
json,
minidom,
mo,
pl,
read_cpt,
urlopen,
xmltodict,
)


@app.cell(column=1, hide_code=True)
def _(Draw, buffer, folium, geojson_text_area, gpd, json, site_geojson):
geojson = geojson_text_area.value if geojson_text_area.value else site_geojson
# Create a folium interactive map (leaflet.js maps)
site = gpd.GeoDataFrame.from_features(
{
"type": "FeatureCollection",
"name": "site",
"features": [json.loads(geojson)],
},
crs=4326,
).to_crs(28992)
buffered_site = site.geometry.buffer(buffer.value)
bounds = buffered_site.to_crs(4326).bounds.to_numpy()[0]
folium_map = buffered_site.explore(
# tiles="https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}",
tiles="CartoDB positron",
style_kwds={"fillOpacity": 0.1},
attr=("Esri.WorldStreetMap"),
)
site.explore(m=folium_map, color="red", style_kwds={"fill": False})
bounds_rectangle = folium.Rectangle(
bounds=[[bounds[1], bounds[0]], [bounds[3], bounds[2]]],
color="black",
weight=0.5,
)
bounds_rectangle.add_to(folium_map)

# Add PDOK's CPT WMS layer
folium.WmsTileLayer(
url="https://service.pdok.nl/bzk/geologie/bro-geotechnisch-sondeeronderzoek/wms/v1_0?request=GetCapabilities&service=WMS",
name="BRO CPT",
fmt="image/png",
layers="GE.conePenetrationTest",
transparent=True,
).add_to(folium_map)

# Add PDOK's geotechnical borehole WMS layer
folium.WmsTileLayer(
url="https://service.pdok.nl/bzk/geologie/bro-geotechnisch-booronderzoek/wms/v1_0?request=getcapabilities&service=wms",
name="BRO BHR-GT",
fmt="image/png",
layers="GE.Borehole",
transparent=True,
).add_to(folium_map)

# Add drawing widget
draw = Draw(
export=True,
filename="site.geojson",
position="topleft",
draw_options={
"polyline": True,
"polygon": True,
"circle": False,
"rectangle": False,
"marker": True,
"circlemarker": False,
},
).add_to(folium_map)

folium_map
return bounds, bounds_rectangle, site


@app.cell(hide_code=True)
def _(mo):
site_geojson = '{"type":"Feature","properties":{},"geometry":{"type":"Polygon","coordinates":[[[4.902889698063478,52.385435257999404],[4.902923632305726,52.385509906165986],[4.902901716440955,52.385619936470341],[4.903006347021203,52.38569026942325],[4.90389499998988,52.385854235381281],[4.904091535809526,52.385902562073795],[4.904285950739031,52.385988859607401],[4.904484607448818,52.38602683046868],[4.904532680958658,52.386042363993511],[4.904790722592364,52.386094573856099],[4.904799206152918,52.386073862513044],[4.904974533071164,52.386108812898868],[4.904999276789463,52.386100183176488],[4.905287541107636,52.385853480276289],[4.903576336246269,52.385074312916224],[4.903554420381488,52.385093082996256],[4.903498923756159,52.38509416173622],[4.903484784488561,52.385100202679702],[4.903473119592793,52.385110990076754],[4.903287895187223,52.385027927051986],[4.903256788798504,52.38504302943177],[4.903150390809821,52.38513472234078],[4.903119637902792,52.385127171167227],[4.903098782483085,52.38514421524286],[4.903084996697174,52.385139037296511],[4.90302349088312,52.385198152147602],[4.902889698063478,52.385435257999404]]]}}'
geojson_text_area = mo.ui.text_area(
placeholder="1. Draw a shape on the map.\n2. Click it.\n3. Copy the GeoJSON from the pop-up.\n4. Paste GeoJSON here.",
debounce=5,
full_width=True,
)
buffer = mo.ui.slider(start=0, stop=200, label="Buffer", value=100, step=10)
mo.hstack(
[geojson_text_area, buffer],
widths=[1, 0],
)
return buffer, geojson_text_area, site_geojson


@app.cell(hide_code=True)
def _(mo):
mo.md(r"""The bouding box around the site + buffer that we created above is now used to make a call to the BRO API to retrieve all the CPT characteristics of the CPTs in that bounding box.""")
return


@app.cell(hide_code=True)
def _(bounds_rectangle, cpt_search_df, gpd, site):
cpt_search_gdf = gpd.GeoDataFrame(cpt_search_df.to_pandas(), geometry=gpd.points_from_xy(cpt_search_df["deliveredLocation"].arr.get(0), cpt_search_df["deliveredLocation"].arr.get(1)), crs=28992)
cpt_map = cpt_search_gdf.explore(tiles="CartoDB positron")
bounds_rectangle.add_to(cpt_map)
site.explore(m=cpt_map, color="red", style_kwds={"fill": False})
cpt_map
return


@app.cell
def _(cpt_data_df):
cpt_data_df
return


@app.cell
def _(cpt_data_df, mo):
mo.ui.dataframe(cpt_data_df)
return


@app.cell
def _(cpt_data_df):
cpt_data_df.filter(cpt_data_df["broId"].contains("CPT000000198163"))
return


if __name__ == "__main__":
app.run()
Loading