[GIS] Create contour line from point table in PostGIS

contourpostgisvector

I have a point table containing values ranging from 0 to 100 and I would like to draw a contour line for the value 70. (See image below)

I know how to create contour lines in QGIS for raster data but now I would like to do it with vector data (my point table) using PostGIS so that it can be integrated in a python script.

Any idea on how to start?

EDIT:
This question is different from Generating contour lines and filled contours from points as it doesn't involve raster data (neither in the input nor in the output)

enter image description here

Best Answer

I think what you want is something like gdal_contour.

gdal_contour: Builds vector contour lines from a raster elevation model.


Usage: gdal_contour [-b <band>] [-a <attribute_name>] [-3d] [-inodata]
                    [-snodata n] [-i <interval>]
                    [-f <formatname>] [[-dsco NAME=VALUE] ...] [[-lco NAME=VALUE] ...]
                    [-off <offset>] [-fl <level> <level>...]
                    [-nln <outlayername>]
                    <src_filename> <dst_filename>

But PostGIS doesn't seem to implement anything like that from GDAL.

GDAL expects a input raster elevation model (DEM). PostGIS has a few DEM functions but I don't believe they'll help you here.