Skip to content

Commit

Permalink
function to extract fiscal parcels from grb
Browse files Browse the repository at this point in the history
  • Loading branch information
dieuska committed Aug 13, 2024
1 parent ac6a381 commit 25e3395
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 10 deletions.
3 changes: 3 additions & 0 deletions brdr/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,6 @@

# URL of the OGC feature API of actual GRB to extract collections
GRB_FEATURE_URL = "https://geo.api.vlaanderen.be/GRB/ogc/features/collections"

# URL of the OGC feature API of GRB fiscal parcels (situation of 1st of January) to extract collections
GRB_FISCAL_PARCELS_URL = "https://geo.api.vlaanderen.be/Adpf/ogc/features/collections"
14 changes: 14 additions & 0 deletions brdr/grb.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
DEFAULT_CRS,
MAX_REFERENCE_BUFFER,
GRB_FEATURE_URL,
GRB_FISCAL_PARCELS_URL,
)
from brdr.enums import GRBType
from shapely import intersects
Expand Down Expand Up @@ -254,3 +255,16 @@ def get_reference_data_dict_grb_actual(
)

return dictionary, name_reference_id


def get_collection_grb_fiscal_parcels(
year=str(datetime.now().year), bbox=None, limit=DOWNLOAD_LIMIT, crs=DEFAULT_CRS
):
# Load the Base reference data
url = (
GRB_FISCAL_PARCELS_URL + "/Adpf" + year + "/items?"
"limit=" + str(limit) + "&crs=" + crs
)
if bbox is not None:
url = url + "&bbox-crs=" + crs + "&bbox=" + bbox
return get_collection(url, limit)
17 changes: 7 additions & 10 deletions examples/example_parcel_change_detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@

from brdr.aligner import Aligner
from brdr.enums import GRBType
from brdr.grb import get_last_version_date, get_geoms_affected_by_grb_change
from brdr.grb import (
get_last_version_date,
get_geoms_affected_by_grb_change,
get_collection_grb_fiscal_parcels,
)
from brdr.loader import GeoJsonLoader, GRBActualLoader, DictLoader
from brdr.utils import get_collection
from brdr.utils import get_oe_geojson_by_bbox
Expand Down Expand Up @@ -82,16 +86,9 @@ def check_business_equality(base_formula, actual_formula):
"Number of OE-thematic features loaded into base-aligner: "
+ str(len(base_aligner.dict_thematic))
)
# Load the Base reference data
ref_url = (
"https://geo.api.vlaanderen.be/Adpf/ogc/features/collections/Adpf"
+ base_year
+ "/items?"
"limit=" + str(limit) + "&crs=" + crs + "&bbox-crs=EPSG:31370&bbox=" + bbox
)
collection = get_collection(ref_url, limit)
collection_fiscal_parcels = get_collection_grb_fiscal_parcels(base_year, bbox=bbox)

loader = GeoJsonLoader(collection, "CAPAKEY")
loader = GeoJsonLoader(collection_fiscal_parcels, "CAPAKEY")
base_aligner.load_reference_data(loader)

keys_to_exclude = []
Expand Down

0 comments on commit 25e3395

Please sign in to comment.