[Qgis-user] 'gdawarp' causing shift and other questions
Tilottama Ghosh
waggymaggy at gmail.com
Tue Jan 31 03:04:51 PST 2012
Hi,
Thanks for your responses. I checked and my shapefile and tiff file are in
the same projection. The ticket posted by Etienne showed that this problem
of gdalwarp has been reported before. This is what was mentioned in ticket
#3947 and I tried it.
"I should add that not adding -crop_to_cutline results in no shift.
Commands I ran:
(1) gdalwarp -cutline cluj_co.shp -crop_to_cutline sample.tif cropped.tif
result is shifted
(2) gdalwarp -cutline cluj_co.shp sample.tif out.tif
result is not shifted"
However, although using only -cutline places the carved out raster from the
bigger raster correctly (without shifting it 500m), it does not reduce the
size of the whole image (in the sense, it gives 0 values everyhwere outside
the state but still has all those 3399 columns and 3747 rows. This defeats
the purpose of my whole exercise of trying to carve ot only a portion of
the raster on the basis of the state shapefile. gdal2xyz generates the csv
file, but excel fails to open all the rows!
Any suggestions, again?
Thanks,
Tilo
On Mon, Jan 30, 2012 at 7:43 PM, Even Rouault
<even.rouault at mines-paris.org>wrote:
> Selon Etienne Tourigny <etourigny.dev at gmail.com>:
>
> > 1) Probably a datum issue, as shapefiles do not include datum shift
> > information. You could work this around by making a new shape file
> > with the same datum as the gtiff file.
> >
> > What are the datums of your gtiff and shape files? Please post the
> > contents of the .prj file.
>
> It might be the same as http://trac.osgeo.org/gdal/ticket/3947
>
> >
> > Etienne
> >
> > On Mon, Jan 30, 2012 at 9:39 AM, Tilottama Ghosh <waggymaggy at gmail.com>
> > wrote:
> > > Hi,
> > >
> > > I have a huge tiff image (covering an entire country) with 3399
> columns and
> > > 3747 rows, so a total of 12,736,053 cells. The cell size is 1000m or
> 1km. I
> > > need to extract the data per km2. Of course, I didn't think it was
> smart to
> > > work with such a huge dataset in one go. So, I followd these steps in
> > > Quantum gis -
> > >
> > > 1. I used the gdalwarp -crop_to_cutline in the command line to carve
> out a
> > > portion of the raster image based on the shapefile of a state of the
> > entire
> > > country. The problem is that although the gdalwarp command worked it is
> > > clearly causing a shift (of about 500m) during this step.
> > >
> > > 2. Then, I used the gdal2xyz tool from the command line to create the
> csv
> > > file corresponding to the 'cut out' raster image or only the raster
> image
> > of
> > > the state.
> > >
> > > 3. Then I used the 'Create a Layer from a Delimited Text file' plugin
> in
> > > qgis to get the centroid shapefile.
> > >
> > > My problems are-
> > >
> > > 1. The shift in the image caused by the gdalward tool. Does anyone
> know how
> > > to work around that, so that no shift is caused?
> > >
> > > 2. The image is in 32 bit floating point and so does not show the
> attribute
> > > table. Even after getting the csv file I am unable to link the created
> csv
> > > file with the raster image, and thus cannot understand which pixel
> > > corresponds to which value in the csv file.
> > >
> > > Can anyone suggest any better way of doing this?
> > >
> > > Thanks very much for your help.
> > >
> > > Best Regards,
> > >
> > > Tilo
> > >
> > >
> > > --
> > >
> > > _______________________________________________
> > > Qgis-user mailing list
> > > Qgis-user at lists.osgeo.org
> > > http://lists.osgeo.org/mailman/listinfo/qgis-user
> > >
> > _______________________________________________
> > Qgis-user mailing list
> > Qgis-user at lists.osgeo.org
> > http://lists.osgeo.org/mailman/listinfo/qgis-user
> >
>
>
>
--
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20120131/ee866d9e/attachment.html>
More information about the Qgis-user
mailing list