summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ishtar_common/data_importer.py7
-rw-r--r--ishtar_common/models_common.py3
-rw-r--r--ishtar_common/models_imports.py5
3 files changed, 6 insertions, 9 deletions
diff --git a/ishtar_common/data_importer.py b/ishtar_common/data_importer.py
index 0616e2a10..5090fb15b 100644
--- a/ishtar_common/data_importer.py
+++ b/ishtar_common/data_importer.py
@@ -518,7 +518,7 @@ class StrChoiceFormater(Formater, ChoiceChecker):
for value in values:
new_values += r.split(value)
values = new_values
- for value in values:
+ for value in set(values):
base_value = copy.copy(value)
value = self.prepare(value)
if value in self.equiv_dict:
@@ -1376,12 +1376,11 @@ class Importer(object):
geodata = {}
if self.TYPE == "gis":
if "geodata" in data:
- geodata = data.pop("geodata")
+ geodata = self._defaults.get(("geodata",), {})
+ geodata.update(data.pop("geodata"))
obj, created = self.get_object(self.OBJECT_CLS, data, idx_line=idx_line)
if self.simulate:
return data
- # print(data)
- # print(self._defaults)
if self.import_instance:
self.import_instance.add_imported_line(self.idx_line)
diff --git a/ishtar_common/models_common.py b/ishtar_common/models_common.py
index 12a5db0df..35dd4aef1 100644
--- a/ishtar_common/models_common.py
+++ b/ishtar_common/models_common.py
@@ -2276,9 +2276,6 @@ class GeoVectorData(Imported, OwnPerms):
if not srid or srid != geom.srid:
point = geom.transform(srid, clone=True)
x, y = point.x, point.y
- # Coordinates are reversed - should be fixed on Django 3.2
- if srid in (4326, 4979):
- x, y = y, x
else:
x, y = point.x, point.y
if dim == 2:
diff --git a/ishtar_common/models_imports.py b/ishtar_common/models_imports.py
index aab404b63..6f6d7109e 100644
--- a/ishtar_common/models_imports.py
+++ b/ishtar_common/models_imports.py
@@ -1091,7 +1091,6 @@ RE_COORDS = r"(" + RE_NUMBER + r") (" + RE_NUMBER + r")"
def _reverse_coordinates(wkt):
- # TODO: à effacer
return re.sub(RE_COORDS, r"\2 \1", wkt)
@@ -1110,7 +1109,9 @@ def convert_geom(feature, srid):
if profile.srs and profile.srs.srid:
srs = profile.srs.srid
if srs != srid:
- feature = GEOSGeometry(feature).transform(srs, clone=True).ewkt
+ # Coordinates are reversed - should be fixed on Django 3.2
+ feature = _reverse_coordinates(
+ GEOSGeometry(feature).transform(srs, clone=True).ewkt)
return feature