# 349 LANIS link improvements #350
@ -9,8 +9,10 @@ import shutil
|
|||||||
|
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
|
|
||||||
|
from analysis.settings import LKOMPVZVO_PUBLISH_DATE
|
||||||
from codelist.models import KonovaCode
|
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 user.models import User, Team
|
||||||
from django.db import models, transaction
|
from django.db import models, transaction
|
||||||
from django.db.models import QuerySet, Sum
|
from django.db.models import QuerySet, Sum
|
||||||
@ -478,6 +480,24 @@ class Compensation(AbstractCompensation, CEFMixin, CoherenceMixin, PikMixin):
|
|||||||
"""
|
"""
|
||||||
return self.intervention.is_recorded
|
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:
|
||||||
|
is_old_entry = self.intervention.legal.binding_date < LKOMPVZVO_PUBLISH_DATE
|
||||||
|
if is_old_entry:
|
||||||
|
retval = COMPENSATION_LANIS_LAYER_NAME_UNRECORDED_OLD_ENTRY
|
||||||
|
else:
|
||||||
|
retval = COMPENSATION_LANIS_LAYER_NAME_UNRECORDED
|
||||||
|
|
||||||
|
return retval
|
||||||
|
|
||||||
|
|
||||||
class CompensationDocument(AbstractDocument):
|
class CompensationDocument(AbstractDocument):
|
||||||
"""
|
"""
|
||||||
|
@ -9,13 +9,12 @@ import shutil
|
|||||||
|
|
||||||
from django.urls import reverse
|
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 konova.utils.message_templates import DEDUCTION_REMOVED, DOCUMENT_REMOVED_TEMPLATE
|
||||||
from django.core.exceptions import ValidationError
|
|
||||||
from django.core.validators import MinValueValidator
|
from django.core.validators import MinValueValidator
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.db.models import Sum, QuerySet
|
from django.db.models import Sum, QuerySet
|
||||||
from django.utils.translation import gettext_lazy as _
|
|
||||||
|
|
||||||
from compensation.managers import EcoAccountManager, EcoAccountDeductionManager
|
from compensation.managers import EcoAccountManager, EcoAccountDeductionManager
|
||||||
from compensation.models.compensation import AbstractCompensation, PikMixin
|
from compensation.models.compensation import AbstractCompensation, PikMixin
|
||||||
@ -192,6 +191,19 @@ class EcoAccount(AbstractCompensation, ShareableObjectMixin, RecordableObjectMix
|
|||||||
ret_val = 0
|
ret_val = 0
|
||||||
return ret_val
|
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):
|
class EcoAccountDocument(AbstractDocument):
|
||||||
"""
|
"""
|
||||||
|
@ -7,6 +7,11 @@ Created on: 18.12.20
|
|||||||
"""
|
"""
|
||||||
COMPENSATION_IDENTIFIER_LENGTH = 6
|
COMPENSATION_IDENTIFIER_LENGTH = 6
|
||||||
COMPENSATION_IDENTIFIER_TEMPLATE = "KOM-{}"
|
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_LENGTH = 6
|
||||||
ECO_ACCOUNT_IDENTIFIER_TEMPLATE = "OEK-{}"
|
ECO_ACCOUNT_IDENTIFIER_TEMPLATE = "OEK-{}"
|
||||||
|
ECO_ACCOUNT_LANIS_LAYER_NAME_RECORDED = "oek_recorded"
|
||||||
|
ECO_ACCOUNT_LANIS_LAYER_NAME_UNRECORDED = "oek_unrecorded"
|
@ -15,7 +15,8 @@ from django.urls import reverse
|
|||||||
|
|
||||||
from compensation.models import AbstractCompensation, PikMixin
|
from compensation.models import AbstractCompensation, PikMixin
|
||||||
from ema.managers import EmaManager
|
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 ema.utils.quality import EmaQualityChecker
|
||||||
from konova.models import AbstractDocument, generate_document_file_upload_path, RecordableObjectMixin, ShareableObjectMixin
|
from konova.models import AbstractDocument, generate_document_file_upload_path, RecordableObjectMixin, ShareableObjectMixin
|
||||||
from konova.utils.message_templates import DATA_UNSHARED_EXPLANATION, DOCUMENT_REMOVED_TEMPLATE
|
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))
|
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):
|
class EmaDocument(AbstractDocument):
|
||||||
"""
|
"""
|
||||||
|
@ -7,4 +7,6 @@ Created on: 19.08.21
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
EMA_IDENTIFIER_LENGTH = 6
|
EMA_IDENTIFIER_LENGTH = 6
|
||||||
EMA_IDENTIFIER_TEMPLATE = "EMA-{}"
|
EMA_IDENTIFIER_TEMPLATE = "EMA-{}"
|
||||||
|
EMA_LANIS_LAYER_NAME_RECORDED = "ema_recorded"
|
||||||
|
EMA_LANIS_LAYER_NAME_UNRECORDED = "ema_unrecorded"
|
@ -14,7 +14,9 @@ from django.urls import reverse
|
|||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
|
|
||||||
from analysis.settings import LKOMPVZVO_PUBLISH_DATE
|
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 intervention.tasks import celery_export_to_egon
|
||||||
from user.models import User
|
from user.models import User
|
||||||
from django.db import models, transaction
|
from django.db import models, transaction
|
||||||
@ -383,6 +385,27 @@ class Intervention(BaseObject,
|
|||||||
self.mark_as_edited(user, request=form.request, edit_comment=PAYMENT_REMOVED)
|
self.mark_as_edited(user, request=form.request, edit_comment=PAYMENT_REMOVED)
|
||||||
self.send_data_to_egon()
|
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 = True
|
||||||
|
if is_old_entry:
|
||||||
|
retval = INTERVENTION_LANIS_LAYER_NAME_UNRECORDED_OLD_ENTRY
|
||||||
|
else:
|
||||||
|
retval = INTERVENTION_LANIS_LAYER_NAME_UNRECORDED
|
||||||
|
|
||||||
|
return retval
|
||||||
|
|
||||||
|
|
||||||
class InterventionDocument(AbstractDocument):
|
class InterventionDocument(AbstractDocument):
|
||||||
"""
|
"""
|
||||||
|
@ -8,6 +8,10 @@ Created on: 30.11.20
|
|||||||
INTERVENTION_IDENTIFIER_LENGTH = 6
|
INTERVENTION_IDENTIFIER_LENGTH = 6
|
||||||
INTERVENTION_IDENTIFIER_TEMPLATE = "EIV-{}"
|
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
|
# EGON connection settings via rabbitmq
|
||||||
# NEEDED FOR BACKWARDS COMPATIBILITY
|
# NEEDED FOR BACKWARDS COMPATIBILITY
|
||||||
EGON_RABBITMQ_HOST = "CHANGE_ME"
|
EGON_RABBITMQ_HOST = "CHANGE_ME"
|
||||||
|
@ -12,7 +12,7 @@ from abc import abstractmethod
|
|||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
from django.db.models import QuerySet
|
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, \
|
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_recorded, celery_send_mail_shared_data_unrecorded, \
|
||||||
celery_send_mail_shared_data_deleted, celery_send_mail_shared_data_checked, \
|
celery_send_mail_shared_data_deleted, celery_send_mail_shared_data_checked, \
|
||||||
@ -706,32 +706,23 @@ class GeoReferencedMixin(models.Model):
|
|||||||
return request
|
return request
|
||||||
|
|
||||||
def get_LANIS_link(self) -> str:
|
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:
|
Returns:
|
||||||
|
|
||||||
"""
|
"""
|
||||||
try:
|
entry_has_geometry = not self.geometry.geom.empty
|
||||||
geom = self.geometry.geom.transform(DEFAULT_SRID_RLP, clone=True)
|
if entry_has_geometry:
|
||||||
x = geom.centroid.x
|
link = LANIS_LINK_TEMPLATE.format(
|
||||||
y = geom.centroid.y
|
self.get_lanis_layer_name(),
|
||||||
area = int(geom.envelope.area)
|
self.identifier
|
||||||
z_l = 16
|
)
|
||||||
for k_area, v_zoom in LANIS_ZOOM_LUT.items():
|
else:
|
||||||
if k_area < area:
|
link = LANIS_LINK_DEFAULT
|
||||||
z_l = v_zoom
|
return link
|
||||||
break
|
|
||||||
zoom_lvl = z_l
|
def get_lanis_layer_name(self):
|
||||||
except (AttributeError, IndexError) as e:
|
raise NotImplementedError("Must be implemented in subclasses!")
|
||||||
# If no geometry has been added, yet.
|
|
||||||
x = 1
|
|
||||||
y = 1
|
|
||||||
zoom_lvl = 6
|
|
||||||
return LANIS_LINK_TEMPLATE.format(
|
|
||||||
zoom_lvl,
|
|
||||||
x,
|
|
||||||
y,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class ResubmitableObjectMixin(models.Model):
|
class ResubmitableObjectMixin(models.Model):
|
||||||
|
@ -15,7 +15,8 @@ DEFAULT_SRID_RLP = 25832
|
|||||||
|
|
||||||
# Needed to redirect to LANIS
|
# Needed to redirect to LANIS
|
||||||
## Values to be inserted are [zoom_level, x_coord, y_coord]
|
## 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.
|
## This look up table (LUT) defines different zoom levels on the size of the calculate area of a geometry.
|
||||||
LANIS_ZOOM_LUT = {
|
LANIS_ZOOM_LUT = {
|
||||||
1000000000: 6,
|
1000000000: 6,
|
||||||
|
Loading…
Reference in New Issue
Block a user