Mercurial > gemma
diff pkg/imports/dma.go @ 2912:93fa55bce126
Add utility function to get users area of responsibility
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Tue, 02 Apr 2019 19:25:17 +0200 |
parents | 1b6840093eac |
children | 899b591493b4 |
line wrap: on
line diff
--- a/pkg/imports/dma.go Tue Apr 02 19:24:08 2019 +0200 +++ b/pkg/imports/dma.go Tue Apr 02 19:25:17 2019 +0200 @@ -77,22 +77,16 @@ const ( deleteDistanceMarksSQL = ` WITH resp AS ( - SELECT best_utm(area) AS t, - ST_Transform(area::geometry, best_utm(area)) AS a - FROM users.responsibility_areas - WHERE country = users.current_user_country() + SELECT users.current_user_area_utm() AS a ) DELETE FROM waterway.distance_marks WHERE ST_Covers( (SELECT a FROM resp), - ST_Transform(geom::geometry, (SELECT t FROM resp))) + ST_Transform(geom::geometry, (SELECT ST_SRID(a) FROM resp))) ` insertDistanceMarksSQL = ` WITH resp AS ( - SELECT best_utm(area) AS t, - ST_Transform(area::geometry, best_utm(area)) AS a - FROM users.responsibility_areas - WHERE country = users.current_user_country() + SELECT users.current_user_area_utm() AS a ) INSERT INTO waterway.distance_marks (geom, catdis) SELECT ST_Transform(clipped.geom, 4326)::geography, $3 FROM ( @@ -101,7 +95,7 @@ (SELECT a FROM resp), ST_Transform( ST_GeomFromWKB($1, $2::integer), - (SELECT t FROM resp) + (SELECT ST_SRID(a) FROM resp) ) ) )).geom AS geom