<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Hi Saber,</p>
    <p>Thank you for your feedback. You are an expert on the subject and
      I really appreciate your comments.<br>
    </p>
    <p><span class="HwtZe" lang="en"><span class="jCAhz ChMk0b"><span
            class="ryNqvb">Postgresql is probably not the best option in
            terms of performance. </span></span></span><span
        class="HwtZe" lang="en"><span class="jCAhz ChMk0b"><span
            class="ryNqvb">But it is a practical solution to centralize
            all information in a single place.</span></span></span></p>
    <p><span class="HwtZe" lang="en"><span class="jCAhz ChMk0b"><span
            class="ryNqvb">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.<br>
          </span></span></span></p>
    <p><span class="HwtZe" lang="en"><span class="jCAhz ChMk0b"><span
            class="ryNqvb">GDAL and QGIS works very well with Postgresql
            and users are familiar with Postgresql (setup and usage). </span></span></span><span
        class="HwtZe" lang="en"><span class="jCAhz ChMk0b"><span
            class="ryNqvb"></span></span></span></p>
    <p><span class="HwtZe" lang="en"><span class="jCAhz ChMk0b"><span
            class="ryNqvb"></span></span></span><span class="HwtZe"
        lang="en"><span class="jCAhz ChMk0b"><span class="ryNqvb">How
            difficult would be to have netCDF data in Postgresql? </span></span></span></p>
    <p><span class="HwtZe" lang="en"><span class="jCAhz ChMk0b"><span
            class="ryNqvb">1) We should have a way to store the data
            (and metadata) on the database (like we do with rasters,
            with raster2pgsql). </span></span></span></p>
    <p><span class="HwtZe" lang="en"><span class="jCAhz ChMk0b"><span
            class="ryNqvb">2) We need to improve QgsMeshLayer to read
            from a PG uri, like:</span></span></span></p>
    <p><span class="HwtZe" lang="en"><span class="jCAhz ChMk0b"><span
            class="ryNqvb">uri_config = {<br>
                'service':'atlantico',<br>
                'schema':'public',<br>
                'table':'az1_hs_2023101200_03',<br>
                'geometrycolumn':'rast'<br>
            }<br>
            uri_config = {key:val for key, val in uri_config.items() if
            val is not None}<br>
            md = QgsProviderRegistry.instance().providerMetadata('mdal')<br>
            uri = QgsDataSourceUri(md.encodeUri(uri_config))<br>
            mesh_layer = QgsMeshLayer(uri.uri(False), "layer_name",
            "mdal")<br>
          </span></span></span></p>
    <p><span class="HwtZe" lang="en"><span class="jCAhz ChMk0b"><span
            class="ryNqvb">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.</span></span></span></p>
    <p><span class="HwtZe" lang="en"><span class="jCAhz ChMk0b"><span
            class="ryNqvb">Regards,</span></span></span></p>
    <p><span class="HwtZe" lang="en"><span class="jCAhz ChMk0b"><span
            class="ryNqvb">Jorge<br>
          </span></span></span><span class="HwtZe" lang="en"><span
          class="jCAhz ChMk0b"><span class="ryNqvb"></span></span></span></p>
    <p><span class="HwtZe" lang="en"><span class="jCAhz ChMk0b"><span
            class="ryNqvb"></span></span></span></p>
    <div class="moz-cite-prefix">
      <div
style="color: #3b3b3b;background-color: #ffffff;font-family: 'Ubuntu Mono', 'Droid Sans Mono', 'monospace', monospace, 'Droid Sans Fallback', 'Droid Sans Mono', 'monospace', monospace;font-weight: normal;font-size: 14px;line-height: 19px;white-space: pre;"><div><span
      style="color: #a31515;">
</span></div></div>
      On 14/12/23 10:13, Saber Razmjooei wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAH=WbRDC7v6g25pEyy1BiDgfKQarVwgWjrti41Jp7Bmvq-S2pQ@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">Hi Jorge,
        <div><br>
        </div>
        <div>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 (<a
            href="https://zarr.dev/" moz-do-not-send="true"
            class="moz-txt-link-freetext">https://zarr.dev/</a>) 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.</div>
        <div><br>
        </div>
        <div>Another option to serve large NetCDF/GRIB data is to set up
          an EDR (<a href="https://ogcapi.ogc.org/edr/overview.html"
            moz-do-not-send="true" class="moz-txt-link-freetext">https://ogcapi.ogc.org/edr/overview.html</a>)
          service which we are adding support for it in QGIS.</div>
        <div><br>
        </div>
        <div>Kind regards</div>
        <div>Saber</div>
        <div><br>
        </div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">On Wed, 13 Dec 2023 at 19:36,
          Jorge Gustavo Rocha via QGIS-User <<a
            href="mailto:qgis-user@lists.osgeo.org"
            moz-do-not-send="true" class="moz-txt-link-freetext">qgis-user@lists.osgeo.org</a>>
          wrote:<br>
        </div>
        <blockquote class="gmail_quote"
style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>
          <br>
          I'm playing with netCDF files. I add them to QGIS using the
          mdal <br>
          provider (mesh layer). Reading netCDF data from files works
          very well.<br>
          <br>
          My question is: is it possible to read netCDF data from
          Postgis/Postgresql?<br>
          <br>
          I can store netCDF files in Postgis using raster2pgsql, but
          the data is <br>
          stored as raster and I can only open it as raster in QGIS and
          not as <br>
          mesh. Is works, but not as good as the mesh support.<br>
          <br>
          I'm storing it, using something like this:<br>
          <br>
          raster2pgsql -s 4326 -d -I -C -M AZ1_HS_2023101200.nc -F <br>
          public.az1_hs_2023101200 | psql service=atlantico<br>
          <br>
          Thanks in advance,<br>
          <br>
          Jorge Gustavo<br>
          <br>
          _______________________________________________<br>
          QGIS-User mailing list<br>
          <a href="mailto:QGIS-User@lists.osgeo.org" target="_blank"
            moz-do-not-send="true" class="moz-txt-link-freetext">QGIS-User@lists.osgeo.org</a><br>
          List info: <a
            href="https://lists.osgeo.org/mailman/listinfo/qgis-user"
            rel="noreferrer" target="_blank" moz-do-not-send="true"
            class="moz-txt-link-freetext">https://lists.osgeo.org/mailman/listinfo/qgis-user</a><br>
          Unsubscribe: <a
            href="https://lists.osgeo.org/mailman/listinfo/qgis-user"
            rel="noreferrer" target="_blank" moz-do-not-send="true"
            class="moz-txt-link-freetext">https://lists.osgeo.org/mailman/listinfo/qgis-user</a><br>
        </blockquote>
      </div>
      <br clear="all">
      <div><br>
      </div>
      <span class="gmail_signature_prefix">-- </span><br>
      <div dir="ltr" class="gmail_signature">
        <div dir="ltr">
          <div>
            <div dir="ltr">
              <div>
                <div dir="ltr">
                  <div>
                    <div dir="ltr">
                      <div>
                        <div dir="ltr">Saber Razmjooei<br>
                        </div>
                        <div><a href="http://www.lutraconsulting.co.uk"
                            target="_blank" moz-do-not-send="true">www.lutraconsulting.co.uk</a><br>
                          <span>+44 (0)7568 129733</span><br>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
  </body>
</html>