I use r.cost.points
from the GRASS
algorithms in QGIS
to create a accumulated travel costs map that is based on a friction surface raster. My problem is that the output file is more than 20x bigger than the input.
The input file is a raster in .tif
format and 5MB filesize. The output file is a .tif
as well but filesize increases to 110MB.
I don't really understand this increase, because both have the same extend, resolution, Data Type (Float64
) and Filetype.
The stored values differ: while the friction map contains only small integer values that inform the travel costs to cross one gridcell (ranging from 1-36), the output map contains the accumulated travel cost values (ranging from 252-46677.400562602). But still both are Float64
so they should be comparable in terms of space requirements AFAIK.
Comparing both Metadata Properties the only difference is the No Data Value
which is in case of the input file -1.7e+308
and in case of the output file nan
...
My main problem now is that I want to process an input file of 10GB which causes space problems while the output is created... Can anybody explain why this problem occurs and how I can avoid these increases?
You can test this on your computer with this sample data here as the friction surface and here the source layer containing the destinations.
edits i also tried it with a rasterized version of the source layer but this still creates a File of 98MB.
I use the GUI but the command looks in the console like this.
0 GRASS GIS 7 execution commands
g.proj -c proj4="+proj=eqc +lat_ts=0 +lat_0=0 +lon_0=-54 +x_0=0 +y_0=0 +ellps=WGS84 +units=m +no_defs"
r.external input="/home/user/R/R-projects/3_accessibility_map/output/toy_data/2_friction/friction_1.tif" band=1 output=tmp1480016848937 --overwrite -o
r.external input="/home/user/R/R-projects/3_accessibility_map/output/toy_data/1_rasterized/towns2.tif" band=1 output=tmp1480016848938 --overwrite -o
g.region n=-1340309.99994 s=-1451939.99994 e=-555477.497208 w=-667107.497208 res=30.0
r.cost input=tmp1480016848937 start_raster=tmp1480016848938 -n max_cost="0" null_cost="0" memory="4000" output=output5ae5c0b98f304e92ada91772b870452b --overwrite
g.region raster=output5ae5c0b98f304e92ada91772b870452b
r.out.gdal --overwrite -c createopt="TFW=YES,COMPRESS=LZW" input=output5ae5c0b98f304e92ada91772b870452b output="/home/user/Desktop/test2.tif"
ant the first lines of the output
2016-11-24T20:47:51 0 GRASS GIS 7 execution console output
Cleaning up temporary files...
Starting GRASS GIS...
Executing '/home/user/.qgis2//processing/grass7_batch_job.sh' ...
WARNING: Datum <unknown> not recognised by GRASS and no parameters found
Default region was updated to the new projection, but if you have multiple mapsets `g.region -d` should be run in each to update the region from the default
g.region
) and assuming you have usedr.out.gdal
have you included thecreateopt
i.e.createopt="COMPRESS=LZW"
createopt="COMPRESS=LZW"
was set automatically. Not sure about the region though...could you have a look if this helps...gdalinfo
on your input and output files. e.g.gdalinfo input.tif
and specifically check the Extent