I have equadistant vector points, that are all 400m apart but only cover certain areas of a map that have a value of (1-5). In QGIS I can run the Kernel Density Estimation with my vector points to select a distance, pixel rows, and then weight based on the (1-5) values, 1 best/5 worst to get an interpolated distribution. Here is the before and after. What I'm attempting to do is write a script that can essentially replicate what QGIS is doing but using POSTGIS functions to have an input of vector points and outputs of vector polygons such as this. Using the Polygonize Raster to Vector after Kernel Density is run and then put the new polygon shapes into a Graduated DN into 5 bins of equal interval:

Input: enter image description here

Kernal Density Params & Output:

enter image description here

enter image description here

Then toward the end of the process I will then dissolve the similar bins to have a seemless display such as this: enter image description here

1 Answer 1


Unfortunately, if there are clustering functions in Postgis, there is still no density functions. But you can create your own, and luckily somebody already did: https://trac.osgeo.org/postgis/ticket/2894#no1

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.