# HG changeset patch # User Sascha L. Teichmann # Date 1570134431 -7200 # Node ID 2c49a293f275b4750b9db24447893844cf59c5b4 # Parent 25898dabd4aff4d92dcd2ddeca550c3adf51c631 Fixed access problem for waterway_admins and sys_admins. diff -r 25898dabd4af -r 2c49a293f275 pkg/imports/sr.go --- a/pkg/imports/sr.go Thu Oct 03 20:59:41 2019 +0200 +++ b/pkg/imports/sr.go Thu Oct 03 22:27:11 2019 +0200 @@ -24,7 +24,6 @@ "errors" "fmt" "io" - "log" "math" "os" "path" @@ -193,6 +192,7 @@ FROM waterway.sounding_results sr WHERE id = $1 ` + insertIsoAreasSQL = ` INSERT INTO waterway.sounding_results_iso_areas ( sounding_result_id, @@ -1012,46 +1012,21 @@ // none raster coordinate system. a := make(wkb.MultiPolygonGeom, len(c)) - rXMin, rXMax := math.MaxFloat64, -math.MaxFloat64 - rYMin, rYMax := math.MaxFloat64, -math.MaxFloat64 - for i, pl := range c { shell := make(wkb.LinearRingGeom, len(pl)) for j, pt := range pl { - x := reprojX(pt.X) - y := reprojY(pt.Y) - - if x < rXMin { - rXMin = x - } - if y < rYMin { - rYMin = y - } - if x > rXMax { - rXMax = x - } - if y > rYMax { - rYMax = y - } - shell[j] = wkb.PointGeom{ - X: x, - Y: y, + X: reprojX(pt.X), + Y: reprojY(pt.Y), } } a[i] = wkb.PolygonGeom{shell} } - log.Printf("(%.2f, %.2f) - (%.2f, %.2f)\n", - rXMin, rYMin, rXMax, rYMax) - log.Printf("%.2f / %.2f\n", rXMax-rXMin, rYMax-rYMin) areas[hIdx] = a } } - log.Printf("[%.2f, %.2f] - [%.2f, %.2f]\n", - min.X, min.Y, max.X, max.Y) - for n := runtime.NumCPU(); n >= 1; n-- { wg.Add(1) go doContours() @@ -1090,8 +1065,6 @@ time.Since(total)) }() - log.Printf("EPSG: %d\n", epsg) - stmt, err := tx.PrepareContext(ctx, insertIsoAreasSQL) if err != nil { return err diff -r 25898dabd4af -r 2c49a293f275 schema/updates/1204/01.create-iso-areas.sql --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/schema/updates/1204/01.create-iso-areas.sql Thu Oct 03 22:27:11 2019 +0200 @@ -0,0 +1,16 @@ +CREATE TABLE waterway.sounding_results_iso_areas ( + sounding_result_id int NOT NULL REFERENCES waterway.sounding_results + ON DELETE CASCADE, + height numeric NOT NULL, + areas geography(MULTIPOLYGON, 4326) NOT NULL, + -- TODO: generate valid simple features and add constraint: + -- CHECK(ST_IsSimple(CAST(areas AS geometry))), + PRIMARY KEY (sounding_result_id, height) +); + +GRANT INSERT, UPDATE, DELETE ON waterway.sounding_results_iso_areas + TO waterway_admin; + +GRANT SELECT ON waterway.sounding_results_iso_areas + TO waterway_user; +