Closed smnorris closed 7 years ago
This isn't the only area, there seems to be a handful of similar gaps throughout the province.
This wasn't immediately apparent with previous runs, but when working on #25, I've noticed the gaps... because none should be present in the final output.
tiles to test:
(same result when just processing these tiles)
Editing the 'target_intersections' subquery to buffer by .001 then do the union clean things up a bit and removes the community watershed gap in 082E064, but doesn't fix 082E012. Haven't tested elsewhere.
https://github.com/smnorris/conservationlands/blob/master/sql/populate_target.sql#L31
target_intersections AS
(SELECT
a.input_id AS id,
ST_Union(
ST_Buffer(
ST_CollectionExtract(
ST_SnapToGrid(a.output_geom, .001), 3), 0.001)) AS geom
FROM all_intersects a
GROUP BY a.input_id),
Note that a small gap remains in 082E064 after above fix. It isn't related to the community watershed gap, it is a different issue, the gap is a spot where there is no designation (should be filled in by the tile in the last step of processing)
https://www.dropbox.com/s/1g7kecrxy3kfqjk/Screenshot%202017-01-04%2013.45.31.png?dl=0
I've isolated the section of the query that makes the area disappear - it is the ST_SnapToGrid
calls in the ST_Difference
calculation
https://github.com/smnorris/conservationlands/blob/master/sql/safe_diff.sql#L15
https://github.com/smnorris/conservationlands/blob/master/sql/safe_diff.sql#L18
Remove those functions and no gaps remain. However, ST_Difference requires them for stability. Not sure how to rectify
Note that this modification also removes all gaps 082E012, 103A099, 103H008.
Running the job provincially with these fixes applied was successful - apparently the ST_SnapToGrid
s weren't needed for stability in that part of the query after all.
So this is good - it looks like there aren't any gaps in the output. I'm really not sure why this was introducing such large gaps but since it is fixed, I won't worry about it.
closed with 058e361
Checking the total area of output against input land definition:
SELECT
SUM(ST_Area(geom)) / 10000
FROM conservationlands
WHERE bc_boundary = 'bc_boundary_land_tiled';
94,793,637ha
SELECT SUM(ST_Area(geom)) / 10000
FROM bc_boundary_land;
94,793,692ha
That looks very good!
Note that these areas don't quite match the input bc boundary land definition (94,806,281ha) quite as nicely because there are areas in that layer that are outside of the 1:20,000 tiles. I've brought this to GeoBC's attention in the past. Not sure whether it is a surveying issue or a data issue.
There are several strange gaps in the output layer in these tiles. The area is all within the GBR, it should be filled by that or other sources.