comparison schema/auth.sql @ 370:fe87457a05d7

Store spatial data as geography The main coordinate system should be lat/lon. Just using geometry with SRS 4326 will nonetheless let PostGIS consider coordinates as Cartesian, leading to nonesense results in some calculations. As there is no ST_Within for geography, replace with ST_CoveredBy, which should more correct anyhow, because we now accept also data on the boundary of the responsibility area.
author Tom Gottfried <tom@intevation.de>
date Thu, 09 Aug 2018 15:45:16 +0200
parents b97b3172c61a
children 5611cf72cc92
comparison
equal deleted inserted replaced
369:a43495c91856 370:fe87457a05d7
89 89
90 -- Staging area 90 -- Staging area
91 -- TODO: add all relevant tables here 91 -- TODO: add all relevant tables here
92 CREATE POLICY responsibility_area ON waterway.bottlenecks 92 CREATE POLICY responsibility_area ON waterway.bottlenecks
93 FOR ALL TO waterway_admin 93 FOR ALL TO waterway_admin
94 USING (ST_Within(area, (SELECT area FROM users.responsibility_areas 94 USING (ST_CoveredBy(area, (SELECT area FROM users.responsibility_areas
95 WHERE country = users.current_user_country()))); 95 WHERE country = users.current_user_country())));
96 CREATE POLICY responsibility_area ON waterway.sounding_results 96 CREATE POLICY responsibility_area ON waterway.sounding_results
97 FOR ALL TO waterway_admin 97 FOR ALL TO waterway_admin
98 USING (ST_Within(area, (SELECT area FROM users.responsibility_areas 98 USING (ST_CoveredBy(area, (SELECT area FROM users.responsibility_areas
99 WHERE country = users.current_user_country()))); 99 WHERE country = users.current_user_country())));
100 100
101 COMMIT; 101 COMMIT;