Hi Saber,

Thank you for your feedback. You are an expert on the subject and I really appreciate your comments.

Postgresql is probably not the best option in terms of performance. But it is a practical solution to centralize all information in a single place.

I'm using postgis raster support, for example, which is not faster than files, but it is ok for my use cases. I have all the spatial data in one place, where I can manage authentication and authorizations quite well. The end user will use a cached WMTS/TMS service (MapProxy on top of QGIS Server), and the performance will be ok. I want to use QGIS Server to provide data in netCDF files as temporal layers. The end user will use cached data and will not notice any performance issues. The cache can be created once, since the data is always in the past. That's my use case: I'm not processing the data or making any processing. Just providing maps/tiles.

GDAL and QGIS works very well with Postgresql and users are familiar with Postgresql (setup and usage).

How difficult would be to have netCDF data in Postgresql?

1) We should have a way to store the data (and metadata) on the database (like we do with rasters, with raster2pgsql).

2) We need to improve QgsMeshLayer to read from a PG uri, like:

uri_config = {
    'service':'atlantico',
    'schema':'public',
    'table':'az1_hs_2023101200_03',
    'geometrycolumn':'rast'
}
uri_config = {key:val for key, val in uri_config.items() if val is not None}
md = QgsProviderRegistry.instance().providerMetadata('mdal')
uri = QgsDataSourceUri(md.encodeUri(uri_config))
mesh_layer = QgsMeshLayer(uri.uri(False), "layer_name", "mdal")

If you think this does not make sense, you are probably right :-) I'm quite new to netCDF data and I just want to use the tools I'm used to have with this format.

Regards,

Jorge

On 14/12/23 10:13, Saber Razmjooei wrote:
Hi Jorge,

What is your motivation for storing mesh data in PG? If you want to have fast access to large central datasets, PG is probably not a good storage option. Best to investigate Zarr (https://zarr.dev/) which is a cloud optimised format for large multidimensional datasets. We need to first implement it in MDAL for QGIS to be able to load the data effectively.

Another option to serve large NetCDF/GRIB data is to set up an EDR (https://ogcapi.ogc.org/edr/overview.html) service which we are adding support for it in QGIS.

Kind regards
Saber


On Wed, 13 Dec 2023 at 19:36, Jorge Gustavo Rocha via QGIS-User <qgis-user@lists.osgeo.org> wrote:

    Hi,

    I'm playing with netCDF files. I add them to QGIS using the mdal
    provider (mesh layer). Reading netCDF data from files works very well.

    My question is: is it possible to read netCDF data from
    Postgis/Postgresql?

    I can store netCDF files in Postgis using raster2pgsql, but the
    data is
    stored as raster and I can only open it as raster in QGIS and not as
    mesh. Is works, but not as good as the mesh support.

    I'm storing it, using something like this:

    raster2pgsql -s 4326 -d -I -C -M AZ1_HS_2023101200.nc -F
    public.az1_hs_2023101200 | psql service=atlantico

    Thanks in advance,

    Jorge Gustavo

    _______________________________________________
    QGIS-User mailing list
    QGIS-User@lists.osgeo.org
    List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
    Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user



--
Saber Razmjooei
www.lutraconsulting.co.uk <http://www.lutraconsulting.co.uk>
+44 (0)7568 129733
_______________________________________________
QGIS-User mailing list
QGIS-User@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

Reply via email to