Mercurial > gemma
comparison pkg/imports/wa.go @ 1899:272133cd65da
Workarround for failing waterway_area imports.
* Create a buffer for responsibility area
* Fix selfintersections using ST_MakeValid
* Ensure all geometries are polygon using ST_CollectionExtract
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Fri, 18 Jan 2019 14:58:34 +0100 |
parents | 1ecfcf46e4da |
children | 2b72f5e005aa |
comparison
equal
deleted
inserted
replaced
1898:8a56a64e4410 | 1899:272133cd65da |
---|---|
102 ) | 102 ) |
103 INSERT INTO waterway.waterway_area (area, catccl, dirimp) | 103 INSERT INTO waterway.waterway_area (area, catccl, dirimp) |
104 SELECT ST_Transform(clipped.geom, 4326)::geography, $3, $4 FROM ( | 104 SELECT ST_Transform(clipped.geom, 4326)::geography, $3, $4 FROM ( |
105 SELECT (ST_Dump( | 105 SELECT (ST_Dump( |
106 ST_Intersection( | 106 ST_Intersection( |
107 (SELECT a FROM resp), | 107 (SELECT ST_Buffer(a, 0.0001) FROM resp), |
108 ST_Transform( | 108 ST_CollectionExtract(ST_MakeValid(ST_Transform( |
109 ST_GeomFromWKB($1, $2::integer), | 109 ST_GeomFromWKB($1, $2::integer), |
110 (SELECT t FROM resp) | 110 (SELECT t FROM resp) |
111 ) | 111 )),3) |
112 ) | 112 ) |
113 )).geom AS geom | 113 )).geom AS geom |
114 ) AS clipped | 114 ) AS clipped |
115 WHERE clipped.geom IS NOT NULL | 115 WHERE clipped.geom IS NOT NULL |
116 ` | 116 ` |