[GRASS-dev] Understanding g.tempfile and resolving "Illegal filename" issues

Vaclav Petras wenzeslaus at gmail.com
Thu Nov 14 09:49:52 PST 2013


This creates confusion all the time.

For normal files, you use system tools (posix tools) for temporary files,
e.g. mktemp.

For large files (large means large as a map), use g.tempfile which does not
work so well as posix tools in terms of safety but it uses grass database
because there is an assumption that there should be enough space.

For temporary maps there are two way. You can create temporary vector map
in C (and in Python using C types). You cannot do this for rasters. The
universal method is to use unique (enough) map name. Function for this
should be placed to Python library, so we have the standardized method. It
should be noted that `g.tempfile -d` is not usable for this.

I hope that this helps and that it is correct.

Vaclav


On Thu, Nov 14, 2013 at 12:05 PM, Nikos Alexandris
<nik at nikosalexandris.net>wrote:

> I don't understand how to use g.tempfile. The manual simply refers to (for
> bash): temp1=`g.tempfile pid=$$`
>
> My attempts to use it like that, end up with: "Illegal filename. Character
> </>
> not allowed."  Checking if the map's "filename" exists, returns for
> example:
>
> --%<---
> ERROR: Raster map
>        </mnemosyne/geo/grassdb/nc_spm_08/landsat/.tmp/Resilience/26834.0>
>        not found in current mapset
> --->%--
>
> I have been through the mailing list and have found past references to the
> same problem. For example <
> http://lists.osgeo.org/pipermail/grass-user/2012-March/063977.html>.
> However, I can't get past the problem.
>
> I tried to use naming conventions such as "i.fusion.hpf.tmp.$$" but I still
> have some problems. I would like to use g.tempfile as it seems to be a
> "cleaner" way(?).
>
> Thank you, Nikos
> _______________________________________________
> grass-dev mailing list
> grass-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20131114/fd0dc01f/attachment.html>


More information about the grass-dev mailing list