[GRASS-user] Re: r.in.gdal oddity

Markus Metz markus.metz.giswork at googlemail.com
Tue Nov 1 10:33:45 EDT 2011


On Tue, Nov 1, 2011 at 2:46 PM, Markus Neteler <neteler at osgeo.org> wrote:
> On Mon, Oct 31, 2011 at 9:25 PM, Brian Oney <zenlines at gmail.com> wrote:
>> Yes, everything works great. Thanks again.
>>
>> Ok, good to know. Yeah, the algorithm could be improved I guess. But, the
>> improvement that I would suggest is supposed to be the -l flag, right?
>
> Yes, that was the idea of the -l flag.
>
>> Just force it to be 180W and 180E... I thought (the -l flag) it is just a recent
>> addition to GRASS 6.4, so maybe it needs a some t.l.c...
>
> I run into the same problem recently (see my other posting) and didn't
> manage to import with -l. Using
>
>  gdal_translate -a_ullr -180 90 180 -60 inmap outmap
>
> is a solution but it would be better to get -l working (since it should do
> the same). The code piece is
>
>    /* constrain to geographic coords */
>    if (flag_l->answer && G_projection() == PROJECTION_LL) {
>        if (cellhd.north > 90.) cellhd.north = 90.;
>        if (cellhd.south < -90.) cellhd.south = -90.;
this:
>        if (cellhd.east > 360.) cellhd.east = 180.;
should probably be
          if (cellhd.east > 180.) cellhd.east = 180.;

But I faintly remember some maps to cover 0, 360 instead of -180, 180.

Furthermore, a map spanning 170,190 (the datumline) should stay as is,
the correction is probably only necessary if E - W > 360, E - W as
provided by GDAL, before GRASS does any conversion.

Also, it may be safer to do the correction after the projection check
and optional creation of a new location, not before.

Markus M


>        if (cellhd.west < -180.) cellhd.west = -180.;
>        cellhd.ns_res = (cellhd.north - cellhd.south) / cellhd.rows;
>        cellhd.ew_res = (cellhd.east - cellhd.west) / cellhd.cols;
>        cellhd.ew_res3 = cellhd.ew_res;
>        cellhd.ns_res3 = cellhd.ns_res;
>
>        G_warning(_("Map bounds have been constrained to geographic "
>            "coordinates. You will almost certainly want to check "
>            "map bounds and resolution with r.info and reset them "
>            "with r.region before going any further."));
>    }
>
> ... the warning is not particularly clear to me - "reset them" in this sense?
>
> Markus
>


More information about the grass-user mailing list