<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>The WCS driver stores data in folder $HOME/.gdal/wcs_cache. The
      folder contains a text file db which contains keys and URLs and
      responses from the server</p>
    <p>// key.xml = service file<br>
      // key.xml.aux.xml = metadata file<br>
      // key.xml = Capabilities response<br>
      // key.aux.xml = Global metadata<br>
      // key.DC.xml = DescribeCoverage response</p>
    <p>The issue could perhaps be debugged with those files.<br>
    </p>
    <p>I tried <br>
    </p>
    <p>gdalinfo -if WCS -oo CLEAR_CACHE
"WCS:<a class="moz-txt-link-freetext" href="https://elevation.nationalmap.gov/arcgis/services/3DEPElevation/ImageServer/WCSServer?version=2.0.1&coverage=DEP3Elevation">https://elevation.nationalmap.gov/arcgis/services/3DEPElevation/ImageServer/WCSServer?version=2.0.1&coverage=DEP3Elevation</a>"</p>
    <p>(CLEAR_CACHE clears the whole cache so use with caution) but it
      returns 504 and a HTML file describing an error.</p>
    <p>Best,</p>
    <p>Ari<br>
    </p>
    <div class="moz-cite-prefix">Carl Godkin kirjoitti 2.11.2020 klo
      16.38:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAE=8kmm_kbaTs9_rW+txifLnbAvQ7Wjx_PxrhXO-K3KgtvzhSQ@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">Hi Jukka,
        <div><br>
        </div>
        <div>That's very interesting.  Thanks a lot.  I wonder if I can
          figure out how the X dimension is being changed to (or
          interpreted as) such a large range.</div>
        <div><br>
        </div>
        <div>Certainly something that I can dig into step by step.  </div>
        <div><br>
        </div>
        <div>I can try sending your findings along to the USGS and hope
          that someone there takes an interest.  This is a potentially
          very useful facility and I would be surprised if no one else
          had tried using GDAL tools with it!</div>
        <div><br>
        </div>
        <div>Thanks again,</div>
        <div><br>
        </div>
        <div>carl</div>
        <div><br>
        </div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">On Sun, Nov 1, 2020 at 11:37
          PM jratike80 <<a
            href="mailto:jukka.rahkonen@maanmittauslaitos.fi"
            moz-do-not-send="true">jukka.rahkonen@maanmittauslaitos.fi</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>
          By adding "-- debug on" into your command it is possible to
          get details<br>
          about what GDAL is doing. Here are the main parts from the log<br>
          <br>
          gdal_translate<br>
          "WCS:<a
href="https://elevation.nationalmap.gov:443/arcgis/services/3DEPElevation/ImageServer/WCSServer?version=2.0.1&coverage=DEP3Elevation"
            rel="noreferrer" target="_blank" moz-do-not-send="true">https://elevation.nationalmap.gov:443/arcgis/services/3DEPElevation/ImageServer/WCSServer?version=2.0.1&coverage=DEP3Elevation</a>"<br>
          test.tif -projwin -107.03 37.28 -107 37.25 -projwin_srs
          EPSG:4326 -tr 100<br>
          100 --debug on<br>
          <br>
          GDAL:<br>
          GDALOpen(WCS:<a
href="https://elevation.nationalmap.gov:443/arcgis/services/3DEPElevation/ImageServer/WCSServer?version=2.0.1&coverage=DEP3Elevation"
            rel="noreferrer" target="_blank" moz-do-not-send="true">https://elevation.nationalmap.gov:443/arcgis/services/3DEPElevation/ImageServer/WCSServer?version=2.0.1&coverage=DEP3Elevation</a>,<br>
          this=000002944175BD50) succeeds as WCS.<br>
          GDAL: Using GTiff driver<br>
          Input file size is 40075015, 20498394<br>
          GDAL: Using GTiff driver<br>
          0GDAL: GDAL_CACHEMAX = 1632 MB<br>
          GDAL: GDALDatasetCopyWholeRaster(): 33*42 swaths,
          bInterleave=0<br>
          WCS: DirectRasterIO(8122982,14330794,3340,4196) -> (33,42)
          (1 bands)<br>
          <br>
          WCS: Requesting<br>
          <a
href="https://elevation.nationalmap.gov:443/arcgis/services/3DEPElevation/ImageServer/WCSServer?SERVICE=WCS&REQUEST=GetCoverage&VERSION=2.0.1&COVERAGEID=DEP3Elevation&SUBSET=x%28-20037507.0672000013,-11911185.14836644%29&SUBSET=y%284474012.1150791775,4478208.115037268%29&SCALESIZE=x%2833%29,y%2842%29&Format=image/tiff"
            rel="noreferrer" target="_blank" moz-do-not-send="true">https://elevation.nationalmap.gov:443/arcgis/services/3DEPElevation/ImageServer/WCSServer?SERVICE=WCS&REQUEST=GetCoverage&VERSION=2.0.1&COVERAGEID=DEP3Elevation&SUBSET=x%28-20037507.0672000013,-11911185.14836644%29&SUBSET=y%284474012.1150791775,4478208.115037268%29&SCALESIZE=x%2833%29,y%2842%29&Format=image/tiff</a><br>
          HTTP:<br>
          Fetch(<a
href="https://elevation.nationalmap.gov:443/arcgis/services/3DEPElevation/ImageServer/WCSServer?SERVICE=WCS&REQUEST=GetCoverage&VERSION=2.0.1&COVERAGEID=DEP3Elevation&SUBSET=x%28-20037507.0672000013,-11911185.14836644%29&SUBSET=y%284474012.1150791775,4478208.115037268%29&SCALESIZE=x%2833%29,y%2842%29&Format=image/tiff"
            rel="noreferrer" target="_blank" moz-do-not-send="true">https://elevation.nationalmap.gov:443/arcgis/services/3DEPElevation/ImageServer/WCSServer?SERVICE=WCS&REQUEST=GetCoverage&VERSION=2.0.1&COVERAGEID=DEP3Elevation&SUBSET=x%28-20037507.0672000013,-11911185.14836644%29&SUBSET=y%284474012.1150791775,4478208.115037268%29&SCALESIZE=x%2833%29,y%2842%29&Format=image/tiff</a>)<br>
          HTTP: libcurl/7.70.0-DEV OpenSSL/1.1.1g zlib/1.2.3<br>
          WCS: GDALOpenResult() on content-type: multipart/related;
          boundary="wcs";<br>
          start="GML-Part"; type="text/xml"<br>
          GDAL: GDALOpen(/vsimem/wcs/000002944175BD50/wcsresult.dat,<br>
          this=0000029441C0D9A0) succeeds as GTiff.<br>
          GDAL: GDALClose(/vsimem/wcs/000002944175BD50/wcsresult.dat,<br>
          this=0000029441C0D9A0)<br>
          ...10...20...30...40...50...60...70...80...90...100 - done.<br>
          GDAL: Flushing dirty blocks:<br>
          0...10...20...30...40...50...60...70...80...90...100 - done.<br>
          <br>
          Image test.tif looks somehow corrupted from the right side.<br>
          The only WCS request that GDAL sends can be found from the
          log. I removed<br>
          url-encoding for clarity<br>
          <br>
          <a
href="https://elevation.nationalmap.gov:443/arcgis/services/3DEPElevation/ImageServer/WCSServer?SERVICE=WCS&REQUEST=GetCoverage&VERSION=2.0.1&COVERAGEID=DEP3Elevation&SUBSET=x(-20037507.0672000013,-11911185.14836644)&SUBSET=y(4474012.1150791775,4478208.115037268)&SCALESIZE=x(33),y(42)&Format=image/tiff"
            rel="noreferrer" target="_blank" moz-do-not-send="true">https://elevation.nationalmap.gov:443/arcgis/services/3DEPElevation/ImageServer/WCSServer?SERVICE=WCS&REQUEST=GetCoverage&VERSION=2.0.1&COVERAGEID=DEP3Elevation&SUBSET=x(-20037507.0672000013,-11911185.14836644)&SUBSET=y(4474012.1150791775,4478208.115037268)&SCALESIZE=x(33),y(42)&Format=image/tiff</a><br>
          <br>
          Unfortunately the server returns the GeoTIFF within a
          multipart content with<br>
          some GML. I do not know how to extract the GeoTIFF from the
          multipart<br>
          package so I could compare the results obtained by using WCS
          service<br>
          directly with curl or a browser. But because GDAL does not do
          much for the<br>
          result, just extract the tiff part and write it into separate
          GeoTIFF, I<br>
          suppose that it is the WCS server that generates the corrupted
          output.<br>
          However, the request that GDAL sends feels odd to me. Compare
          the projwin in<br>
          gdal_translate command with subsets in the GetCoverage<br>
          <br>
           -projwin -107.03 37.28 -107 37.25<br>
          SUBSET=x(-20037507.0672000013,-11911185.14836644)<br>
          SUBSET=y(4474012.1150791775,4478208.115037268)<br>
          <br>
          Subract the numbers and notice that subset x is 8126321.919
          meters while<br>
          subset y is 4196 meters. <br>
          I can see number 4196 also in this line of the log<br>
          WCS: DirectRasterIO(8122982,14330794,3340,4196) -> (33,42)
          (1 bands)<br>
          <br>
          Perhaps the meaning is to create SUBSET=x() so that it is 3340
          meters wide,<br>
          not 8126322? And maybe the ESRI WCS server creates a corrupted
          tiff when it<br>
          receives a somewhat lunatic request?<br>
          <br>
          -Jukka Rahkonen-<br>
          <br>
          <br>
          <br>
          <br>
          <br>
          <br>
          <br>
          <br>
          <br>
          <br>
          <br>
          --<br>
          Sent from: <a
            href="http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html"
            rel="noreferrer" target="_blank" moz-do-not-send="true">http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html</a><br>
          _______________________________________________<br>
          gdal-dev mailing list<br>
          <a href="mailto:gdal-dev@lists.osgeo.org" target="_blank"
            moz-do-not-send="true">gdal-dev@lists.osgeo.org</a><br>
          <a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev"
            rel="noreferrer" target="_blank" moz-do-not-send="true">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a></blockquote>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
gdal-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/gdal-dev">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a></pre>
    </blockquote>
  </body>
</html>