GeotrekCE / Geotrek-admin

Paths management for National Parks and Tourism organizations
https://geotrek.fr
BSD 2-Clause "Simplified" License
129 stars 76 forks source link

Décalage dans l'affichage des statuts #3951

Open jeromesourdin opened 4 months ago

jeromesourdin commented 4 months ago

Bonjour,

Par défaut, il y a un décalage dans l'affichage entre les statuts et les tronçons :

image

De mémoire, il y avait un paramétrage pour régler ce décalage, mais je ne retrouve plus l'information.

Quelqu'un peut il me dire si c'est toujours possible, et ou cela se situe ?

Merci d'avance

babastienne commented 4 months ago

Bonjour, il s'agit du paramètre TOPOLOGY_STATIC_OFFSETS tel que décrit dans le ticket #3213 il me semble.

jeromesourdin commented 4 months ago

C'est bien cela, mais c'est sans effet :(

camillemonchicourt commented 4 months ago

Oui et comme indiqué dans le ticket sur le sujet, le décalage devrait être uniquement à l'affichage, pas stocker les données décalées car c'est un gros soucis car on produit de la donnée fausse... :-(

jeromesourdin commented 4 months ago

Oui, j'avais bien ça en tête, mais quand j'ajoute la conf dans le custom.py, il ne se passe rien a l'affichage (Je voudrais supprimer le décalage).

babastienne commented 4 months ago

@jeromesourdin peux-tu copier ici le contenu du fichier custom.py qu'on regarde si le champ est correctement formaté ? Normalement ça devrait fonctionner il me semble

jeromesourdin commented 4 months ago
# coding: utf8

# from .prod import *

# My custom value
HIDDEN_OPTION = 3.14

#DEBUG = True
#DEBUG_TOOLBAR = True

ALLOW_PATH_DELETION_TOPOLOGY = True

SESSION_COOKIE_SECURE = True
CSRF_COOKIE_SECURE = True

LEAFLET_CONFIG['TILES'] = [
    (
        'IGN Plan V2',
        '//data.geopf.fr/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2&STYLE=normal&FORMAT=image/png&TILEMATRIXSET=PM&TILEMATRIX={>
        {
            'attribution': 'Plan IGNV2 - Carte © IGN/Geoportail',
            'maxNativeZoom': 18,
            'maxZoom': 25
        }
    ),
    (
        'IGN Orthophotos',
        '//data.geopf.fr/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=ORTHOIMAGERY.ORTHOPHOTOS&STYLE=normal&FORMAT=image/jpeg&TILEMATRIXSET=PM&TILEMATRIX={z}&TILER>
        {
            'attribution': 'Orthophotos - Carte © IGN/Geoportail',
            'maxNativeZoom': 19,
            'maxZoom': 25
        }
    ),
    (
        'IGN Scan25',
        '//data.geopf.fr/private/wmts?apikey=ign_scan_ws&LAYER=GEOGRAPHICALGRIDSYSTEMS.MAPS.SCAN25TOUR&EXCEPTIONS=text/xml&FORMAT=image/jpeg&SERVICE=WMTS&VERSION=1.0.0&REQU>
        {
            'attribution': 'Cadastre - Carte © IGN/Geoportail',
            'maxNativeZoom': 18,
            'maxZoom': 25
#            'opacity': 0.5
        }
    ),
    #('IGN Plan', '//wxs.ign.fr/essentiels/geoportail/wmts?LAYER=GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2&EXCEPTIONS=image/png&FORMAT=image/png&SERVICE=WMTS&VERSION=1.0.0&REQUEST=>
    #('IGN Scan', '//wxs.ign.fr/nfj93pmjggc6dg0bk2fksdyx/geoportail/wmts?LAYER=GEOGRAPHICALGRIDSYSTEMS.MAPS&EXCEPTIONS=image/jpeg&FORMAT=image/jpeg&SERVICE=WMTS&VERSION=1.0>
    #('IGN Ortho', '//wxs.ign.fr/ortho/geoportail/wmts?LAYER=HR.ORTHOIMAGERY.ORTHOPHOTOS&EXCEPTIONS=image/jpeg&FORMAT=image/jpeg&SERVICE=WMTS&VERSION=1.0.0&REQUEST=GetTile&>
    ('OSM', 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {'attribution': '© OpenStreetMap', 'maxNativeZoom': 18, 'maxZoom': 25}),
    ('OpenTopoMap', 'https://a.tile.opentopomap.org/{z}/{x}/{y}.png', {'attribution': '© OpenStreetMap', 'maxNativeZoom': 16, 'maxZoom': 25}),
]
LEAFLET_CONFIG['OVERLAYS'] = [
#    ('IGN Cadastre', 'https://wxs.ign.fr/essentiels/geoportail/wmts?LAYER=CADASTRALPARCELS.PARCELS&EXCEPTIONS=text/xml&FORMAT=image/png&SERVICE=WMTS&VERSION=1.0.0&REQUEST=>
    ('Cadastre', '//wxs.ign.fr/essentiels/geoportail/wmts?layer=CADASTRALPARCELS.PARCELLAIRE_EXPRESS&style=PCI vecteur&tilematrixset=PM&Service=WMTS&Request=GetTile&Version>
    ('Forêts', '//wxs.ign.fr/environnement/geoportail/wmts?layer=FORETS.PUBLIQUES&style=FORETS PUBLIQUES ONF&tilematrixset=PM&Service=WMTS&Request=GetTile&Version=1.0.0&For>
    ]

LEAFLET_CONFIG['MAX_ZOOM'] = 25

TOPOLOGY_STATIC_OFFSETS = {'land': 0, 'physical': 0, 'competence': 0, 'signagemanagement': 0, 'workmanagement': 0}
#TOPOLOGY_STATIC_OFFSETS = {'land': 7, 'physical': -10, 'competence': 7, 'signagemanagement': -14, 'workmanagement': 14}
MAPENTITY_CONFIG['MAP_BACKGROUND_FOGGED'] = False

SHOW_LABELS = False

# Disable infrastructure and maintenance
#_INSTALLED_APPS = list(INSTALLED_APPS)
#_INSTALLED_APPS.remove('geotrek.infrastructure')
#_INSTALLED_APPS.remove('geotrek.maintenance')
#INSTALLED_APPS = _INSTALLED_APPS

# TRAIL_MODEL_ENABLED = False
# TOURISM_ENABLED = False
# TREKKING_TOPOLOGY_ENABLED = True
# FLATPAGES_ENABLED = True

#LAND_BBOX_CITIES_ENABLED = False
#LAND_BBOX_DISTRICTS_ENABLED = False
#LAND_BBOX_AREAS_ENABLED = True

# Enable sensitivity module
INSTALLED_APPS += ('geotrek.sensitivity', )
# Enable API v2 documentation
INSTALLED_APPS += ('drf_yasg', )
API_IS_PUBLIC = True

# Default radius of sensitivity bubbles when not specified for species
SENSITIVITY_DEFAULT_RADIUS = 100  # meters
SPATIAL_EXTENT = 206000, 6780000, 337000, 6880000

# Buffer around treks to intersects sensitive areas
SENSITIVE_AREA_INTERSECTION_MARGIN = 500  # meters

MAPENTITY_CONFIG['MAP_STYLES']['path']['opacity'] = 0.8
MAPENTITY_CONFIG['MAP_STYLES']['path'] = {'color': 'purple', 'weight': 5}
MAPENTITY_CONFIG['MAP_STYLES']['city'] = {'weight': 4, 'color': 'REBECCAPURPLE', 'opacity': 0.8, 'fillOpacity': 0.0}
#    'district': {'weight': 6, 'color': 'orange', 'opacity': 0.3, 'fillOpacity': 0.0, 'dashArray': '12, 12'}
MAPENTITY_CONFIG['MAP_STYLES']['print']['trek'] = {'color': '#ff0000', 'weight': 7, 'opacity': 0.8, 'arrowColor': 'black', 'arrowSize': 10}
MAPENTITY_CONFIG['MAP_STYLES']['print']['path'] = {'color': '#ff0000', 'weight': 7, 'opacity': 0.8}

#COLORS_POOL['restrictedarea'] = ['#ff00ff', 'red', '#ddddd']

ALTIMETRIC_PROFILE_MIN_YSCALE = 300  # Minimum y scale (in meters)

# Email address that error messages come from.
SERVER_EMAIL = 'geotrek@cotesdarmor.fr'

# The email backend to use. For possible shortcuts see django.core.mail.
# The default is to use the SMTP backend.
# Third-party backends can be specified by providing a Python path
# to a module that defines an EmailBackend class.
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'

# Host for sending email.
EMAIL_HOST = '192.168.4.26'

# Port for sending email.
EMAIL_PORT = 25

# Whether to send SMTP 'Date' header in the local time zone or in UTC.
EMAIL_USE_LOCALTIME = False

# Optional SMTP authentication information for EMAIL_HOST.
EMAIL_HOST_USER = ''
EMAIL_HOST_PASSWORD = ''
EMAIL_USE_TLS = False
EMAIL_USE_SSL = False
EMAIL_SSL_CERTFILE = None
EMAIL_SSL_KEYFILE = None
EMAIL_TIMEOUT = None

# People who get code error notifications.
# In the format [('Full Name', 'email@example.com'), ('Full Name', 'anotheremail@example.com')]
ADMINS = [('Jérôme SOURDIN', 'jerome.sourdin@cotesdarmor.fr')]

# Not-necessarily-technical managers of the site. They get broken link
# notifications and other various emails.
MANAGERS = ADMINS

COLUMNS_LISTS['trek_view'] = ['structure', 'practice', 'length_2d']
COLUMNS_LISTS["service_view"] = ["type"]

Voilà mon custom.py

babastienne commented 4 months ago

Hum, à première vue je ne vois rien qui parait expliquer le malfonctionnement, la configuration me semble ok. Il faudrait que je fasse un test en local pour me rendre compte si je reproduit le problème ou pas.

camillemonchicourt commented 4 months ago

Ça me dit quelque chose qu'Amandine avait identifié que le paramètre de décalage ne fonctionnait pas.

submarcos commented 4 months ago

les données sont stockées avec le decallage définit à l'enregistrement. Une fois le settings changé, peu importe qu'on le modifie, c'est trop tard, la donnée est fausse. Il faut modifier les données en BDD en meme temps que le setting. De plus, pour que le setting soit effectif, il faut reconfigurer geotrek-admin (migrations executées) pour qu'il soit répercuté dans les triggers SQL

jeromesourdin commented 4 months ago

Ha ! C'est pas cool ça ! Je pensais que c'était juste de l'affichage ! Il faut donc je supprime tout et réimporte ! Perso, je trouve ça problématique de stocker des données fausses en base...

camillemonchicourt commented 4 months ago

C'est ce que j'ai indiqué plusieurs fois dans ce ticket et un autre sur le sujet. Le décalage est malheureusement stocké et pas uniquement affiché. C'est une grosse erreur d'incompréhension lors du développement initial de Geotrek et pas du tout souhaitable d'avoir une donnée décalée... L'idéal serait de revoir ce fonctionnement car c'est pas une bonne chose.

submarcos commented 4 months ago

Tout à fait. par contre çà doit être bien reflechi, car le decallage à l'affichage peut introduire une baisse signficative des perfs.

Pour corriger çà, il faudrait: