[GRASS-user] /usr/lib/grass/scripts/r.in.wms: line 439: /usr/lib/grass/etc/r.in.wms/r.in.gdalwarp: Argument list too long

Hi All,

I was starting a project that needed a lot of srtms.

So I though: Let's use the WMS!

there I went, set region:

GRASS 6.2.3 (prominence):~/gis > g.region -p
projection: 3 (Latitude-Longitude)
zone: 0
datum: wgs84
ellipsoid: wgs84
north: 13N
south: 56S
west: 82W
east: 34W
nsres: 0:00:03
ewres: 0:00:03
rows: 82800
cols: 57600
cells: 4769280000

then get the files:
GRASS 6.2.3 (prominence):~/gis > r.in.wms output=srtm.jpl
mapserver=http://wms.jpl.nasa.gov/wms.cgi layers=huemapped_srtm

so, 4673 GTIFF files later, I got this error:
/usr/lib/grass/scripts/r.in.wms: line 439:
/usr/lib/grass/etc/r.in.wms/r.in.gdalwarp: Argument list too long

now the qiestions:
1. what happened?
2. how to overcome this?

I have thought to manually join all 4673 files, but then there has to
be a (much) better way. I am open to suggestions.
--
Paulo Marcondes = PU1/PU2PIX
-22.915 -43.224 = GG87jc <= Corrected !
-23.578 -46.671 = GG66pk

On Wed, May 27, 2009 at 12:49 AM, Paulo 'Pmarc' Marcondes
<pmarc.debian@gmail.com> wrote:

Hi All,

I was starting a project that needed a lot of srtms.

So I though: Let's use the WMS!

there I went, set region:

GRASS 6.2.3 (prominence):~/gis > g.region -p
projection: 3 (Latitude-Longitude)
zone: 0
datum: wgs84
ellipsoid: wgs84
north: 13N
south: 56S
west: 82W
east: 34W
nsres: 0:00:03
ewres: 0:00:03
rows: 82800
cols: 57600
cells: 4769280000

then get the files:
GRASS 6.2.3 (prominence):~/gis > r.in.wms output=srtm.jpl
mapserver=http://wms.jpl.nasa.gov/wms.cgi layers=huemapped_srtm

so, 4673 GTIFF files later, I got this error:
/usr/lib/grass/scripts/r.in.wms: line 439:
/usr/lib/grass/etc/r.in.wms/r.in.gdalwarp: Argument list too long

now the qiestions:
1. what happened?
2. how to overcome this?

I have thought to manually join all 4673 files, but then there has to
be a (much) better way. I am open to suggestions.

This problem came up last year( in a different context):

On Mon, Oct 6, 2008 at 11:38 AM, Glynn Clements
<glynn@gclements.plus.com> wrote:

On Wed, Sep 24, 2008 at 5:04 PM, Daniel Victoria <daniel.victoria@gmail.com> wrote:
> I've bumped into this problem before, with the same error, but outside
> GRASS. Which shows that this is not a GRASS bug but a limitation of
> the operating system.

It's more robust to use sysconf(_SC_ARG_MAX), as the limit isn't
necessarily fixed at compile time (e.g. it can vary between kernel
versions).

Also, the limit is divided between argv and the environment. If you
have a lot of space taken up by environment variables, it will eat
into the space available. This can be significant on older systems,
where the limit may be as low as 4KiB (a single page of memory).

Possible solution:
- use r.in.wms from GRASS 7 (written in Python)
- amend the script to use shorter filenames
- use v.mkgrid and loop over the tiles to download in
   smaller chunks

Markus