diff options
| author | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-02-17 19:37:41 +0100 | 
|---|---|---|
| committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-02-17 19:37:41 +0100 | 
| commit | 920b279449315db7f0e8441f6035fb4e9fd9ffcd (patch) | |
| tree | eab5065b6d1b3cf1598585106eb6b6704119365d /ishtar_common/management/commands/import_geofla_csv.py | |
| parent | 47e5798cdae59ac4bfe0f890eb3d6f48f0b30097 (diff) | |
| download | Ishtar-920b279449315db7f0e8441f6035fb4e9fd9ffcd.tar.bz2 Ishtar-920b279449315db7f0e8441f6035fb4e9fd9ffcd.zip | |
Town: can specify SRID in IGN import
Diffstat (limited to 'ishtar_common/management/commands/import_geofla_csv.py')
| -rw-r--r-- | ishtar_common/management/commands/import_geofla_csv.py | 10 | 
1 files changed, 7 insertions, 3 deletions
| diff --git a/ishtar_common/management/commands/import_geofla_csv.py b/ishtar_common/management/commands/import_geofla_csv.py index 3ef5eff1c..f60296e2f 100644 --- a/ishtar_common/management/commands/import_geofla_csv.py +++ b/ishtar_common/management/commands/import_geofla_csv.py @@ -37,10 +37,14 @@ class Command(BaseCommand):          parser.add_argument(              '--quiet', dest='quiet', action='store_true',              help='Quiet output') +        parser.add_argument( +            '--srid', type=int, default=2154, dest='srid', +            help='SRID uses. Default: 2154.')      def handle(self, *args, **options):          csv_file = options['csv_file']          default_year = options['year'] +        srid = options['srid']          quiet = options['quiet']          if not quiet:              sys.stdout.write('* using year {} as a default\n'.format( @@ -66,15 +70,15 @@ class Command(BaseCommand):                  else:                      created = True                      nb_created += 1 -                    town = Town(name=row['NOM_COM'], +                    town = Town(name=row['NOM_COM_M'],                                  numero_insee=num_insee)                  geom = row['wkt_geom'].upper()                  if 'MULTI' not in geom:                      geom = geom.replace('POLYGON', 'MULTIPOLYGON(') + ')' -                town.limit = GEOSGeometry(geom, srid=2154) +                town.limit = GEOSGeometry(geom, srid=srid)                  if 'X_CENTROID' in row:                      town.center = Point(float(row['X_CENTROID']), -                                        float(row['Y_CENTROID']), srid=2154) +                                        float(row['Y_CENTROID']), srid=srid)                  else:                      town.center = None                  if not town.year and default_year: | 
