diff --git a/compensation/forms/eco_account.py b/compensation/forms/eco_account.py
index 9e74e839..0352383c 100644
--- a/compensation/forms/eco_account.py
+++ b/compensation/forms/eco_account.py
@@ -175,7 +175,7 @@ class EditEcoAccountForm(NewEcoAccountForm):
def is_valid(self):
valid = super().is_valid()
- deductable_surface = self.cleaned_data.get("surface")
+ deductable_surface = self.cleaned_data.get("surface") or 0.0
deduction_surface_sum = self.instance.get_deductions_surface()
if deductable_surface < deduction_surface_sum:
self.add_error(
diff --git a/compensation/models/compensation.py b/compensation/models/compensation.py
index a32926c9..86956b42 100644
--- a/compensation/models/compensation.py
+++ b/compensation/models/compensation.py
@@ -9,8 +9,10 @@ import shutil
from django.contrib import messages
+from analysis.settings import LKOMPVZVO_PUBLISH_DATE
from codelist.models import KonovaCode
-from compensation.settings import COMPENSATION_IDENTIFIER_TEMPLATE, COMPENSATION_IDENTIFIER_LENGTH
+from compensation.settings import COMPENSATION_IDENTIFIER_TEMPLATE, COMPENSATION_IDENTIFIER_LENGTH, \
+ COMPENSATION_LANIS_LAYER_NAME_RECORDED, COMPENSATION_LANIS_LAYER_NAME_UNRECORDED, COMPENSATION_LANIS_LAYER_NAME_UNRECORDED_OLD_ENTRY
from user.models import User, Team
from django.db import models, transaction
from django.db.models import QuerySet, Sum
@@ -478,6 +480,28 @@ class Compensation(AbstractCompensation, CEFMixin, CoherenceMixin, PikMixin):
"""
return self.intervention.is_recorded
+ def get_lanis_layer_name(self):
+ """ Getter for specific LANIS/WFS object layer
+
+ Returns:
+
+ """
+ retval = None
+ if self.is_recorded:
+ retval = COMPENSATION_LANIS_LAYER_NAME_RECORDED
+ else:
+ try:
+ is_old_entry = self.intervention.legal.binding_date < LKOMPVZVO_PUBLISH_DATE
+ except TypeError:
+ is_old_entry = False
+
+ if is_old_entry:
+ retval = COMPENSATION_LANIS_LAYER_NAME_UNRECORDED_OLD_ENTRY
+ else:
+ retval = COMPENSATION_LANIS_LAYER_NAME_UNRECORDED
+
+ return retval
+
class CompensationDocument(AbstractDocument):
"""
diff --git a/compensation/models/eco_account.py b/compensation/models/eco_account.py
index fc65e500..afebfbe0 100644
--- a/compensation/models/eco_account.py
+++ b/compensation/models/eco_account.py
@@ -9,13 +9,12 @@ import shutil
from django.urls import reverse
-from compensation.settings import ECO_ACCOUNT_IDENTIFIER_TEMPLATE, ECO_ACCOUNT_IDENTIFIER_LENGTH
+from compensation.settings import ECO_ACCOUNT_IDENTIFIER_TEMPLATE, ECO_ACCOUNT_IDENTIFIER_LENGTH, \
+ ECO_ACCOUNT_LANIS_LAYER_NAME_RECORDED, ECO_ACCOUNT_LANIS_LAYER_NAME_UNRECORDED
from konova.utils.message_templates import DEDUCTION_REMOVED, DOCUMENT_REMOVED_TEMPLATE
-from django.core.exceptions import ValidationError
from django.core.validators import MinValueValidator
from django.db import models
from django.db.models import Sum, QuerySet
-from django.utils.translation import gettext_lazy as _
from compensation.managers import EcoAccountManager, EcoAccountDeductionManager
from compensation.models.compensation import AbstractCompensation, PikMixin
@@ -192,6 +191,19 @@ class EcoAccount(AbstractCompensation, ShareableObjectMixin, RecordableObjectMix
ret_val = 0
return ret_val
+ def get_lanis_layer_name(self):
+ """ Getter for specific LANIS/WFS object layer
+
+ Returns:
+
+ """
+ retval = None
+ if self.is_recorded:
+ retval = ECO_ACCOUNT_LANIS_LAYER_NAME_RECORDED
+ else:
+ retval = ECO_ACCOUNT_LANIS_LAYER_NAME_UNRECORDED
+
+ return retval
class EcoAccountDocument(AbstractDocument):
"""
diff --git a/compensation/settings.py b/compensation/settings.py
index 2ac54646..00a23578 100644
--- a/compensation/settings.py
+++ b/compensation/settings.py
@@ -7,6 +7,11 @@ Created on: 18.12.20
"""
COMPENSATION_IDENTIFIER_LENGTH = 6
COMPENSATION_IDENTIFIER_TEMPLATE = "KOM-{}"
+COMPENSATION_LANIS_LAYER_NAME_RECORDED = "kom_recorded"
+COMPENSATION_LANIS_LAYER_NAME_UNRECORDED = "kom_unrecorded"
+COMPENSATION_LANIS_LAYER_NAME_UNRECORDED_OLD_ENTRY = "kom_unrecorded_old_entries"
ECO_ACCOUNT_IDENTIFIER_LENGTH = 6
-ECO_ACCOUNT_IDENTIFIER_TEMPLATE = "OEK-{}"
\ No newline at end of file
+ECO_ACCOUNT_IDENTIFIER_TEMPLATE = "OEK-{}"
+ECO_ACCOUNT_LANIS_LAYER_NAME_RECORDED = "oek_recorded"
+ECO_ACCOUNT_LANIS_LAYER_NAME_UNRECORDED = "oek_unrecorded"
\ No newline at end of file
diff --git a/ema/models/ema.py b/ema/models/ema.py
index 5e380eef..d312c6a0 100644
--- a/ema/models/ema.py
+++ b/ema/models/ema.py
@@ -15,7 +15,8 @@ from django.urls import reverse
from compensation.models import AbstractCompensation, PikMixin
from ema.managers import EmaManager
-from ema.settings import EMA_IDENTIFIER_LENGTH, EMA_IDENTIFIER_TEMPLATE
+from ema.settings import EMA_IDENTIFIER_LENGTH, EMA_IDENTIFIER_TEMPLATE, EMA_LANIS_LAYER_NAME_RECORDED, \
+ EMA_LANIS_LAYER_NAME_UNRECORDED
from ema.utils.quality import EmaQualityChecker
from konova.models import AbstractDocument, generate_document_file_upload_path, RecordableObjectMixin, ShareableObjectMixin
from konova.utils.message_templates import DATA_UNSHARED_EXPLANATION, DOCUMENT_REMOVED_TEMPLATE
@@ -109,6 +110,20 @@ class Ema(AbstractCompensation, ShareableObjectMixin, RecordableObjectMixin, Pik
"""
return reverse("ema:share-token", args=(self.id, self.access_token))
+ def get_lanis_layer_name(self):
+ """ Getter for specific LANIS/WFS object layer
+
+ Returns:
+
+ """
+ retval = None
+ if self.is_recorded:
+ retval = EMA_LANIS_LAYER_NAME_RECORDED
+ else:
+ retval = EMA_LANIS_LAYER_NAME_UNRECORDED
+
+ return retval
+
class EmaDocument(AbstractDocument):
"""
diff --git a/ema/settings.py b/ema/settings.py
index a6a124c8..357f96dd 100644
--- a/ema/settings.py
+++ b/ema/settings.py
@@ -7,4 +7,6 @@ Created on: 19.08.21
"""
EMA_IDENTIFIER_LENGTH = 6
-EMA_IDENTIFIER_TEMPLATE = "EMA-{}"
\ No newline at end of file
+EMA_IDENTIFIER_TEMPLATE = "EMA-{}"
+EMA_LANIS_LAYER_NAME_RECORDED = "ema_recorded"
+EMA_LANIS_LAYER_NAME_UNRECORDED = "ema_unrecorded"
\ No newline at end of file
diff --git a/intervention/models/intervention.py b/intervention/models/intervention.py
index d54a1b9d..e6077694 100644
--- a/intervention/models/intervention.py
+++ b/intervention/models/intervention.py
@@ -14,7 +14,9 @@ from django.urls import reverse
from django.utils import timezone
from analysis.settings import LKOMPVZVO_PUBLISH_DATE
-from intervention.settings import INTERVENTION_IDENTIFIER_LENGTH, INTERVENTION_IDENTIFIER_TEMPLATE
+from intervention.settings import INTERVENTION_IDENTIFIER_LENGTH, INTERVENTION_IDENTIFIER_TEMPLATE, \
+ INTERVENTION_LANIS_LAYER_NAME_RECORDED, INTERVENTION_LANIS_LAYER_NAME_UNRECORDED_OLD_ENTRY, \
+ INTERVENTION_LANIS_LAYER_NAME_UNRECORDED
from intervention.tasks import celery_export_to_egon
from user.models import User
from django.db import models, transaction
@@ -383,6 +385,28 @@ class Intervention(BaseObject,
self.mark_as_edited(user, request=form.request, edit_comment=PAYMENT_REMOVED)
self.send_data_to_egon()
+ def get_lanis_layer_name(self):
+ """ Getter for specific LANIS/WFS object layer
+
+ Returns:
+
+ """
+ retval = None
+ if self.is_recorded:
+ retval = INTERVENTION_LANIS_LAYER_NAME_RECORDED
+ else:
+ try:
+ is_old_entry = self.legal.binding_date < LKOMPVZVO_PUBLISH_DATE
+ except TypeError:
+ is_old_entry = False
+
+ if is_old_entry:
+ retval = INTERVENTION_LANIS_LAYER_NAME_UNRECORDED_OLD_ENTRY
+ else:
+ retval = INTERVENTION_LANIS_LAYER_NAME_UNRECORDED
+
+ return retval
+
class InterventionDocument(AbstractDocument):
"""
diff --git a/intervention/settings.py b/intervention/settings.py
index a5c974d4..8d3d624b 100644
--- a/intervention/settings.py
+++ b/intervention/settings.py
@@ -8,6 +8,10 @@ Created on: 30.11.20
INTERVENTION_IDENTIFIER_LENGTH = 6
INTERVENTION_IDENTIFIER_TEMPLATE = "EIV-{}"
+INTERVENTION_LANIS_LAYER_NAME_RECORDED = "eiv_recorded"
+INTERVENTION_LANIS_LAYER_NAME_UNRECORDED = "eiv_unrecorded"
+INTERVENTION_LANIS_LAYER_NAME_UNRECORDED_OLD_ENTRY = "eiv_unrecorded_old_entries"
+
# EGON connection settings via rabbitmq
# NEEDED FOR BACKWARDS COMPATIBILITY
EGON_RABBITMQ_HOST = "CHANGE_ME"
diff --git a/konova/models/object.py b/konova/models/object.py
index 038b47f9..52732a8c 100644
--- a/konova/models/object.py
+++ b/konova/models/object.py
@@ -12,7 +12,7 @@ from abc import abstractmethod
from django.contrib import messages
from django.db.models import QuerySet
-from konova.sub_settings.lanis_settings import DEFAULT_SRID_RLP, LANIS_ZOOM_LUT, LANIS_LINK_TEMPLATE
+from konova.sub_settings.lanis_settings import LANIS_LINK_TEMPLATE, LANIS_LINK_DEFAULT
from konova.tasks import celery_send_mail_shared_access_removed, celery_send_mail_shared_access_given, \
celery_send_mail_shared_data_recorded, celery_send_mail_shared_data_unrecorded, \
celery_send_mail_shared_data_deleted, celery_send_mail_shared_data_checked, \
@@ -706,32 +706,27 @@ class GeoReferencedMixin(models.Model):
return request
def get_LANIS_link(self) -> str:
- """ Generates a link for LANIS depending on the geometry
+ """ Creates the link for 'LANIS' button on detail view of an entry.
Returns:
"""
try:
- geom = self.geometry.geom.transform(DEFAULT_SRID_RLP, clone=True)
- x = geom.centroid.x
- y = geom.centroid.y
- area = int(geom.envelope.area)
- z_l = 16
- for k_area, v_zoom in LANIS_ZOOM_LUT.items():
- if k_area < area:
- z_l = v_zoom
- break
- zoom_lvl = z_l
- except (AttributeError, IndexError) as e:
- # If no geometry has been added, yet.
- x = 1
- y = 1
- zoom_lvl = 6
- return LANIS_LINK_TEMPLATE.format(
- zoom_lvl,
- x,
- y,
- )
+ entry_has_geometry = not self.geometry.geom.empty
+ except AttributeError:
+ entry_has_geometry = False
+
+ if entry_has_geometry:
+ link = LANIS_LINK_TEMPLATE.format(
+ self.get_lanis_layer_name(),
+ self.identifier
+ )
+ else:
+ link = LANIS_LINK_DEFAULT
+ return link
+
+ def get_lanis_layer_name(self):
+ raise NotImplementedError("Must be implemented in subclasses!")
class ResubmitableObjectMixin(models.Model):
diff --git a/konova/sub_settings/lanis_settings.py b/konova/sub_settings/lanis_settings.py
index 58a28568..72082931 100644
--- a/konova/sub_settings/lanis_settings.py
+++ b/konova/sub_settings/lanis_settings.py
@@ -15,7 +15,8 @@ DEFAULT_SRID_RLP = 25832
# Needed to redirect to LANIS
## Values to be inserted are [zoom_level, x_coord, y_coord]
-LANIS_LINK_TEMPLATE = "https://geodaten.naturschutz.rlp.de/kartendienste_naturschutz/index.php?lang=de&zl={}&x={}&y={}&bl=tk_rlp_tms_grau&bo=1&lo=0.8,0.8,0.8,0.6,0.8,0.8,0.8,0.8,0.8&layers=eiv_recorded,eiv_unrecorded,eiv_unrecorded_old_entries,kom_recorded,kom_unrecorded,kom_unrecorded_old_entries,oek_recorded,oek_unrecorded,ema_recorded,ema_unrecorded,mae&service=kartendienste_naturschutz"
+LANIS_LINK_DEFAULT = "https://geodaten.naturschutz.rlp.de/kartendienste_naturschutz/index.php?lang=de&zl=7&x=378800&y=5535500&bl=tk_rlp_tms_grau&bo=1&lo=1,0.7,0.7,0.5,0.7,0.7,0.5,0.7,0.7,0.8,0.7,0.7&layers=grenzen_land,eiv_recorded,eiv_unrecorded,eiv_unrecorded_old_entries,kom_recorded,kom_unrecorded,kom_unrecorded_old_entries,ema_recorded,ema_unrecorded,mae,oek_recorded,oek_unrecorded&service=kartendienste_naturschutz"
+LANIS_LINK_TEMPLATE = "https://geodaten.naturschutz.rlp.de/kartendienste_naturschutz/mapinterface.php?qlayer={}&qfield=identifier&qidtyp=text&qid={}&client=&layers=eiv_recorded,eiv_unrecorded,eiv_unrecorded_old_entries,kom_recorded,kom_unrecorded,kom_unrecorded_old_entries,oek_recorded,oek_unrecorded,ema_recorded,ema_unrecorded,mae&zoomobject=true"
## This look up table (LUT) defines different zoom levels on the size of the calculate area of a geometry.
LANIS_ZOOM_LUT = {
1000000000: 6,
diff --git a/templates/map/client/config.json b/templates/map/client/config.json
index 5b8bf6cf..b55279e4 100644
--- a/templates/map/client/config.json
+++ b/templates/map/client/config.json
@@ -45,7 +45,6 @@
{ "folder": 13, "type": "WMS", "title": "farbig", "attribution": "LVermGeo", "url": "https://geo4.service24.rlp.de/wms/dtk5_rp.fcgi?", "name": "rp_dtk5", "active": false },
{ "folder": 13, "type": "WMS", "title": "grau", "attribution": "LVermGeo", "url": "https://geo4.service24.rlp.de/wms/dtk5_rp.fcgi?", "name": "rp_dtk5_grau", "active": false }
],
-
"folders":
[
{ "title": "Hintergrund", "parent": -1 },
@@ -65,7 +64,6 @@
{ "title": "BaseMap", "parent": 0 },
{ "title": "Webatlas", "parent": 0 }
],
-
"projections":
[
[ "EPSG:25832", "+proj=utm +zone=32 +ellps=GRS80 +units=m +no_defs" ]
@@ -78,7 +76,8 @@
"minZoom": 5,
"maxZoom": 22,
"zoom": 9,
- "attribution": "LANIS RLP"
+ "attribution": "LANIS RLP",
+ "scalebar": true
},
"output":
@@ -94,9 +93,23 @@
"searchParcel":
{
"nameURL": "/client/proxy?https://geodaten.naturschutz.rlp.de/kartendienste_naturschutz/mod_alkis/gem_search.php?placename={q}",
- "parcelURL": "/client/proxy?https://geodaten.naturschutz.rlp.de/kartendienste_naturschutz/mod_alkis/flur_search.php?gmk_gmn={district}&fln={field}&fsn_zae={parcelA}&fsn_nen={parcelB}&export=json"
+ "parcelURL": "/client/proxy?https://geodaten.naturschutz.rlp.de/kartendienste_naturschutz/mod_alkis/flur_search.php?gmk_gmn={district}&fln={field}&fsn_zae={parcelA}&fsn_nen={parcelB}&export=json",
+ "districts_service":
+ {
+ "type": "WFS",
+ "url": "http://geo5.service24.rlp.de/wfs/verwaltungsgrenzen_rp.fcgi?",
+ "name": "vermkv:gemarkungen_rlp",
+ "order": 10,
+ "minZoom": 11,
+ "maxZoom": 17
+ },
+ "fields_service":
+ {
+ "url": "http://geo5.service24.rlp.de/wfs/verwaltungsgrenzen_rp.fcgi?",
+ "name": "vermkv:fluren_rlp",
+ "filter_property": "gmkgnr"
+ }
},
-
"import":
{
"geopackageLibURL": "/libs/geopackage/4.2.3/"
@@ -108,7 +121,6 @@
"defaultFilename": "Export",
"defaultMargin": 10
},
-
"tools":
{
"buffer":
@@ -117,7 +129,6 @@
"defaultSegments": 2
}
},
-
"styles":
{
"editLayer":
@@ -127,7 +138,6 @@
"strokeWidth": 3,
"pointRadius": 6
},
-
"select":
{
"fill": "rgba( 0, 127, 255, 0.5 )",
@@ -135,7 +145,6 @@
"strokeWidth": 3,
"pointRadius": 6
},
-
"sketch":
{
"fill": "rgba( 0, 127, 255, 0.2 )",
@@ -143,7 +152,6 @@
"strokeWidth": 3,
"pointRadius": 6
},
-
"modify":
{
"fill": "rgba( 0, 127, 255, 0.5 )",
@@ -151,12 +159,17 @@
"strokeWidth": 3,
"pointRadius": 6
},
-
"parcel":
{
"fill": "rgba( 127, 255, 255, 0.5 )",
"stroke": "#7fffff",
"strokeWidth": 3
+ },
+ "import":
+ {
+ "fill": "rgba( 0, 127, 255, 0.2 )",
+ "stroke": "rgba( 0, 127, 255, 1.0 )",
+ "width": 1.5
}
}
}
\ No newline at end of file
diff --git a/templates/map/client/index.html b/templates/map/client/index.html
index 9d77addc..b45b77db 100644
--- a/templates/map/client/index.html
+++ b/templates/map/client/index.html
@@ -1,59 +1,34 @@
{% load static %}
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+