Mercurial > gemma
changeset 2938:ecb1e34157a3
Fix logging in area import
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Thu, 04 Apr 2019 16:25:02 +0200 |
parents | 0d79f5eec630 |
children | 988cfa4c5aac |
files | pkg/imports/wa.go |
diffstat | 1 files changed, 17 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/pkg/imports/wa.go Thu Apr 04 16:14:29 2019 +0200 +++ b/pkg/imports/wa.go Thu Apr 04 16:25:02 2019 +0200 @@ -103,6 +103,7 @@ ST_MakeValid(ST_Transform(new_area, (SELECT ST_SRID(a) FROM resp)))) END, 3), 4326)) AS dmp +RETURNING id ` ) @@ -169,6 +170,7 @@ unsupported = stringCounter{} missingProperties int badProperties int + outside int features int ) @@ -227,18 +229,24 @@ if err := json.Unmarshal(*feature.Geometry.Coordinates, &p); err != nil { return err } - if err := savepoint(func() error { - _, err := insertStmt.ExecContext( + var waid int64 + err := savepoint(func() error { + err := insertStmt.QueryRowContext( ctx, p.asWKB(), epsg, catccl, dirimp, - ) + ).Scan(&waid) return err - }); err != nil { + }) + switch { + case err == sql.ErrNoRows: + outside++ + // ignore -> filtered by responsibility_areas + case err != nil: feedback.Warn(handleError(err).Error()) - } else { + default: features++ } default: @@ -262,6 +270,10 @@ feedback.Warn("Unsupported types found: %s", unsupported) } + if outside > 0 { + feedback.Info("Features outside responsibility area: %d", outside) + } + if features == 0 { err := errors.New("No features found") feedback.Error("%v", err)