-1

Situation - have a simplistic model of land classification, based on approx 4 layers which describe natural characteristics which do not vary much in time. Many polygons. Fifth layer is a boundary layer, areas of interest which will change in time.

There is a current incarnation which was made by starting with the boundaries and writing attributes to it and intersecting the polygons, this created a very realistic display of the landscape. But also created many sliver polygons, orphans and redundant information. It was all done on desktop, writing shapefiles and geopackages to disk. One layer originally was a raster. Combined final layer is approx 1 GB on disk.

It is going to be clumsy to reproduce on the fly, as the boundary polygons are updated in time.

Proposal - do all this on the server in a PostGIS DB, write all the static information to a grid (25m hexagon) and then update any or all boundary polygons as required based on coverage of the grid. Make use of PostGIS functions for subsequent processing. Planar / UTM required for area calculations, so H3 grid would seem to be a distraction.

First attempt, first step, create the grid;

From the Vector > Research Tools > Create Grid dialog in QGIS

Algorithm 'Create grid' starting…
Input parameters:
{ 'CRS' : QgsCoordinateReferenceSystem('EPSG:7855'), 'EXTENT' : '-243151.60475903528,1304000.1983627826,5816401.698888286,6903705.604971119 [EPSG:32755]', 'HOVERLAY' : 0, 'HSPACING' : 25, 'OUTPUT' : 'postgis:dbname=\'terrae\' host=112.213.33.202 port=5432 table=\"XXXXX\".\"grid_hx25\" (the_geom)', 'TYPE' : 4, 'VOVERLAY' : 0, 'VSPACING' : 25 }

Writes a geopackage to disk. After approx 18 hrs, indicators says 1% complete and a 12.5 GB file written to disk. Grid displayed covers 23 km x 1,100 km, neat hexagons as expected, but only say 1% of the project area. This appears to be going down the track of creating something very cumbersome.

Would the experience be different on the PostGIS DB?

Stepping back a bit, is there a better processing method to the problem?

I am aware of How to get the Area of two intersecting polygons on PostGIS? which will be a help but does not consider the idea of using a grid.

2
  • 2
    Are you sure you're exporting the area you're expecting? Could be because you're exporting a much larger grid than you thought. Your 23x1100km area should be exporting a 920x44000 grid at 25m, which even at 32bit data for 6 layers should only be around a gigabyte (if my napkin math is right). Commented Aug 18, 2020 at 3:44
  • 1
    I might suggest "solving a simpler problem" - make a single dummy polygon about the size of your dataset, and rasterize that. See what happens. Commented Aug 18, 2020 at 3:45

1 Answer 1

0

@Charles Angus deserves the credit here. Their common sense applied below. After web searching for a bit for anything about "feature budget" for PostGIS, I did some simple tests as they advised.

The desired feature is a hexagon on a UTM projection. In fact the parameters ;

{ 'CRS' : QgsCoordinateReferenceSystem('EPSG:7855'), 'EXTENT' : '607893.8463532325,624451.1692891844,6372865.186253845,6389341.106422166 [EPSG:7855]', 'HOVERLAY' : 0, 'HSPACING' : 25, 'OUTPUT' : 'ogr:dbname=\'/Doodles/25x16.gpkg\' table=\"output\" (geom)', 'TYPE' : 4, 'VOVERLAY' : 0, 'VSPACING' : 25 }

The results show, that my original ambition was grossly misguided and the machine was faithfully reproducing the instructions .

enter image description here

1
  • @charles angus, you should copy and paste this and post as your answer.
    – BJW
    Commented Aug 18, 2020 at 11:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.