Mercurial > gemma
diff pkg/imports/sr.go @ 4578:c657dec6b0fa iso-areas
Removed old contours from backend and database.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Tue, 08 Oct 2019 12:10:55 +0200 |
parents | 4b3a298b94f8 |
children | 7acb03e8a737 |
line wrap: on
line diff
--- a/pkg/imports/sr.go Tue Oct 08 10:37:02 2019 +0200 +++ b/pkg/imports/sr.go Tue Oct 08 12:10:55 2019 +0200 @@ -97,10 +97,7 @@ func (srJobCreator) Depends() [2][]string { return [2][]string{ - {"sounding_results", - "sounding_results_contour_lines", - "sounding_results_iso_areas", - }, + {"sounding_results", "sounding_results_iso_areas"}, {"bottlenecks"}, } } @@ -164,32 +161,6 @@ ST_AsBinary(ST_Buffer(ST_MakeValid(ST_GeomFromWKB($1, $2::integer)), 0.0)), ST_AsBinary(ST_Buffer(ST_MakeValid(ST_GeomFromWKB($1, $2::integer)), 0.1))` - insertContourSQL = ` -INSERT INTO waterway.sounding_results_contour_lines ( - sounding_result_id, - height, - lines -) -SELECT - $1, - $2, - ST_Transform( - ST_Multi( - ST_CollectionExtract( - ST_SimplifyPreserveTopology( - ST_Multi(ST_Collectionextract( - ST_MakeValid(ST_GeomFromWKB($4, $3::integer)), 2)), - $5 - ), - 2 - ) - ), - 4326 - ) -FROM waterway.sounding_results sr -WHERE id = $1 -` - insertIsoAreasSQL = ` INSERT INTO waterway.sounding_results_iso_areas ( sounding_result_id, @@ -900,10 +871,6 @@ heights = common.DedupFloat64s(heights) - if err := generateContours(ctx, tx, feedback, tree, heights, id); err != nil { - return err - } - return generateIsoAreas(ctx, tx, feedback, tree, heights, id) } @@ -967,37 +934,3 @@ return nil } - -func generateContours( - ctx context.Context, - tx *sql.Tx, - feedback Feedback, - tree *octree.Tree, - heights []float64, - id int64, -) error { - feedback.Info("Generate contour lines") - start := time.Now() - defer func() { - feedback.Info("Generating contour lines took %v", - time.Since(start)) - }() - - stmt, err := tx.PrepareContext(ctx, insertContourSQL) - if err != nil { - return err - } - defer stmt.Close() - - octree.DoContours(tree, heights, func(res *octree.ContourResult) { - if err == nil && len(res.Lines) > 0 { - _, err = stmt.ExecContext( - ctx, - id, res.Height, tree.EPSG, - res.Lines.AsWKB2D(), - contourTolerance) - } - }) - - return err -}