changeset 3037:72451510d417

Remove expensive check with doubtful usefulness The removed check makes the axis import run about 25 percent longer and the locations it warns about turned out to be seldom really problematic in practice.
author Tom Gottfried <tom@intevation.de>
date Fri, 12 Apr 2019 16:10:05 +0200
parents 7f12a87c56ff
children 130da3cf5c8a
files pkg/imports/wx.go
diffstat 1 files changed, 1 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- a/pkg/imports/wx.go	Fri Apr 12 15:49:00 2019 +0200
+++ b/pkg/imports/wx.go	Fri Apr 12 16:10:05 2019 +0200
@@ -88,13 +88,6 @@
     ST_Transform(wtwaxs::geometry, (SELECT ST_SRID(a) FROM resp)))
 `
 
-	checkCrossingAxisSQL = `
-SELECT ST_AsText(ST_Intersection(new_line.wtwaxs, axis.wtwaxs))
-  FROM waterway.waterway_axis AS axis, waterway.waterway_axis AS new_line
-  WHERE new_line.id = $1 AND axis.id <> $1
-    AND ST_Crosses(new_line.wtwaxs::geometry, axis.wtwaxs::geometry)
-`
-
 	insertWaterwayAxisSQL = `
 WITH resp AS (
   SELECT users.current_user_area_utm() AS a
@@ -168,12 +161,6 @@
 	}
 	defer insertStmt.Close()
 
-	checkCrossingStmt, err := tx.PrepareContext(ctx, checkCrossingAxisSQL)
-	if err != nil {
-		return nil, err
-	}
-	defer checkCrossingStmt.Close()
-
 	// Delete the old features.
 	if _, err := tx.ExecContext(ctx, deleteWaterwayAxisSQL); err != nil {
 		return nil, err
@@ -244,7 +231,6 @@
 					nobjnam,
 					&outside,
 					&features,
-					checkCrossingStmt,
 					insertStmt); err != nil {
 					return err
 				}
@@ -264,7 +250,6 @@
 						nobjnam,
 						&outside,
 						&features,
-						checkCrossingStmt,
 						insertStmt); err != nil {
 						return err
 					}
@@ -315,7 +300,7 @@
 	props waterwayAxisProperties,
 	nobjnam sql.NullString,
 	outside, features *int,
-	checkCrossingStmt, insertStmt *sql.Stmt,
+	insertStmt *sql.Stmt,
 ) error {
 	var id int
 	err := savepoint(func() error {
@@ -337,19 +322,6 @@
 		feedback.Warn(handleError(err).Error())
 	default:
 		*features++
-		var crossing string
-		switch err := checkCrossingStmt.QueryRowContext(
-			ctx,
-			id,
-		).Scan(&crossing); {
-		case err != nil && err != sql.ErrNoRows:
-			return err
-		case err == nil:
-			feedback.Warn(
-				"Linestring %d crosses previously imported linestring near %s. "+
-					"Finding a contiguous axis may not work here",
-				id, crossing)
-		}
 	}
 	return nil
 }