[GRASS-user] Re: r.in.gdal oddity
Brian Oney
zenlines at gmail.com
Thu Nov 3 06:28:25 EDT 2011
Hmmm, maybe just a suggestion, although it won't fix the current problem
but to make the code better (I hope)... because it apperas the if one
has an imprecise 0-360 map that thing could go awry, which may justify
another flag (if I may) or something similar to the few changes below.
/* 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.;
if (cellhd.east> 360.) cellhd.east = 360.;
/* for the case of imprecise coordinates 0-360: if the difference is greater than 360 AND it is the "other" ll projection AND the cellhd.west is strange THEN set cellhd.west to 0*/
if (cellhd.east - cellhd.west> 360.&& cellhd.east>= 181.&& cellhd.west< 0.) cellhd.west = 0.;
/* maybe just one degree of imprecision allowed? */
if (cellhd.east> 180.&& cellhd.east< 181.) cellhd.east = 180.;
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."));
}
I am not sure how to perform math operations in if-expressions in C, but
above is the general idea.
Again, I doubt this will fix the r.in.gdal oddity, but it may improve
the -l flag.
Notice that the resolution in the mentioned post is the same as my
case... prob just a coincidence.
cheers,
Brian
On 11/03/2011 07:21 AM, Markus Neteler wrote:
> On Thu, Nov 3, 2011 at 5:17 AM, Hamish<hamish_b at yahoo.com> wrote:
>> Hi, coming to this thread a bit late, sorry if I miss the point;
>> I'll study the rest of the thread/situation better asap, but some
>> general comments--
>>
>> Markus wrote:
>>>> 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...
>> AFAIK it is working as intended and without bugs.
> Please check then
> http://article.gmane.org/gmane.comp.gis.grass.user/41407
>
> Here I don't see that -l works.
>
> thanks
> Markus
More information about the grass-user
mailing list