[gdal-dev] shifting (or snapping) one raster to another

Doug_Newcomb at fws.gov Doug_Newcomb at fws.gov
Fri Mar 23 07:50:31 EDT 2012


Derek,
        You can do this in GRASS ( using gdal in the background)  by doing 
the following:
1) create a workspace in the same projection as your existing raster  ( 
when you first start GRASS it will ask you to set up a workspace with 
projection information)
2)  import the existing raster layer into GRASS, ( 
r.in.gdal,http://grass.fbk.eu/grass64/manuals/html64_user/r.in.gdal.html)
3)set the region to match the imported raster layer in extent and 
resolution (g.region, 
http://grass.fbk.eu/grass64/manuals/html64_user/g.region.html) 
4) import the county vector layer (v.in.ogr, 
http://grass.fbk.eu/grass64/manuals/html64_user/v.in.ogr.html )
5) convert the vector layer to a raster layer(v.to.rast, 
http://grass.fbk.eu/grass64/manuals/html64_user/v.to.rast.html) 

When you create the new raster it will use the existing alignment and 
resolution of the region ( based off of the existing raster)  in the 
placement of the cells.  Even though I reference the tabular commands in 
the above process, it can be easily done through both GRASS gui's

Doug
 


Doug Newcomb 
USFWS
Raleigh, NC
919-856-4520 ext. 14 doug_newcomb at fws.gov
---------------------------------------------------------------------------------------------------------
The opinions I express are my own and are not representative of the 
official policy of the U.S.Fish and Wildlife Service or Dept. of the 
Interior.   Life is too short for undocumented, proprietary data formats.



Derek Morgan <jdmorgan at unca.edu> 
Sent by: gdal-dev-bounces at lists.osgeo.org
03/22/2012 10:12 PM

To
gdal-dev at lists.osgeo.org
cc

Subject
[gdal-dev] shifting (or snapping) one raster to another






Hello,

I am in a jam with ArcGIS, and am hoping there is a easier way to do
this with GDAL.  Here is the situation:  I am converting a vector
dataset of county polygons to raster at a pixel resolution of 231 m.
However, I want this to line up with a different raster dataset I have
at a much larger extent, but also the same resolution 231 m. As you
probably guessed the two datasets are slightly askew as they have
different extents.  I would like to align the newly created county
raster with the larger raster data set by shifting (or snapping) it to
the closest pixels.  Hopefully, this makes enough sense for someone to
let me know if this can be done in GDAL.

Thanks ahead of time,
Derek
_______________________________________________
gdal-dev mailing list
gdal-dev at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20120323/099ba48b/attachment.html


More information about the gdal-dev mailing list