[R-sig-Geo] read NITF save as geotif

Monica Pisica pisicandru at hotmail.com
Wed May 20 16:27:11 CEST 2009


Hi Arien,
 
Well, i hoped it was straight forward - but it seems it is not.
 
So if i use your code (which is almost like mine ....) i get this:
 
b1 <- readGDAL("myfile")
writeGDAL(b1, "test.tif")
Error: gridded(dataset) is not TRUE
 
If i try points2grid command i get:
 
 points2grid(b1, tolerance = 0.5)
cellcentre.offset -9.362957e+01 3.008636e+01
cellsize           8.535574e-09 7.422092e-09
cells.dim          9.000000e+06 9.000000e+06
Warning messages:
1: In points2grid(b1, tolerance = 0.5, round = 3, fuzz.tol = 4) :
  grid topology may be corrupt in dimwnsion 1
2: In points2grid(b1, tolerance = 0.5, round = 3, fuzz.tol = 4) :
  grid topology may be corrupt in dimwnsion 2

class(b1)
 
[1] "SpatialPointsDataFrame"
attr(,"package")
[1] "sp"

b1[1,]
          coordinates band1
1 (-93.6295, 30.1529)   286
 
summary(b1)

Object of class SpatialPointsDataFrame
Coordinates:
        min       max
x -93.62957 -93.55275
y  30.08636  30.15316
Is projected: FALSE 
proj4string :
[+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs +towgs84=0,0,0]
Number of points: 9000000
Data attributes:
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
  165.0   207.0   219.0   224.5   233.0  1449.0 

I am not sure if this is enough info, but if not i am sure i can post the file. Also i have to say that i read only part of the file - it is too bit it seems for my system to read all of it. I work on a 64 bit Windows machine with a 32 bit R 2.8.1 patch ( i know is kind of old but should not matter, i have all the packages just updated anyway).
 
Thanks,
 
Monica
----------------------------------------
> Date: Wed, 20 May 2009 11:31:18 +0200
> Subject: Re: [R-sig-Geo] read NITF save as geotif
> From: a.lam at geo.uu.nl
> To: pisicandru at hotmail.com
> CC: r-sig-geo at stat.math.ethz.ch
>
> Hi Monica,
>
> It should be straightforward using rgdal. Gtiff output is default,
> resolution is preserved by default, GDAL supports nitf (didn't test this)
> and geotiff supports x resolution and y resolution separately (x and y
> resolution may differ, but are constant for the image). So I expect the
> following snippet to work (if it doesn't, show us what goes wrong):
>
> require('rgdal')
>
> GDALinfo('yourfile') # look at res.x and res.y
>
> imagery <- readGDAL('yourfile')
> writeGDAL(imagery, 'destinationfile')
>
> GDALinfo('destinationfile')
>
> Hope this helps,
>
> Arien
>
>
> On Tue, May 19, 2009 20:24, Monica Pisica wrote:
>>
>> Hi,
>>
>> I have some NITF (in lat long) files and i would like to save them as
>> geotif. Things would be almost straightforward but .... the pixels in the
>> original image are rectangular, and not square, so i cannot grid. Do you
>> have any idea how i can go around this?
>>
>> Thanks, i will really appreciate that.
>>
>> Monica
>> _________________________________________________________________
>> Insert movie times and more without leaving Hotmail®.
>>
>> orial_QuickAdd1_052009
>> _______________________________________________
>> R-sig-Geo mailing list
>> R-sig-Geo at stat.math.ethz.ch
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>
>
>
> --
> drs. H.A. (Arien) Lam (Ph.D. student)
> Department of Physical Geography
> Faculty of Geosciences
> Utrecht University, The Netherlands
>
>
_________________________________________________________________
Hotmail® has a new way to see what's up with your friends.

orial_WhatsNew1_052009


More information about the R-sig-Geo mailing list