[Qgis-user] Why does clipping a raster alters cell size?

Nicolas Cadieux nicolas.cadieux at archeotec.ca
Tue May 19 21:31:20 PDT 2015


Hi,
Why... I am not sure.  You could always use the -tr xres yres switch in 
gdalwarp.

http://www.geos.ed.ac.uk/~smudd/TopoTutorials/html/tutorial_raster_conversion.html

-tr will set the pixel size. (ex -tr 200 200)  I don't think it work 
with gdal_translate (clipper) yet.  (Needs gdal version2) 
http://www.gdal.org/gdal_translate.html

Should work.
Nicolas


Le 2015-05-19 21:12, Luciano La Sala [via OSGeo.org] a écrit :
> Dear QGIS users,
>
> I am using QGIS V 2.2.0 (OS-Windows 8), and need to prepare raster files
> (ESRI ArcInfo Grids) to be later used in a species distribucion model
> using MaxEnt. Each of the original raster files (environmental variables
> for Guadalquivir, Spain) has a different spatial extension (but all
> share the same pixel size of 200, -200). However, to be able to use
> these layers in MaxEnt, all of them need to have the exact same spatial
> extent. Therefore, I clipped every raster using a polygon of
> Guadalquivir. After clipping, I save as GeoTIFF but the new rasters have
> their original pixel size (200,-200) slightly altered
> (200.001,-199.942). I wouldn't bother too much about this menial
> difference in cell size if it weren't for the warning message that I get
> (see below) when trying to convert the GeoTIFF rasters to ASCII (a
> requirement for MaxEnt to work):
>
> Warning 1: Producing a Golden Surfer style file with DX and DY instead
> of CELLSIZE since the input pixels are non-square. Use the
> FORCE_CELLSIZE=TRUE creation option to force use of DX for
> even though this will be distorted. Most ASCII Grid readers
> (ArcGIS included) do not support the DX and DY parameters. .
>
> The Layer Spatial Reference System for Guadalquivir is:
>
> +proj=utm +zone=30 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs
>
>
> The Layer Spatial Reference System for the raster layers is:
>
> +proj=utm +zone=30 +ellps=GRS80 +units=m +no_defs
>
> When clipping, I'm using the function raster >> Extraction >> Clipper
> followed by the options...
>
> No data value = 0
> Mask layer: Guadalquivir
> Following, I save the new raster as GeoTIFF.
>
> Questions:
>
> Should the clipping be done using a polygon with the exact same
> projection? I am not sure to what extent the projections differ between
> the layers above.
>
> In case response to question is "Yes" (same projections needed), I did
> the clipping using both options: first by saving Guadalquivir as .shp
> with the raster's projection, and later the other way around, that is
> saving raster files with Guadalquivir's projection. Regardless of the
> option, pixel size remains altered/uneven.
>
> How can I keep the original pixel size of 200,-200?
>
> Thank you in advance.
>
> Luciano
> _______________________________________________
> Qgis-user mailing list
> [hidden email] </user/SendEmail.jtp?type=node&node=5206541&i=0>
> http://lists.osgeo.org/mailman/listinfo/qgis-user
>
>
> ------------------------------------------------------------------------
> If you reply to this email, your message will be added to the 
> discussion below:
> http://osgeo-org.1560.x6.nabble.com/Why-does-clipping-a-raster-alters-cell-size-tp5206541.html 
>
> To start a new topic under Quantum GIS - User, email 
> ml-node+s1560n4125267h38 at n6.nabble.com
> To unsubscribe from Quantum GIS - User, click here 
> <http://osgeo-org.1560.x6.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4125267&code=bmljb2xhcy5jYWRpZXV4QGFyY2hlb3RlYy5jYXw0MTI1MjY3fDYzNDQ4MjQxNg==>.
> NAML 
> <http://osgeo-org.1560.x6.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> 
>





--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Why-does-clipping-a-raster-alters-cell-size-tp5206541p5206550.html
Sent from the Quantum GIS - User mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20150519/301ca821/attachment.html>


More information about the Qgis-user mailing list