diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-10-28 17:39:46 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-10-28 17:39:46 +0200 |
commit | 4dbceff7ef3c52cdcebc4a0c0547d538a0a0ffd6 (patch) | |
tree | 36540d31cf0ca653d8b4f9ad083ad807fe4f2c32 /ishtar_common/management | |
parent | b5d80cdc056efa4c15f0d8f08e237fc324b691e2 (diff) | |
download | Ishtar-4dbceff7ef3c52cdcebc4a0c0547d538a0a0ffd6.tar.bz2 Ishtar-4dbceff7ef3c52cdcebc4a0c0547d538a0a0ffd6.zip |
Geofla import: manage new ADMIN EXPRESS format
Diffstat (limited to 'ishtar_common/management')
-rw-r--r-- | ishtar_common/management/commands/import_geofla_csv.py | 12 | ||||
-rw-r--r-- | ishtar_common/management/commands/import_insee_comm_csv.py | 2 |
2 files changed, 10 insertions, 4 deletions
diff --git a/ishtar_common/management/commands/import_geofla_csv.py b/ishtar_common/management/commands/import_geofla_csv.py index 294219e9c..7ef0e0a38 100644 --- a/ishtar_common/management/commands/import_geofla_csv.py +++ b/ishtar_common/management/commands/import_geofla_csv.py @@ -65,11 +65,17 @@ class Command(BaseCommand): if 'MULTI' not in geom: geom = geom.replace('POLYGON', 'MULTIPOLYGON(') + ')' town.limit = GEOSGeometry(geom, srid=2154) - town.center = Point(float(row['X_CENTROID']), - float(row['Y_CENTROID']), srid=2154) + if 'X_CENTROID' in row: + town.center = Point(float(row['X_CENTROID']), + float(row['Y_CENTROID']), srid=2154) + else: + town.center = None if not town.year and default_year: town.year = default_year - town.surface = row['SUPERFICIE'] + if 'SUPERFICIE' in row: + town.surface = row['SUPERFICIE'] + else: + town.surface = None if not created: nb_changed += 1 town.save() diff --git a/ishtar_common/management/commands/import_insee_comm_csv.py b/ishtar_common/management/commands/import_insee_comm_csv.py index 97b680267..24eb2013e 100644 --- a/ishtar_common/management/commands/import_insee_comm_csv.py +++ b/ishtar_common/management/commands/import_insee_comm_csv.py @@ -74,7 +74,7 @@ class Command(BaseCommand): year=default_year) if not q.count(): nb_created += 1 - name = row['NomCN'].decode('utf-8').upper().strip() + name = row['NomCN'].decode('utf-8').strip() name = r.sub(r"\2 \1", name).strip() new_town = Town.objects.create(name=name, year=default_year, numero_insee=new_insee) |