[GRASSLIST:4839] Re: Problems importing Data into lat/lon with negtiv south value

Glynn Clements glynn at gclements.plus.com
Mon Nov 15 12:18:08 EST 2004


Paul Kelly wrote:

> >> What actually is the problem? Did something go wrong when you tried to
> >> import it into GRASS? Was this using r.in.gdal? And which GRASS
> >> version?
> >
> > yes, r.in.gdal did not work, because latitude for south was illigal.
> >
> > Proceeding with import...
> > WARNING: G_set_window(): Illegal latitude for South
> >
> > no map is imported.
> 
> This doesn't really explain what looks like a bug, but I think it is a 
> side-effect of GDAL trying to set the current region to match the imported 
> data, which IMHO I don't think it should do. E.g. what if you were running 
> an analysis in the background for which the region set was very important, 
> and then imported a new file and r.in.gdal suddenly changed the current 
> region?

r.in.gdal doesn't modify the WIND file. If you use the -e flag, it
modifies the DEFAULT_WIND file in the PERMANENT mapset[1], otherwise
it only modifies the process' internal region.

[1] At least, it tries to; obviously, if you don't have write
permission of the PERMANENT mapset, this will fail.

> I think it should only do this if the -e flag to extend the region is 
> given, or perhaps there should be a new flag specifically to set the 
> region to match the imported file.

I'm not sure that there would be much point, as you can just use
"g.region rast=..." if you want that behaviour.

> If you comment out the lines in raster/r.in.gdal/main.c:
>      if(G_set_window (&cellhd) < 0)
>          exit(3);
> and re-compile does it work?
> Although seeing that doesn't fix the underlying bug, it might run into 
> problems later I suppose.
> 
> Anybody else have an opinion on the region setting and extending behaviour 
> of r.in.gdal and v.in.ogr?

If r.in.gdal is importing a georeferenced raster, it should attempt to
set the correct bounds and resolution (i.e. cellhd) for that raster,
rather than using (0,0,W,H). It shouldn't attempt to set the current
region or the default region; that should be left to g.region (which
should have an option to set the default region).

I don't think that this is an issue for v.in.ogr; AFAIK, vector maps
don't have a region (cellhd).

-- 
Glynn Clements <glynn at gclements.plus.com>




More information about the grass-user mailing list