[gdal-dev] Re: Transposing image data using RasterIO
Paul Mallas
pmallas at rsmas.miami.edu
Thu Jun 23 15:58:38 EDT 2011
Oh yes, I checked those several ties.
While I was not able to read lines then write columns, I am having
better luck reading columns then writing lines.
But, Frank seemed to think that the software might be inefficient
accessing columns. He certainly was right - glacier creep is faster
this. I will have to come up with something else, but it certianly has
been a learning experience.
On 6/22/2011 9:51 AM, Chaitanya kumar CH wrote:
> Paul,
>
> Please check that you used the right values for XSize and YSize.
>
> On Wed, Jun 22, 2011 at 6:39 PM, Paul Mallas <pmallas at rsmas.miami.edu
> <mailto:pmallas at rsmas.miami.edu>> wrote:
>
> Yes, I tried this. I keep getting a segmentation fault doing it this
> way.
>
> I will dig further, maybe something else is not right.
>
> Regards,
> Paul
>
>
> On 6/17/2011 6:25 PM, Paul Mallas wrote:
>
> On 6/17/2011 5:41 PM, Frank Warmerdam wrote:
>
> On 11-06-17 03:23 PM, Paul Mallas wrote:
>
> Hello,
>
> I am trying to transpose image data (i.e., swap lines
> and columns)
> and am
> struggling to make it work properly. I think this should
> be possible
> through
> RasterIO, but so far no luck. Any suggestions?
>
> My approach so far has been like this, with image nXsize
> by nYsize:
>
> void *pData = VSIMalloc2(nXSize,
> (GDALGetDataTypeSize(eType) / 8));
>
> for (int iLine = 0; iLine < nYSize; iLine++) {
>
> // Read in row (line)
> eErr = poSrcBand->RasterIO(GF_Read, 0, iLine, nXSize, 1,
> pData,
> nXSize, 1, eType, 0,0);
>
> // Now I want to write a column, nothing I tried here
> has worked
> eErr = poDstBand->RasterIO(GF_Write, .......
>
>
> Paul,
>
> You should be able to write this column wise like:
>
> poDstBand->RasterIO( GF_Write, iLine, 0, 1, nXSize,
> pData, 1, nXSize, eType, 0, 0 );
>
> Note that this can be pretty inefficient depending on the
> format and
> how it is blocked.
>
> Best regards,
>
>
> Hmm, I thought I tried this configuration. I will try again.
> Thank you
> for your time Frank.
>
>
>
> _________________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org <mailto:gdal-dev at lists.osgeo.org>
> http://lists.osgeo.org/__mailman/listinfo/gdal-dev
> <http://lists.osgeo.org/mailman/listinfo/gdal-dev>
>
>
>
>
> --
> Best regards,
> Chaitanya kumar CH.
> /tʃaɪθənjə/ /kʊmɑr/
> +91-9494447584
> 17.2416N 80.1426E
>
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
More information about the gdal-dev
mailing list