Mercurial > gemma
changeset 1934:ec7360afd5e1
Fairway dimension import: Dont break if there are features outside the responsibility areas.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Mon, 21 Jan 2019 13:20:26 +0100 |
parents | 1aa2921d8832 |
children | 73f9e15d0384 |
files | pkg/imports/fd.go |
diffstat | 1 files changed, 14 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/pkg/imports/fd.go Mon Jan 21 13:02:32 2019 +0100 +++ b/pkg/imports/fd.go Mon Jan 21 13:20:26 2019 +0100 @@ -215,6 +215,7 @@ missingProperties int badProperties int features int + outside int fds []fdSummary ) @@ -238,6 +239,7 @@ feedback.Info("Using EPSG: %d", epsg) + features: for _, feature := range rfc.Features { if feature.Geometry.Coordinates == nil { missingProperties++ @@ -258,7 +260,7 @@ } var fdid int64 var lat, lon float64 - if err := insertStmt.QueryRowContext( + err = insertStmt.QueryRowContext( ctx, p.asWKB(), epsg, @@ -268,8 +270,13 @@ fd.Depth, props.HydroSorDat.Time, fd.SourceOrganization, - ).Scan(&fdid, &lat, &lon); err != nil { - feedback.Error("error: %s", err) + ).Scan(&fdid, &lat, &lon) + switch { + case err == sql.ErrNoRows: + outside++ + // ignore -> filtered by responsibility_areas + continue features + case err != nil: return err } // Store for potential later removal. @@ -301,6 +308,10 @@ feedback.Warn("Unsupported types found: %s", unsupported) } + if outside > 0 { + feedback.Info("Features outside responsibility areas: %d", outside) + } + if features == 0 { err := errors.New("No features found") feedback.Error("%v", err)