diff options
author | Étienne Loks <etienne.loks@peacefrogs.net> | 2013-10-27 18:28:23 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@peacefrogs.net> | 2013-10-27 18:28:23 +0100 |
commit | 909d1cbd60b689ef606e419a69a4a0fb1f171855 (patch) | |
tree | d032db3445b37c4d3b8e0596435021a087058f3c | |
parent | e1ab7e5ce27d38988c535ccba14ba2eaae52b43c (diff) | |
download | Chimère-909d1cbd60b689ef606e419a69a4a0fb1f171855.tar.bz2 Chimère-909d1cbd60b689ef606e419a69a4a0fb1f171855.zip |
CSV import: fix import when Nominatim fields are configured but geom is provided
-rw-r--r-- | chimere/utils.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/chimere/utils.py b/chimere/utils.py index b7a2da8..974f8f3 100644 --- a/chimere/utils.py +++ b/chimere/utils.py @@ -542,7 +542,13 @@ class CSVManager(ImportManager): 'origin':self.importer_instance.origin, 'license':self.importer_instance.license} cls = None - if settings.CHIMERE_NOMINATIM_FIELDS: + if 'POINT' in geom: + cls = Marker + dct['point'] = geom + elif 'LINE' in geom: + cls = Route + dct['route'] = geom + elif settings.CHIMERE_NOMINATIM_FIELDS: nominatim_query = settings.NOMINATIM_URL + "?" nominatim_keys = nominatim_default_query.copy() nominatim_keys['format'] = 'json' @@ -558,12 +564,6 @@ class CSVManager(ImportManager): result = result[0] cls = Marker dct['point'] = "POINT(%s %s)" % (result['lon'], result['lat']) - elif 'POINT' in geom: - cls = Marker - dct['point'] = geom - elif 'LINE' in geom: - cls = Route - dct['route'] = geom else: continue import_key = pk if pk else name.decode('utf-8') |