On Fri, 21 Aug 2009, Roger Bivand wrote:

On Fri, 21 Aug 2009, Frank Warmerdam wrote:

Roger Bivand wrote:
Hi,

The code for the LAN/GIS driver uses GDT_Int16 for Pixel type 2, rather than GDT_UInt16. Is this justified? A user of rgdal has a case of unsigned 16-bit data stored by "a forest landscape model", being treated by the driver as signed. The header does not seem to have a signed/unsigned flag. Is this a problem of ambiguity in use of a (closed?) specification, or should the driver be using GDT_UInt16?

I'm asking on the list first, because this may be ambiguity, not a bug.

Roger,

The only specification information I have on the format does not indicate
whether 16bit values should be treated as signed or unsigned.  If you are
confident that it should be treated as unsigned file a ticket and we will
fix it - hopefully this won't just break it for someone else!

Frank,

Thanks, I'm waiting to receive the affected file. I'll let you know when I've got it.

(reverting to list)

Correction, the user reported that:

Apparently, gdalinfo retrieves the correct min, max, and statistics, despite the use of GDT_Int16.

on his Windows platform. The different GDAL versions ought to explain why his gdalinfo says Int16 but gives statistics from UInt16.

He has:

From FWTools:
gdalinfo --version
GDAL 1.7.0dev, FWTools 2.4.2 released 2009/06/24

C:\Program Files\FWTools2.4.2>gdalinfo stand_bm.gis
Driver: LAN/Erdas .LAN/.GIS
Files: c:\landis\harvest_problem\FTT-N_MinT-N\stand_bm.gis
      c:\landis\harvest_problem\FTT-N_MinT-N\stand_bm.gsw
Size is 1758, 839
Coordinate System is:
LOCAL_CS["Unknown",
   UNIT["Meter",1]]
Origin = (33773.261718750000000,945478.062500000000000)
Pixel Size = (100.000000000000000,-100.000000000000000)
Corner Coordinates:
Upper Left  (   33773.262,  945478.063)
Lower Left  (   33773.262,  861578.063)
Upper Right (  209573.262,  945478.063)
Lower Right (  209573.262,  861578.063)
Center      (  121673.262,  903528.063)
Band 1 Block=1758x1 Type=Int16, ColorInterp=Undefined
 Min=0.000 Max=48499.000
 Minimum=0.000, Maximum=48499.000, Mean=12833.830, StdDev=13635.800
 Metadata:
   STATISTICS_MINIMUM=0
   STATISTICS_MAXIMUM=48499
   STATISTICS_MEAN=12833.830260712
   STATISTICS_MEDIAN=8.7254821994872e-239
   STATISTICS_MODE=3.9864100424366e-293
   STATISTICS_STDDEV=13635.800289332
   LAYER_TYPE=thematic


rgdal_0.6-12
getGDALVersionInfo()
[1] "GDAL 1.6.1, released 2009/05/11"

For me on x86_64, GDALinfo() in rgdal and 1.6.2 gdalinfo -stats agree.

$ gdalinfo -stats stand_bm.gis
Driver: LAN/Erdas .LAN/.GIS
Files: stand_bm.gis
Size is 1758, 839
Coordinate System is:
LOCAL_CS["Unknown",
    UNIT["Meter",1]]
Origin = (33773.261718750000000,945478.062500000000000)
Pixel Size = (100.000000000000000,-100.000000000000000)
Corner Coordinates:
Upper Left  (   33773.262,  945478.062)
Lower Left  (   33773.262,  861578.062)
Upper Right (  209573.262,  945478.062)
Lower Right (  209573.262,  861578.062)
Center      (  121673.262,  903528.062)
Band 1 Block=1758x1 Type=Int16, ColorInterp=Undefined
  Minimum=-32140.000, Maximum=29620.000, Mean=8315.507, StdDev=13186.107
  Metadata:
    STATISTICS_MINIMUM=-32140
    STATISTICS_MAXIMUM=29620
    STATISTICS_MEAN=8315.5065072863
    STATISTICS_STDDEV=13186.10731815

On the trunk, GDT_Int16 is used too, so how does gdalinfo detect that it is actually UInt16?

Roger


Best wishes,

Roger


Best regards,




--
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: roger.biv...@nhh.no

_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to