Uploading m/analysing raster vector data in PostGIS

by dhiraj   Last Updated August 01, 2020 08:22 AM - source

I am trying to build a web-GIS platform where user can upload their data (raster & vector) and do some kind of analysis, like calculate zonal statistics. I read lots of articles and blogs about storing raster in PostGIS. I tried to upload raster using raster2pgsql command line. For the 10 MB raster, it takes 30+ second to upload in Postgres. I don't think it is the problem of my PC. In case for large raster (around 1 GB), It will take more than 5 min. I think it is not a good case what user wants.

For uploading the raster, I found lots of methods, like some developer prefer to upload as a tile (100*100), some of them upload without tile, some makes pyramids.

Can anyone suggest a way to upload the raster?

Some of the developers also prefer to store raster outside the database. But it will be slower.

Also If I tried to run some of the rasters analysis, It takes lots of time to get the output.

For example, I tried to calculate the zonal statists based on the district name with agri as the name of the raster. But it takes around 1 minute to run. In the case of web-platform, I know user can't stay waiting for a long time.

    (ST_SummaryStats(ST_Clip(agri.rast, district.geom, TRUE))).*,
    district.name AS districtName
    district.geom AS geom
FROM agri, district;

How can I speed up the upload and analysis of raster with this method to achieve speed like in ArcGIS and QGIS?

Related Questions

How to speed up raster2pgsql?

Updated August 20, 2017 23:22 PM

PostGIS raster query "out of range raster coordinates"

Updated December 19, 2017 09:22 AM