Mercurial > gemma
diff 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 |
line wrap: on
line diff
--- a/schema/auth.sql Thu Aug 09 15:50:46 2018 +0200 +++ b/schema/auth.sql Thu Aug 09 15:45:16 2018 +0200 @@ -91,11 +91,11 @@ -- TODO: add all relevant tables here CREATE POLICY responsibility_area ON waterway.bottlenecks FOR ALL TO waterway_admin - USING (ST_Within(area, (SELECT area FROM users.responsibility_areas + USING (ST_CoveredBy(area, (SELECT area FROM users.responsibility_areas WHERE country = users.current_user_country()))); CREATE POLICY responsibility_area ON waterway.sounding_results FOR ALL TO waterway_admin - USING (ST_Within(area, (SELECT area FROM users.responsibility_areas + USING (ST_CoveredBy(area, (SELECT area FROM users.responsibility_areas WHERE country = users.current_user_country()))); COMMIT;