<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p><br>
    </p>
    <div class="moz-cite-prefix">Le 26/10/2023 à 18:50, David Shean a
      écrit :<br>
    </div>
    <blockquote type="cite"
      cite="mid:EC3F0AEF-7860-43B5-BA45-DB017A6E1167@gmail.com">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      Hi Even and Javier,
      <div class="">For the special case of a DEM, would it make more
        sense to specify the units with a vertical CRS?  This approach
        would define the LENGTHUNIT and the associated vertical datum.</div>
      <div class=""><br class="">
      </div>
      <div class="">Example for EPSG:4979:</div>
      <div class=""><br class="">
      </div>
      <div class="">
        <div class="">        AXIS["ellipsoidal height (h)",up,</div>
        <div class="">            ORDER[3],</div>
        <div class="">            LENGTHUNIT["metre",1]],</div>
        <div><br class="">
        </div>
        <div>Example for EPSG:5703:</div>
        <div><br class="">
        </div>
        <div>
          <div>VERTCRS["NAVD88 height",</div>
          <div>    VDATUM["North American Vertical Datum 1988"],</div>
          <div>    CS[vertical,1],</div>
          <div>        AXIS["gravity-related height (H)",up,</div>
          <div>            LENGTHUNIT["metre",1]],</div>
          <div>...</div>
        </div>
        <div><br class="">
        </div>
        <div>More complicated than specifying the generic <span
            style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"
            class="">UNITTYPE in raster metadata, but seems like best
            practice.</span></div>
      </div>
    </blockquote>
    <p>This is actually already implemented (deducing the value of
      GetUnitType() from the vertical component):</p>
    <p>$ gdal_translate byte.tif out.tif -a_srs EPSG:4269+5703<br>
      $ gdalinfo out.tif | grep Unit<br>
        Unit Type: foot<br>
    </p>
    <p>$ gdal_translate byte.tif out.tif -a_srs EPSG:4269+8228<br>
      $ gdalinfo out.tif | grep Unit<br>
         Unit Type: foot<br>
      <br>
    </p>
    <p><br>
    </p>
    <blockquote type="cite"
      cite="mid:EC3F0AEF-7860-43B5-BA45-DB017A6E1167@gmail.com">
      <div class="">
        <div><span
            style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"
            class="">-David</span></div>
        <div><span
            style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"
            class=""><br class="">
          </span></div>
        <div><br class="">
          <blockquote type="cite" class="">
            <div class="">On Oct 26, 2023, at 4:45 AM, Javier Jimenez
              Shaw via gdal-dev <<a
                href="mailto:gdal-dev@lists.osgeo.org"
                class="moz-txt-link-freetext" moz-do-not-send="true">gdal-dev@lists.osgeo.org</a>>
              wrote:</div>
            <br class="Apple-interchange-newline">
            <div class="">
              <div dir="ltr" class="">Thanks!<br class="">
              </div>
              <br class="">
              <div class="gmail_quote">
                <div dir="ltr" class="gmail_attr">On Thu, 26 Oct 2023 at
                  12:27, Even Rouault via gdal-dev <<a
                    href="mailto:gdal-dev@lists.osgeo.org"
                    class="moz-txt-link-freetext" moz-do-not-send="true">gdal-dev@lists.osgeo.org</a>>
                  wrote:<br class="">
                </div>
                <blockquote class="gmail_quote"
style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
                  <div class="">
                    <p class="">Javier,<br class="">
                    </p>
                    <div class="">Le 26/10/2023 à 11:59, Javier Jimenez
                      Shaw via gdal-dev a écrit :<br class="">
                    </div>
                    <blockquote type="cite" class="">
                      <div dir="ltr" class="">
                        <div class="">Hi</div>
                        <div class=""><br class="">
                        </div>
                        <div class="">Using a GeoTIFF with a single band
                          and float values can be very useful to show
                          any distribution over the terrain. One typical
                          example is DSM (digital surface model), where
                          the value is the elevation on every point.</div>
                        <div class=""><br class="">
                        </div>
                        <div class="">Is there any standard (or
                          accepted) metadata to say the units of those
                          values?</div>
                      </div>
                    </blockquote>
                    <p class="">API wise in GDAL, you should use the
                      GDALRasterBand::SetUnitType() to set the unit</p>
                    <p class="">For TIFF, this will be encoded in the
                      GDAL_METADATA TIFF tag like the following:<br
                        class="">
                    </p>
                    <p class=""><GDALMetadata><br class="">
                        <Item name="UNITTYPE" sample="0"
                      role="unittype">foo</Item><br class="">
                      </GDALMetadata></p>
                    <p class="">Regarding the value itself, it is mostly
                      unspecified by GDAL. It could be a good practice
                      to suggest to use strings recognized by the
                      "udunits" package (when possible), like done in
                      the netCDF CF conventions
                      (<a
href="http://cfconventions.org/Data/cf-conventions/cf-conventions-1.10/cf-conventions.html#units"
                        target="_blank" class="moz-txt-link-freetext"
                        moz-do-not-send="true">http://cfconventions.org/Data/cf-conventions/cf-conventions-1.10/cf-conventions.html#units</a>)</p>
                    <p class="">Even<br class="">
                    </p>
                    <blockquote type="cite" class="">
                      <div dir="ltr" class="">
                        <div class=""><br class="">
                        </div>
                        <div class="">In the typical case of DSM it is
                          usually "meter" or "foot". But it can be
                          something else, like "people/km2" for
                          population, or "mm" for rain precipitation, or
                          "kg/ha" for agricultural yield.</div>
                        <div class=""><br class="">
                        </div>
                        <div class="">Thanks<br class="">
                        </div>
                        <div class="">
                          <div class="">
                            <div dir="ltr" class="gmail_signature">
                              <div dir="ltr" class="">
                                <div class="">.___ ._ ..._ .. . ._. 
                                  .___ .. __ . _. . __..  ... .... ._
                                  .__</div>
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                      <br class="">
                      <fieldset class=""></fieldset>
                      <pre class="">_______________________________________________
gdal-dev mailing list
<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank"
                      class="moz-txt-link-freetext"
                      moz-do-not-send="true">gdal-dev@lists.osgeo.org</a>
<a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev"
                      target="_blank" class="moz-txt-link-freetext"
                      moz-do-not-send="true">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a>
</pre>
                    </blockquote>
                    <pre cols="72" class="">-- 
<a href="http://www.spatialys.com/" target="_blank"
                    class="moz-txt-link-freetext" moz-do-not-send="true">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
                  </div>
                  _______________________________________________<br
                    class="">
                  gdal-dev mailing list<br class="">
                  <a href="mailto:gdal-dev@lists.osgeo.org"
                    target="_blank" class="moz-txt-link-freetext"
                    moz-do-not-send="true">gdal-dev@lists.osgeo.org</a><br
                    class="">
                  <a
href="https://lists.osgeo.org/mailman/listinfo/gdal-dev"
                    rel="noreferrer" target="_blank"
                    class="moz-txt-link-freetext" moz-do-not-send="true">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br
                    class="">
                </blockquote>
              </div>
              _______________________________________________<br
                class="">
              gdal-dev mailing list<br class="">
              <a href="mailto:gdal-dev@lists.osgeo.org"
                class="moz-txt-link-freetext" moz-do-not-send="true">gdal-dev@lists.osgeo.org</a><br
                class="">
              <a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/gdal-dev">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br
                class="">
            </div>
          </blockquote>
        </div>
        <br class="">
      </div>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
<a class="moz-txt-link-freetext" href="http://www.spatialys.com">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
  </body>
</html>