[gdal-dev] "Syncing" two rasters together...

Jonathan Greenberg jgrn at illinois.edu
Thu Mar 27 15:37:42 PDT 2014


Hi Tim:

Not quite -- all I'm trying to do is basically crop (or expand) one
raster to another's extent, but given two images may have their upper
left coordinates somewhat "out of sync" (so the pixels don't line up
perfectly with one another), I'm a bit unclear on how to do this --
the goal is to have two rasters with identical geographic information
(same projection, pixel size, row and column numbers) -- this then
allows me to "stack" them together to create an e.g. time series.

I'm thinking using gdalwarp with the te, t_srs, and ts/tr set to the
"reference" file may accomplish the task -- running a test now.

This is a common problem with a lot of raster analyses -- data from a
wide variety of sources/resolutions/projections need to be coerced to
a common set of spatial references so models can be applied to them
(e.g. species distribution models).  This is a common enough task that
it would be nice to see this as a feature in e.g. gdalwarp, if it
isn't already.

--j

On Thu, Mar 27, 2014 at 5:27 PM, Tim Keitt <tkeitt at utexas.edu> wrote:
>
>
>
> On Thu, Mar 27, 2014 at 4:26 PM, Jonathan Greenberg <jgrn at illinois.edu>
> wrote:
>>
>> GDALers:
>>
>> What is the most efficient way, given a "reference raster", and an
>> arbitrary raster (we'll call it "unsynced") synced together to allow
>> them to be stacked: the output of this should be the unsynced raster
>> with the same number of rows, columns, pixel size, upper left
>> coordinates, and projection as the reference raster.
>>
>> Here are the assumptions:
>> - both rasters already have the same pixel size and projection, but
>> the offset of the upper left coordinate may not be "perfect"
>>
>> - for each pixel location defined by the reference raster, the output
>> should have the closest (nearest neighbor) pixel from the unsynced
>> raster.  It should have some NA value in regions where the reference
>> and unsynced do not overlap.
>>
>> Thoughts?  The application of this would be e.g. taking a set of
>> Landsat images from different time periods (each image has slightly
>> different numbers of rows and columns), and stacking them together to
>> perform time series analysis.
>
>
> If I read right you are trying to estimate the x,y offset error in one
> image. You can assign GCPs by picking identical pixels in each image and
> then warp one of them to the other. OSSIM has some capability for image
> matching I believe. If you convolve the two images, you should get an
> impulse at the correct offset, but this is tricky in practice. Panorama
> software may be able to compute the exact matching of the images.
>
> THK
>
>>
>>
>> Cheers!
>>
>> --j
>>
>> --
>> Jonathan A. Greenberg, PhD
>> Assistant Professor
>> Global Environmental Analysis and Remote Sensing (GEARS) Laboratory
>> Department of Geography and Geographic Information Science
>> University of Illinois at Urbana-Champaign
>> 259 Computing Applications Building, MC-150
>> 605 East Springfield Avenue
>> Champaign, IL  61820-6371
>> Phone: 217-300-1924
>> http://www.geog.illinois.edu/~jgrn/
>> AIM: jgrn307, MSN: jgrn307 at hotmail.com, Gchat: jgrn307, Skype: jgrn3007
>> _______________________________________________
>> gdal-dev mailing list
>> gdal-dev at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>
>
>
>
> --
> http://www.keittlab.org/



-- 
Jonathan A. Greenberg, PhD
Assistant Professor
Global Environmental Analysis and Remote Sensing (GEARS) Laboratory
Department of Geography and Geographic Information Science
University of Illinois at Urbana-Champaign
259 Computing Applications Building, MC-150
605 East Springfield Avenue
Champaign, IL  61820-6371
Phone: 217-300-1924
http://www.geog.illinois.edu/~jgrn/
AIM: jgrn307, MSN: jgrn307 at hotmail.com, Gchat: jgrn307, Skype: jgrn3007


More information about the gdal-dev mailing list