Opened 19 years ago

Last modified 19 years ago

#708 closed enhancement (fixed)

Z Resolution support for USGS DEM driver

Reported by: hblanks@… Owned by: warmerdam
Priority: high Milestone:
Component: default Version: unspecified
Severity: minor Keywords:
Cc:

Description

I have a patch for the USGS DEM driver, so that it supports z resolutions other
than 1.0.  It uses the papszOptions string.  I also updated the usgs dem
documentation.

Index: usgsdem/frmt_usgsdem.html
===================================================================
RCS file: /cvs/maptools/cvsroot/gdal/frmts/usgsdem/frmt_usgsdem.html,v
retrieving revision 1.3
diff -r1.3 frmt_usgsdem.html
33c33
< GDAL supports export of geographic (but not UTM) USGS DEM and CDED data
---
> GDAL supports export of geographic (and UTM) USGS DEM and CDED data
37,40c37,40
< Input data must already be sampled in a geographic coordinate system.  By 
< default the entire area of the input file will be output, but for CDED50K
< products the output file will be sampled at the production specified resolution
< and on product tile boundaries.<P>
---
> Input data must already be sampled in a geographic or UTM coordinate
> system.  By default the entire area of the input file will be output,
> but for CDED50K products the output file will be sampled at the
> production specified resolution and on product tile boundaries.<P>
77c77,85
< from the template file if provided, and are otherwise left blank. 
---
> from the template file if provided, and are otherwise left blank.<p>
> 
> <li> <b>ZRESOLUTION=float</b>: DEM's store elevation information as
> positive integers, and these integers are scaled using the "z resolution."
> By default, this resolution is written as 1.0.  However, you may specify a
> different resolution here, if you would like your integers to be scaled
> into floating point numbers.  Any resolution greater than zero should
> work, so long as it is in a form readable by CPLScanDouble().  [Note:
> CPLScanDouble() is not called with any locale specific information].
Index: usgsdem/usgsdem_create.cpp
===================================================================
RCS file: /cvs/maptools/cvsroot/gdal/frmts/usgsdem/usgsdem_create.cpp,v
retrieving revision 1.15
diff -r1.15 usgsdem_create.cpp
592d591
<         USGSDEMPrintSingle( achARec + 840, 1.0 );
599a599,609
>     }
> 
>     /*
>      * Let people specify different z resolutions using the papszOptions
>      * string.
>      */
>     const char *zResolution = CSLFetchNameValue(
>             psWInfo->papszOptions, "ZRESOLUTION" );
> 
>     if( zResolution == NULL || EQUAL(zResolution,"DEFAULT") )
>     {
601a612,625
>     else {
>         double zRes = CPLScanDouble(
>                 zResolution, strlen(zResolution), NULL);
>         if ( zRes <= 0 )
>         {
>             /* don't allow negative values */
>             USGSDEMPrintSingle( achARec + 840, 1.0);
>         }
>         else
>         {
>             USGSDEMPrintSingle( achARec + 840, zRes );
>         }
>     }
>

Attachments (2)

usgsdem_z_resolution.patch (2.5 KB ) - added by hblanks@… 19 years ago.
z resolution patch (12/10/04)
usgsdem_zresolution_2.patch (2.3 KB ) - added by hblanks@… 19 years ago.
patch for max/min in usgsdem according to ZRESOLUTION

Download all attachments as: .zip

Change History (5)

by hblanks@…, 19 years ago

Attachment: usgsdem_z_resolution.patch added

z resolution patch (12/10/04)

comment:1 by warmerdam, 19 years ago

Patch applied with a slight reduction in the verbosity of ZRESOLUTION 
parameter docs. 

Thanks!

by hblanks@…, 19 years ago

Attachment: usgsdem_zresolution_2.patch added

patch for max/min in usgsdem according to ZRESOLUTION

comment:2 by hblanks@…, 19 years ago

oops!  I forgot that I needed to adjust the Max/Min values in Record A and B
accordingly.

comment:3 by warmerdam, 19 years ago

Applied patch with a few adjustments to avoid casting warnings.

Thanks!

Note: See TracTickets for help on using tickets.