comparison pkg/imports/dma.go @ 2833:1b6840093eac

Prevent calculation of wrong UTM zones Using geography as input data type will ensure only lon/lat coordinates are fed into the calculation.
author Tom Gottfried <tom@intevation.de>
date Wed, 27 Mar 2019 15:39:52 +0100
parents 7cb027be277d
children 93fa55bce126
comparison
equal deleted inserted replaced
2832:b5555005f51e 2833:1b6840093eac
75 } 75 }
76 76
77 const ( 77 const (
78 deleteDistanceMarksSQL = ` 78 deleteDistanceMarksSQL = `
79 WITH resp AS ( 79 WITH resp AS (
80 SELECT best_utm(area::geometry) AS t, 80 SELECT best_utm(area) AS t,
81 ST_Transform(area::geometry, best_utm(area::geometry)) AS a 81 ST_Transform(area::geometry, best_utm(area)) AS a
82 FROM users.responsibility_areas 82 FROM users.responsibility_areas
83 WHERE country = users.current_user_country() 83 WHERE country = users.current_user_country()
84 ) 84 )
85 DELETE FROM waterway.distance_marks 85 DELETE FROM waterway.distance_marks
86 WHERE ST_Covers( 86 WHERE ST_Covers(
87 (SELECT a FROM resp), 87 (SELECT a FROM resp),
88 ST_Transform(geom::geometry, (SELECT t FROM resp))) 88 ST_Transform(geom::geometry, (SELECT t FROM resp)))
89 ` 89 `
90 insertDistanceMarksSQL = ` 90 insertDistanceMarksSQL = `
91 WITH resp AS ( 91 WITH resp AS (
92 SELECT best_utm(area::geometry) AS t, 92 SELECT best_utm(area) AS t,
93 ST_Transform(area::geometry, best_utm(area::geometry)) AS a 93 ST_Transform(area::geometry, best_utm(area)) AS a
94 FROM users.responsibility_areas 94 FROM users.responsibility_areas
95 WHERE country = users.current_user_country() 95 WHERE country = users.current_user_country()
96 ) 96 )
97 INSERT INTO waterway.distance_marks (geom, catdis) 97 INSERT INTO waterway.distance_marks (geom, catdis)
98 SELECT ST_Transform(clipped.geom, 4326)::geography, $3 FROM ( 98 SELECT ST_Transform(clipped.geom, 4326)::geography, $3 FROM (