How to handle large negative numbers in GeoTIFF DEM?
x$band1[x$band1 <=-3.403e+38] <- NA Use 0 instead of NA if you like, but zero might be a valid value in your case. You may need to be more flexible with the value used for comparing, so something like this should be safe x$band1[x$band1 <= (-3.403e+37)] <- NA HTH, Mike
Aubrey Moore wrote:
Hi All, I am trying to display a DEM for the island of Guam. The data were downloaded in GeoTIFF format from the National Elevation Dataset (http://ned.usgs.gov/). It appears that some rectangular areas of the ocean in this DEM been assigned an elevation attribute of -3.4E38 (see output below). How can I change these values to something more realistic, like zero, before displaying the image? - Aubrey
___________________________________________
> x=readGDAL(file.choose())
C:\Documents and Settings\Owner\My
Documents\GuamDEM\NED_66800217\NED_66800217.tif has GDAL driver GTiff
and has 1612 rows and 1365 columns
Closing GDAL dataset handle 0x00236838... destroyed ... done.
> summary(x)
Object of class SpatialGridDataFrame
Coordinates:
min max
x 144.58611 144.96528
y 13.22667 13.67444
Is projected: FALSE
proj4string :
[+proj=longlat +ellps=GRS80 +datum=NAD83 +no_defs +towgs84=0,0,0]
Number of points: 2
Grid attributes:
cellcentre.offset cellsize cells.dim
x 144.58625 0.0002777778 1365
y 13.22681 0.0002777778 1612
Data attributes:
band1
Min. :-3.403e+38
1st Qu.:-3.403e+38
Median : 0.000e+00
Mean :-1.224e+38
3rd Qu.: 7.907e+00
Max. : 4.029e+02
_______________________________________________
R-sig-Geo mailing list
R-sig-Geo at stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo