Mercurial > gemma
comparison pkg/imports/sr.go @ 3652:f415c5ed60f6 single-beam
Another attempt to fix the ST_IsValid check contstraint problem ... and also failed.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Thu, 13 Jun 2019 16:36:21 +0200 |
parents | c368a9a20478 |
children | 955e2371cf28 |
comparison
equal
deleted
inserted
replaced
3651:c368a9a20478 | 3652:f415c5ed60f6 |
---|---|
126 $3, | 126 $3, |
127 (SELECT | 127 (SELECT |
128 CASE WHEN $5::bytea IS NULL THEN | 128 CASE WHEN $5::bytea IS NULL THEN |
129 ST_Transform(ST_ConcaveHull(ST_Force2D(ST_GeomFromWKB($4, $6::integer)), 0.7), 4326)::geography | 129 ST_Transform(ST_ConcaveHull(ST_Force2D(ST_GeomFromWKB($4, $6::integer)), 0.7), 4326)::geography |
130 ELSE | 130 ELSE |
131 ST_Transform(ST_GeomFromWKB($5, $6::integer), 4326)::geography | 131 ST_MakeValid(ST_Transform(ST_GeomFromWKB($5, $6::integer), 4326))::geography |
132 END) | 132 END) |
133 RETURNING | 133 RETURNING |
134 id, | 134 id, |
135 ST_X(ST_Centroid(area::geometry)), | 135 ST_X(ST_Centroid(area::geometry)), |
136 ST_Y(ST_Centroid(area::geometry)), | 136 ST_Y(ST_Centroid(area::geometry)), |
148 | 148 |
149 repairBoundarySQL = ` | 149 repairBoundarySQL = ` |
150 SELECT | 150 SELECT |
151 ST_AsBinary(ST_Buffer(ST_MakeValid(ST_GeomFromWKB($1, $2::integer)), 0.0)), | 151 ST_AsBinary(ST_Buffer(ST_MakeValid(ST_GeomFromWKB($1, $2::integer)), 0.0)), |
152 ST_AsBinary(ST_Buffer(ST_MakeValid(ST_GeomFromWKB($1, $2::integer)), 0.1))` | 152 ST_AsBinary(ST_Buffer(ST_MakeValid(ST_GeomFromWKB($1, $2::integer)), 0.1))` |
153 | |
154 whatsWrongSQL = ` | |
155 SELECT ST_IsValidReason(CAST(ST_Transform(ST_GeomFromWKB($1, $2::integer), 4326)::geography AS geometry))` | |
153 | 156 |
154 insertContourSQL = ` | 157 insertContourSQL = ` |
155 INSERT INTO waterway.sounding_results_contour_lines ( | 158 INSERT INTO waterway.sounding_results_contour_lines ( |
156 sounding_result_id, | 159 sounding_result_id, |
157 height, | 160 height, |
386 polygon.Reverse() | 389 polygon.Reverse() |
387 } | 390 } |
388 | 391 |
389 clippingPolygon.FromLineStringZ(polygon) | 392 clippingPolygon.FromLineStringZ(polygon) |
390 | 393 |
394 var wrong string | |
395 if err := tx.QueryRowContext( | |
396 ctx, | |
397 whatsWrongSQL, | |
398 clippingPolygon.AsWKB(), | |
399 epsg, | |
400 ).Scan(&wrong); err != nil { | |
401 return nil, err | |
402 } | |
403 | |
404 log.Printf("!!!!!!!!: whats wrong: %s\n", wrong) | |
405 | |
391 var repaired, buffered []byte | 406 var repaired, buffered []byte |
392 | 407 |
393 if err := tx.QueryRowContext( | 408 if err := tx.QueryRowContext( |
394 ctx, | 409 ctx, |
395 repairBoundarySQL, | 410 repairBoundarySQL, |