diff --git a/examples/example_131635.py b/examples/example_131635.py index c8fea1f..a128ad1 100644 --- a/examples/example_131635.py +++ b/examples/example_131635.py @@ -1,4 +1,6 @@ from brdr.aligner import Aligner +from brdr.enums import GRBType +from brdr.loader import DictLoader, GRBActualLoader from brdr.utils import get_oe_dict_by_ids from examples import show_map @@ -9,8 +11,10 @@ aligner = Aligner() # Load thematic data & reference data dict_theme = get_oe_dict_by_ids([131635]) - aligner.load_thematic_data_dict(dict_theme) - aligner.load_reference_data_grb_actual(grb_type="adp", partition=1000) + loader = DictLoader(dict_theme) + aligner.load_thematic_data(loader) + loader = GRBActualLoader(grb_type=GRBType.ADP, partition=1000, aligner=aligner) + aligner.load_reference_data(loader) # RESULTS rel_dist = 2 diff --git a/examples/example_parcel_change_detector.py b/examples/example_parcel_change_detector.py index 3de08ee..ca998c0 100644 --- a/examples/example_parcel_change_detector.py +++ b/examples/example_parcel_change_detector.py @@ -5,6 +5,7 @@ from shapely.geometry import shape from brdr.aligner import Aligner +from brdr.loader import GeoJsonLoader from brdr.utils import get_collection from brdr.utils import get_oe_geojson_by_bbox @@ -61,10 +62,9 @@ def check_business_equality(base_formula, actual_formula): # base_year base_aligner = Aligner() # Load the thematic data to evaluate -# base_aligner.load_thematic_data_file("testdata/theme_changetest.geojson", -# 'theme_identifier') base_aligner.load_thematic_data_file( -# "testdata/theme_leuven.geojson", 'aanduid_id') -base_aligner.load_thematic_data_geojson(get_oe_geojson_by_bbox(bbox), "aanduid_id") +loader = GeoJsonLoader(get_oe_geojson_by_bbox(bbox), "aanduid_id") +base_aligner.load_thematic_data(loader) + logging.info( "Number of OE-thematic features loaded into base-aligner: " + str(len(base_aligner.dict_thematic)) @@ -78,7 +78,9 @@ def check_business_equality(base_formula, actual_formula): ) collection = get_collection(ref_url, limit) -base_aligner.load_reference_data_geojson(collection, "CAPAKEY") +# base_aligner.load_reference_data_geojson(collection, "CAPAKEY") +loader = GeoJsonLoader(collection, "CAPAKEY") +base_aligner.load_reference_data(loader) # SEARCH FOR CHANGED Parcels in specific timespan # ================================================= @@ -98,6 +100,7 @@ def check_business_equality(base_formula, actual_formula): + "&bbox-crs=EPSG:31370&bbox=" + bbox ) +print(adp_url) collection = get_collection(adp_url, limit) array_features = [] @@ -131,7 +134,8 @@ def check_business_equality(base_formula, actual_formula): "limit=" + str(limit) + "&crs=" + crs + "&bbox-crs=EPSG:31370&bbox=" + bbox ) collection = get_collection(actual_url, limit) -actual_aligner.load_reference_data_geojson(collection, "CAPAKEY") +loader = GeoJsonLoader(collection, "CAPAKEY") +actual_aligner.load_reference_data(loader) # LOOP AND PROCESS ALL POSSIBLE AFFECTED FEATURES