brdr
BRDR - a Python library to assist in realigning (multi-)polygons (OGC Simple Features) to reference borders
Science Score: 67.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 5 DOI reference(s) in README -
✓Academic publication links
Links to: zenodo.org -
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (11.5%) to scientific vocabulary
Keywords
Repository
BRDR - a Python library to assist in realigning (multi-)polygons (OGC Simple Features) to reference borders
Basic Info
Statistics
- Stars: 4
- Watchers: 7
- Forks: 1
- Open Issues: 15
- Releases: 15
Topics
Metadata Files
README.md
brdr
a Python library to assist in realigning (multi-)polygons (OGC Simple Features) to reference borders
Quick links:
Description
Intro
brdr is a Python package that assists in aligning geometric boundaries to reference boundaries. This is an important
task in geographic data management to enhance data quality.
- In the context of geographic data management, it is important to have accurate and consistent boundaries for a variety of applications such as calculating areas, analyzing spatial relationships, and visualizing and querying geographic information.
- When creating geographic data, it is often more efficient to derive boundaries from existing reference data rather than collecting new data in the field.
brdrcan be used to align boundaries from new data to reference data, ensuring that the boundaries are accurate and consistent.
Example
The figure below shows:
- the original thematic geometry (blue),
- A reference layer (yellow-black).
- The resulting geometry after alignment with
brdr(green)

Functionalities
brdr provides a variety of functionalities in the Aligner-class to assist in aligning boundaries, including:
Loaders:
- aligner.loadthematicdata():Loading thematic data ((Multi-)Polygons) as a dictionary (DictLoader) or geojson ( GeoJsonFileLoader,GeoJsonUrlLoader)
- aligner.loadreferencedata():Loading reference data ((Multi-)Polygons) as a dictionary (DictLoader) or geojson ( GeoJsonFileLoader,GeoJsonUrlLoader)
Processors:
- aligner.process(): Align thematic boundaries to reference boundaries with a specific relevant distance or a range of relevant distances
- aligner.predictor(): Searches all 'stable' (=predicted) processresults in a range of relevant distances
- aligner.getbrdrformula(): Calculating a descriptive formula of a thematic boundary based on a reference layer
- aligner.evaluate(): Compares & evaluates input geometries with another version and adds a EVALUATIONFIELDNAME
Exporters:
- aligner.getresultsas_geojson(): Returns a collection of geojson-dictionaries with the processresults (resulting geometry, differences,...): This can be used for all processresults or only the 'predicted' results
- aligner.getinputas_geojson(): Returns a geojson-featurecollection from input-dictionaries (thematic or reference)
- aligner.save_results(): Exports the resulting geojson-files to a specified path:This can be used for all processresults or only the 'predicted' results
Besides the generic functionalities, a range of Flanders-specific functionalities are provided:
- Loaders:
- GRBActualLoader: Loading actual GRB (parcels, buildings)
- GRBFiscalParcelLoader: Loading fiscal GRB-parcels of a specific year
- Processors:
- grb.getgeomsaffectedbygrb_change(): get thematic geometries that are possibly affected by GRB-changes during a specific timespan
- grb.updatetoactual_grb(): aligns the boundaries of thematic features to the actual GRB-boundaries
Possible application fields
- Geodata-management:
- Implementation of
brdrin business-processes and tooling - Bulk geodata-alignment
- Alignment after reprojection of data
- Cleaning data: In a postprocessing-phase, the algorithm executes sliver-cleanup and validity-cleaning on the resulting geometries
- Version management: visualise differences between versions of geodata
- ...
- Implementation of
- Data-Analysis: Investigate the pattern in deviation and change between thematic and reference boundaries
- Update-detection: Investigate the descriptive formula before and after alignment to check for (automatic) alignment of geodata
- ...
QGIS-script
An implementation of brdr for QGIS can be found at GitHub-brdrQ.
This QGIS- script provides a User Interface to align thematic data to a reference layer, showing the results in the QGIS
Table of Contents.
Installation
You can install the latest release of brdr from
GitHub or
PyPi:
python
pip install brdr
Basic example
``` python from brdr.aligner import Aligner from brdr.enums import OpenDomainStrategy from brdr.geometryutils import geomfrom_wkt from brdr.loader import DictLoader
CREATE AN ALIGNER
aligner = Aligner( crs="EPSG:31370", )
ADD A THEMATIC POLYGON TO THEMATIC DICTIONARY and LOAD into Aligner
thematicdict = {"themeid1": geomfromwkt("POLYGON ((0 0, 0 9, 5 10, 10 0, 0 0))")} loader = DictLoader(thematicdict) aligner.loadthematicdata(loader)
ADD A REFERENCE POLYGON TO REFERENCE DICTIONARY and LOAD into Aligner
referencedict = {"refid1": geomfromwkt("POLYGON ((0 1, 0 10,8 10,10 1,0 1))")} loader = DictLoader(referencedict) aligner.loadreferencedata(loader)
EXECUTE THE ALIGNMENT
relevantdistance = 1 processresult = aligner.process( relevantdistance=relevantdistance, odstrategy=OpenDomainStrategy.SNAPINNERSIDE, thresholdoverlap_percentage=50, )
PRINT RESULTS IN WKT
print("result: " + processresult["themeid1"][relevant_distance]["result"].wkt) print( "added area: " + processresult["themeid1"][relevantdistance]["resultdiffplus"].wkt ) print( "removed area: " + processresult["themeid1"][relevantdistance]["resultdiff_min"].wkt )
```
The resulting figure shows:
- the reference polygon (yellow-black)
- the original geometry (blue)
- the resulting geometry (green line)
- the added zone (green squares)
- the removed zone (red squares)

More examples can be found in Examples
Workflow
(see also Basic example)
To use brdr, follow these steps:
- Create a Aligner-class with specific parameters:
- relevant_distance (m) (default: 1): Distance-parameter used to decide which parts will be aligned, and which parts remain unchanged.
- odstrategy (enum) (default: SNAPSINGLE_SIDE): Strategy to align geodata that is not covered by reference-data
- thresholdoverlappercentage (%)(0-100) (default 50)
- crs: The Coordinate Reference System (CRS) (default: EPSG:31370 - Belgian Lambert72)
- Load thematic data
- Load reference data
- Process (align) the thematic data
- Results are returned:
- Resulting geometry
- Differences: parts that are 'different' from the original geometry (positive or negative)
- Positive differences: parts that are added to the original geometry
- Negative differences: parts that are removed form the original geometry
- Relevant intersections: relevant intersecting parts of the reference geometries
- Relevant differences: relevant differences of the reference geometries
The brdr-algorithm
The algorithm for alignment is based on 2 main principles:
- Principle of intentionality: Thematic boundaries can consciously or unconsciously deviate from the reference borders. The algorithm should keep notice of that.
- Selective spatial conservation of shape: The resulting geometry should re-use the shape of the reference borders where aligned is of relevance.
The figure below shows a schematic overview of the algorithm:

The algorithm can be split into 3 main phases:
- Initialisation:
- Deciding which reference polygons are candidate-polygons to re-use its shape. The reference candidate polygons are selected based on spatial intersection with the thematic geometry.
- Processing:
- Process all candidate-reference polygons one-by-one
- Calculate relevant zones for each candidate-reference-polygon
- relevant intersections: zones that must be present in the final result
- relevant differences: zones that must be excluded from the final result

- Evaluate each candidate based on their relative zones: which parts must be kept and which parts must be excluded

- Union all kept parts to recompose a resulting geometry
- Post-processing:
- Validation/correction of differences between the original input geometry and the composed intermediate resulting geometry after processing the algorithm
- Technical validation of inner holes and multipolygons that are created by processing the algorithm
- Clean-up slivers
- Make the resulting geometry valid
RESULT:
A new resulting output geometry, aligned to the reference-polygons
Development
pip-compile
sh
PIP_COMPILE_ARGS="-v --strip-extras --no-header --resolver=backtracking --no-emit-options --no-emit-find-links"
pip-compile $PIP_COMPILE_ARGS
pip-compile $PIP_COMPILE_ARGS -o requirements-dev.txt --all-extras
tests
python
python - m
pytest - -cov = brdr
tests / --cov - report
term - missing
Docker
As an example-usage (proof-of-concept), a Dockerfile is created to set up a GRB-specific webservice that 'predicts' one or multiple actual geometries for a input-geometry based on the reference source GRB. This webservice is based on 'brdr'.
This POC can be found at brdr-webservice (GRB-actualisator).
```bat docker build -f Dockerfile . -t grbwebservice docker run --rm -p 80:80 --name grbwebservice grb_webservice
example can be found at: http://localhost:80/docs#/default/actualiseractualiserpost ```
Motivation & citation
A more in-depth description of the algorithm can be found in the following article (in dutch):
- Dieussaert, K., Vanvinckenroye, M., Vermeyen, M., & Van Daele, K. (2024). Grenzen verleggen. Automatische correcties van geografische afbakeningen op verschuivende onderlagen Onderzoeksrapporten Agentschap Onroerend Erfgoed,
Comments and contributions
We would love to hear from you and your experiences with
brdr or its sister project brdrQ.
The discussions forum is the place to be when:
- You have any questions on using
brdrorbrdrQor their applicability to your use cases - Want to share your experiences with the library
- Have any suggestions for improvements or feature requests
If you have discovered a bug in the brdr library you can report it here:
https://github.com/OnroerendErfgoed/brdr/issues
We try to keep the list of issues as clean as possible. If
you're unsure whether something is a bug, or whether the bug is in brdr
or brdrQ, we encourage you to go through the discussions forum
first.
Acknowledgement
This software was created by Athumi, the Flemish data utility company, and Flanders Heritage Agency.

Owner
- Name: Onroerend Erfgoed
- Login: OnroerendErfgoed
- Kind: organization
- Location: Brussels, Belgium
- Website: https://www.onroerenderfgoed.be
- Twitter: vioe
- Repositories: 76
- Profile: https://github.com/OnroerendErfgoed
Open Source Software by the Agentschap Onroerend Erfgoed (Flanders Heritage Agency).
Citation (CITATION.cff)
# This CITATION.cff file was generated with cffinit.
# Visit https://bit.ly/cffinit to generate yours today!
cff-version: 1.2.0
title: BRDR
message: >-
If you use this software, please cite it using the
metadata from this file.
type: software
authors:
- given-names: Karel
family-names: Dieussaert
- given-names: Emrys
family-names: Roef
affiliation: Geo Solutions
- given-names: Maarten
family-names: Vermeyen
email: maarten.vermeyen@vlaanderen.be
affiliation: Agentschap Onroerend Erfgoed
orcid: 'https://orcid.org/0000-0003-1197-6562'
- given-names: Koen
family-names: Van Daele
email: koen.vandaele@vlaanderen.be
affiliation: Agentschap Onroerend Erfgoed
orcid: 'https://orcid.org/0000-0002-8153-2978'
repository-code: 'https://github.com/OnroerendErfgoed/brdr'
url: 'https://github.com/OnroerendErfgoed/brdr'
abstract: >-
a Python library to assist in realigning (multi-)polygons
(OGC Simple Features) to reference borders
references:
- doi: 10.55465/SXCW6218
type: report
date-release: 2024-06-24
title: 'Grenzen verleggen. Automatische correcties van geografische afbakeningen op verschuivende onderlagen'
collection-title: 'Onderzoeksrapporten agentschap Onroerend Erfgoed'
number: 332
authors:
- given-names: Karel
family-names: Dieussaert
- given-name: Monique
family-names: Vanvinckenroye
affiliation: Agentschap Onroerend Erfgoed
- given-names: Maarten
family-names: Vermeyen
email: maarten.vermeyen@vlaanderen.be
affiliation: Agentschap Onroerend Erfgoed
orcid: 'https://orcid.org/0000-0003-1197-6562'
- given-names: Koen
family-names: Van Daele
email: koen.vandaele@vlaanderen.be
affiliation: Agentschap Onroerend Erfgoed
orcid: 'https://orcid.org/0000-0002-8153-2978'
notes: Publication in Dutch documenting how the brdr algorithm and QGIS plugin operate
pages: 52
license: MIT
keywords:
- GIS
- Geodata
- Geodata management
license: MIT
GitHub Events
Total
- Create event: 35
- Release event: 8
- Issues event: 100
- Watch event: 4
- Delete event: 18
- Member event: 2
- Issue comment event: 53
- Push event: 133
- Pull request event: 85
- Fork event: 1
Last Year
- Create event: 35
- Release event: 8
- Issues event: 100
- Watch event: 4
- Delete event: 18
- Member event: 2
- Issue comment event: 53
- Push event: 133
- Pull request event: 85
- Fork event: 1
Issues and Pull Requests
Last synced: 8 months ago
All Time
- Total issues: 106
- Total pull requests: 147
- Average time to close issues: 13 days
- Average time to close pull requests: about 14 hours
- Total issue authors: 5
- Total pull request authors: 5
- Average comments per issue: 0.84
- Average comments per pull request: 0.11
- Merged pull requests: 120
- Bot issues: 0
- Bot pull requests: 2
Past Year
- Issues: 87
- Pull requests: 90
- Average time to close issues: 11 days
- Average time to close pull requests: about 6 hours
- Issue authors: 3
- Pull request authors: 3
- Average comments per issue: 0.56
- Average comments per pull request: 0.14
- Merged pull requests: 69
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- dieuska (91)
- maarten-vermeyen (7)
- roefem (4)
- koenedaele (3)
- cedrikv (1)
Pull Request Authors
- dieuska (110)
- maarten-vermeyen (16)
- roefem (14)
- koenedaele (5)
- dependabot[bot] (2)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 50 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 14
- Total maintainers: 1
pypi.org: brdr
BRDR - a Python library to assist in realigning (multi-)polygons (OGC Simple Features) to reference borders
- Documentation: https://github.com/OnroerendErfgoed/brdr/blob/main/README.md
- License: MIT License Copyright (c) 2024 Onroerend Erfgoed Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
Latest release: 0.13.0
published 8 months ago
Rankings
Maintainers (1)
Dependencies
- geojson ==3.1.0
- geopandas ==0.14.3
- matplotlib ==3.8.4
- requests ==2.31.0
- shapely ==2.0.4
- attrs ==23.2.0 development
- black ==24.4.0 development
- build ==1.2.1 development
- certifi ==2024.2.2 development
- charset-normalizer ==3.3.2 development
- click ==8.1.7 development
- click-plugins ==1.1.1 development
- cligj ==0.7.2 development
- contourpy ==1.2.1 development
- coverage ==7.4.4 development
- cycler ==0.12.1 development
- fiona ==1.9.6 development
- fonttools ==4.51.0 development
- geojson ==3.1.0 development
- geopandas ==0.14.3 development
- idna ==3.7 development
- iniconfig ==2.0.0 development
- kiwisolver ==1.4.5 development
- matplotlib ==3.8.4 development
- mypy ==1.9.0 development
- mypy-extensions ==1.0.0 development
- numpy ==1.26.4 development
- packaging ==24.0 development
- pandas ==2.2.2 development
- pathspec ==0.12.1 development
- pillow ==10.3.0 development
- pip-tools ==7.4.1 development
- platformdirs ==4.2.0 development
- pluggy ==1.4.0 development
- pyparsing ==3.1.2 development
- pyproj ==3.6.1 development
- pyproject-hooks ==1.0.0 development
- pytest ==8.1.1 development
- pytest-cov ==5.0.0 development
- python-dateutil ==2.9.0.post0 development
- pytz ==2024.1 development
- requests ==2.31.0 development
- shapely ==2.0.4 development
- six ==1.16.0 development
- toml ==0.10.2 development
- types-requests ==2.31.0.20240406 development
- typing-extensions ==4.11.0 development
- tzdata ==2024.1 development
- urllib3 ==2.2.1 development
- wheel ==0.43.0 development
- attrs ==23.2.0
- certifi ==2024.2.2
- charset-normalizer ==3.3.2
- click ==8.1.7
- click-plugins ==1.1.1
- cligj ==0.7.2
- contourpy ==1.2.1
- cycler ==0.12.1
- fiona ==1.9.6
- fonttools ==4.51.0
- geojson ==3.1.0
- geopandas ==0.14.3
- idna ==3.7
- kiwisolver ==1.4.5
- matplotlib ==3.8.4
- numpy ==1.26.4
- packaging ==24.0
- pandas ==2.2.2
- pillow ==10.3.0
- pyparsing ==3.1.2
- pyproj ==3.6.1
- python-dateutil ==2.9.0.post0
- pytz ==2024.1
- requests ==2.31.0
- shapely ==2.0.4
- six ==1.16.0
- tzdata ==2024.1
- urllib3 ==2.2.1
- actions/checkout v4 composite
- actions/setup-python v5 composite