|
|
@ -113,32 +113,38 @@ class Geometry(BaseResource):
|
|
|
|
_now = timezone.now()
|
|
|
|
_now = timezone.now()
|
|
|
|
underlying_parcels = []
|
|
|
|
underlying_parcels = []
|
|
|
|
for result in fetched_parcels:
|
|
|
|
for result in fetched_parcels:
|
|
|
|
fetched_parcel = result[typename]
|
|
|
|
parcel_properties = result["properties"]
|
|
|
|
# There could be parcels which include the word 'Flur',
|
|
|
|
# There could be parcels which include the word 'Flur',
|
|
|
|
# which needs to be deleted and just keep the numerical values
|
|
|
|
# which needs to be deleted and just keep the numerical values
|
|
|
|
## THIS CAN BE REMOVED IN THE FUTURE, WHEN 'Flur' WON'T OCCUR ANYMORE!
|
|
|
|
## THIS CAN BE REMOVED IN THE FUTURE, WHEN 'Flur' WON'T OCCUR ANYMORE!
|
|
|
|
flr_val = fetched_parcel["ave:flur"].replace("Flur ", "")
|
|
|
|
flr_val = parcel_properties["flur"].replace("Flur ", "")
|
|
|
|
district = District.objects.get_or_create(
|
|
|
|
district = District.objects.get_or_create(
|
|
|
|
key=fetched_parcel["ave:kreisschl"],
|
|
|
|
key=parcel_properties["kreisschl"],
|
|
|
|
name=fetched_parcel["ave:kreis"],
|
|
|
|
name=parcel_properties["kreis"],
|
|
|
|
)[0]
|
|
|
|
)[0]
|
|
|
|
municipal = Municipal.objects.get_or_create(
|
|
|
|
municipal = Municipal.objects.get_or_create(
|
|
|
|
key=fetched_parcel["ave:gmdschl"],
|
|
|
|
key=parcel_properties["gmdschl"],
|
|
|
|
name=fetched_parcel["ave:gemeinde"],
|
|
|
|
name=parcel_properties["gemeinde"],
|
|
|
|
district=district,
|
|
|
|
district=district,
|
|
|
|
)[0]
|
|
|
|
)[0]
|
|
|
|
parcel_group = ParcelGroup.objects.get_or_create(
|
|
|
|
parcel_group = ParcelGroup.objects.get_or_create(
|
|
|
|
key=fetched_parcel["ave:gemaschl"],
|
|
|
|
key=parcel_properties["gemaschl"],
|
|
|
|
name=fetched_parcel["ave:gemarkung"],
|
|
|
|
name=parcel_properties["gemarkung"],
|
|
|
|
municipal=municipal,
|
|
|
|
municipal=municipal,
|
|
|
|
)[0]
|
|
|
|
)[0]
|
|
|
|
|
|
|
|
flrstck_nnr = parcel_properties['flstnrnen']
|
|
|
|
|
|
|
|
if not flrstck_nnr:
|
|
|
|
|
|
|
|
flrstck_nnr = None
|
|
|
|
|
|
|
|
flrstck_zhlr = parcel_properties['flstnrzae']
|
|
|
|
|
|
|
|
if not flrstck_zhlr:
|
|
|
|
|
|
|
|
flrstck_zhlr = None
|
|
|
|
parcel_obj = Parcel.objects.get_or_create(
|
|
|
|
parcel_obj = Parcel.objects.get_or_create(
|
|
|
|
district=district,
|
|
|
|
district=district,
|
|
|
|
municipal=municipal,
|
|
|
|
municipal=municipal,
|
|
|
|
parcel_group=parcel_group,
|
|
|
|
parcel_group=parcel_group,
|
|
|
|
flr=flr_val,
|
|
|
|
flr=flr_val,
|
|
|
|
flrstck_nnr=fetched_parcel['ave:flstnrnen'],
|
|
|
|
flrstck_nnr=flrstck_nnr,
|
|
|
|
flrstck_zhlr=fetched_parcel['ave:flstnrzae'],
|
|
|
|
flrstck_zhlr=flrstck_zhlr,
|
|
|
|
)[0]
|
|
|
|
)[0]
|
|
|
|
parcel_obj.district = district
|
|
|
|
parcel_obj.district = district
|
|
|
|
parcel_obj.updated_on = _now
|
|
|
|
parcel_obj.updated_on = _now
|
|
|
|