summaryrefslogtreecommitdiff
path: root/ishtar_common/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'ishtar_common/models.py')
-rw-r--r--ishtar_common/models.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/ishtar_common/models.py b/ishtar_common/models.py
index c246380d5..a17bcac03 100644
--- a/ishtar_common/models.py
+++ b/ishtar_common/models.py
@@ -1765,6 +1765,23 @@ class GeoItem(models.Model):
def get_town_polygons(self):
raise NotImplementedError
+ @property
+ def display_coordinates(self):
+ if not self.point_2d:
+ return ""
+ profile = get_current_profile()
+ if not profile.display_srs or not profile.display_srs.srid:
+ return self.x, self.y
+ point = self.point_2d.transform(profile.display_srs.srid, clone=True)
+ return round(point.x, 5), round(point.y, 5)
+
+ @property
+ def display_spatial_reference_system(self):
+ profile = get_current_profile()
+ if not profile.display_srs or not profile.display_srs.srid:
+ return self.spatial_reference_system
+ return profile.display_srs
+
def get_precise_points(self):
if self.point_source == 'P' and self.point_2d:
return self.point_2d, self.point, self.point_source_item
@@ -2526,6 +2543,13 @@ class IshtarSiteProfile(models.Model, Cached):
default='SRID=4326;POINT(2.4397 46.5528)')
default_zoom = models.IntegerField(
_("Maps - default zoom"), default=6)
+ display_srs = models.ForeignKey(
+ SpatialReferenceSystem,
+ verbose_name=_("Spatial Reference System for display"),
+ blank=True, null=True,
+ help_text=_("Spatial Reference System used for display when no SRS is "
+ "defined")
+ )
class Meta:
verbose_name = _("Ishtar site profile")