diff options
| -rw-r--r-- | CHANGES.md | 7 | ||||
| -rw-r--r-- | ishtar_common/models_common.py | 15 | ||||
| -rw-r--r-- | ishtar_common/static/js/ishtar-map.js | 2 | ||||
| -rw-r--r-- | ishtar_common/templates/ishtar/blocks/sheet_coordinates.html | 31 | 
4 files changed, 33 insertions, 22 deletions
diff --git a/CHANGES.md b/CHANGES.md index 7ffe411d4..5f17fcd8f 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -6,6 +6,13 @@ date: 2022-11-04  Ishtar changelog  ================ +v4.0.5 - 2022- +-------------------- + +### Bug fix ### + +- Geo - sheet: fix coordinates display +  v4.0.4 - 2022-07-17  -------------------- diff --git a/ishtar_common/models_common.py b/ishtar_common/models_common.py index 66025948a..cea327e13 100644 --- a/ishtar_common/models_common.py +++ b/ishtar_common/models_common.py @@ -2234,19 +2234,22 @@ class GeoVectorData(Imported, OwnPerms):      def source_label(self):          return str(self.source) -    def display_coordinates(self, rounded=5, dim=2, srid=4326, cache=True): +    def display_coordinates(self, rounded=5, dim=2, srid=None, cache=True):          if not srid: -            profile = get_current_profile() -            if profile.display_srs and profile.display_srs.srid: -                srid = profile.display_srs.srid +            if self.spatial_reference_system and self.spatial_reference_system.srid: +                srid = self.spatial_reference_system.srid              else: -                srid = 4326 +                profile = get_current_profile() +                if profile.display_srs and profile.display_srs.srid: +                    srid = profile.display_srs.srid +        if not srid: +            srid = 4326          return self.get_coordinates(rounded=rounded, srid=srid, dim=dim, cache=cache)      def get_coordinates(self, rounded=5, srid: int = None, dim=2, cache=False):          if dim not in (2, 3):              raise ValueError(_("Only 2 or 3 dimensions")) -        if cache: +        if cache and srid == 4326:              coordinates = [self.cached_x, self.cached_y]              if dim == 3:                  coordinates.append(self.cached_z) diff --git a/ishtar_common/static/js/ishtar-map.js b/ishtar_common/static/js/ishtar-map.js index 8a5ee6071..a3f275720 100644 --- a/ishtar_common/static/js/ishtar-map.js +++ b/ishtar_common/static/js/ishtar-map.js @@ -230,7 +230,7 @@ var get_layers = function(layers){          layers = [          	{          		'type': 'ign', -        		'options': {'title': "IGN (France)", 'visible': false, "type": 'base'} +        		'options': {'title': "IGN aérien (France)", 'visible': false, "type": 'base'}          	},          	{          		'type': 'osm', diff --git a/ishtar_common/templates/ishtar/blocks/sheet_coordinates.html b/ishtar_common/templates/ishtar/blocks/sheet_coordinates.html index dbcecef8c..0093ed31f 100644 --- a/ishtar_common/templates/ishtar/blocks/sheet_coordinates.html +++ b/ishtar_common/templates/ishtar/blocks/sheet_coordinates.html @@ -1,27 +1,28 @@ -{% load i18n window_field %}{% if PROFILE.mapping %} -{% if geo_item.x or geo_item.y or geo_item.z %} +{% load i18n window_field %}{% if PROFILE.mapping and geo_item.main_geodata %} +{% with geodata=geo_item.main_geodata %} +{% if geodata.cached_x or geodata.cached_z %}  <dl class="col-12">      <dt>{% trans "Coordinates" %}</dt>      <dd> -        {% with coordinates=geo_item.display_coordinates %} +        {% with coordinates=geodata.display_coordinates %}          {% trans "X:"%} {{coordinates.0|default_if_none:"-"}} -        {% if geo_item.estimated_error_x %} ({% trans "error:" %} {{geo_item.estimated_error_x}}){% endif %}, +        {% if geodata.estimated_error_x %} ({% trans "error:" %} {{geodata.estimated_error_x}}){% endif %},          {% trans "Y:"%} {{coordinates.1|default_if_none:"-"}} -        {% if geo_item.estimated_error_y %} ({% trans "error:" %} {{geo_item.estimated_error_y}}){% endif %}, +        {% if geodata.estimated_error_y %} ({% trans "error:" %} {{geodata.estimated_error_y}}){% endif %},          {% endwith %} -        {% trans "Z:"%} {{geo_item.z|default_if_none:"-"}} -        {% if geo_item.estimated_error_z %} ({% trans "error:" %} {{geo_item.estimated_error_z}}){% endif %} -        {% with srs=geo_item.display_spatial_reference_system %} +        {% trans "Z:"%} {{geodata.z|default_if_none:"-"}} +        {% if geodata.estimated_error_z %} ({% trans "error:" %} {{geodata.estimated_error_z}}){% endif %} +        {% with srs=geodata.display_spatial_reference_system %}          {% if srs %} – {{srs.label}} - {% trans "SRID"%} {{srs.srid}} {% endif %}          {% endwith %}      </dd>  </dl> -{% if geo_item.most_precise_geo == 'point' %} -{% trans "Point source" as point_source %} -{% field_flex_full point_source geo_item.geo_point_source %} -{% else %} -{% trans "Polygon source" as polygon_source %} -{% field_flex_full polygon_source geo_item.geo_polygon_source %} -{% endif %} +{% field_flex_full "Data type" geodata.data_type %} +{% field_flex_full "Source" geodata.source_label %} +{% field_flex_full "Name" geodata.name %} +{% field_flex_full "Origin" geodata.origin %} +{% field_flex_full "Provider" geodata.provider %} +{% field_flex_full "Comment" geodata.comment %}  {% endif %} +{% endwith %}  {% endif %}  | 
