Mercurial > gemma
changeset 2928:074f2bb85584
Do not count skipped features as stored
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Wed, 03 Apr 2019 18:47:37 +0200 |
parents | 80815b0a665c |
children | e5f5afa45451 |
files | pkg/imports/dma.go |
diffstat | 1 files changed, 15 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/pkg/imports/dma.go Wed Apr 03 17:57:40 2019 +0200 +++ b/pkg/imports/dma.go Wed Apr 03 18:47:37 2019 +0200 @@ -101,6 +101,7 @@ )).geom AS geom ) AS clipped WHERE clipped.geom IS NOT NULL +RETURNING id ` ) @@ -163,6 +164,7 @@ unsupported = stringCounter{} missingProperties int badProperties int + outside int features int ) @@ -205,12 +207,19 @@ if err := json.Unmarshal(*feature.Geometry.Coordinates, &p); err != nil { return err } - if _, err := insertStmt.ExecContext( + var dmaid int64 + err := insertStmt.QueryRowContext( ctx, p.asWKB(), epsg, props.HydroCatdis, - ); err != nil { + ).Scan(&dmaid) + switch { + case err == sql.ErrNoRows: + outside++ + // ignore -> filtered by responsibility area + continue + case err != nil: return err } features++ @@ -235,6 +244,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)