[GRASS-dev] Re: vector works in X0 monitor but not in gis.m (Daniel Victoria)

I’ve committed the fix below suggested by Glynn. I tested it on the new NC demo data set and it causes no problems.

Of course, the old regexp statement worked too in my tests. Since I’m so abysmal at regexp, I just have to go with this, like I did with the old statement (someone else suggested it to fix an earlier problem with latlon regions).

Could someone please test this since I’m not completely clear what breaks the old algorithm that works with this one? Hopefully this will work with all projections this time.

Michael


C. Michael Barton, Professor of Anthropology
Director of Graduate Studies
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

Phone: 480-965-6262
Fax: 480-965-7671
www: <www.public.asu.edu/~cmbarton>

On Dec 27, 2007, at 6:38 AM, grass-user-request@lists.osgeo.org wrote:

Probably related to this in mapcanvas.tcl:

Finally put this into wind file format to use with GRASS_REGION

regexp -nocase {^.* ((.*))} $parts(projection) trash end

set parts(projection) [string trim $parts(projection) $end]

The “*” operator will try to match as much as possble, so matching the

string “99 (Polyconic (American))” against the regexp"^.* ((.*))"

will result in the “." matching ""99 (Polyconic " and the "((.))”

matching “(American))”, so “end” will be set to “American)”

Also, using “string trim” here is bogus; it discards any leading or

trailing section consisting of characters in the specified string,

which may be more than just the string itself (if $end contains the

digit 9, it will strip the projection code).

It should probably just match the portion that it wants, e.g.:

regexp -nocase {^([0-9]+)} $parts(projection) trash parts(projection)

rather than trying to match and discard the portion that it doesn’t

want.

Glad to hear it. Thanks to Glynn for the suggested fix.

Michael
____________________
C. Michael Barton, Professor of Anthropology
Director of Graduate Studies
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

Phone: 480-965-6262
Fax: 480-965-7671
www: <www.public.asu.edu/~cmbarton>

On Dec 31, 2007, at 9:47 AM, Daniel Victoria wrote:

Michael et al,

I'm happy to inform that I just compiled Grass from the latest svn and
the problem is gone. Map canvas works with both Polyconic American
projection and lat Long projection...

Cheers and happy new year!
Daniel

On Dec 27, 2007 7:07 PM, Daniel Victoria <daniel.victoria@gmail.com> wrote:

Thanks! I will gladly test the fix as soon as my r.watershed process
finishes. It's been running for 1 day and will probably take 2 more to
end... my laptop is almost melting...

Thanks again
Daniel

On Dec 27, 2007 6:47 PM, Michael Barton <michael.barton@asu.edu> wrote:

I've committed the fix below suggested by Glynn. I tested it on the new NC
demo data set and it causes no problems.

Of course, the old regexp statement worked too in my tests. Since I'm so
abysmal at regexp, I just have to go with this, like I did with the old
statement (someone else suggested it to fix an earlier problem with latlon
regions).

Could someone please test this since I'm not completely clear what breaks
the old algorithm that works with this one? Hopefully this will work with
all projections this time.

Michael

____________________
C. Michael Barton, Professor of Anthropology
Director of Graduate Studies
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

Phone: 480-965-6262
Fax: 480-965-7671
www: <www.public.asu.edu/~cmbarton>

On Dec 27, 2007, at 6:38 AM, grass-user-request@lists.osgeo.org wrote:

Probably related to this in mapcanvas.tcl:

                # Finally put this into wind file format to use with
GRASS_REGION

                regexp -nocase {^.* (\(.*\))} $parts(projection) trash end

                set parts(projection) [string trim $parts(projection) $end]

The "*" operator will try to match as much as possble, so matching the

string "99 (Polyconic (American))" against the regexp"^.* (\(.*\))"

will result in the ".*" matching ""99 (Polyconic " and the "(\(.*\))"

matching "(American))", so "end" will be set to "American)"

Also, using "string trim" here is bogus; it discards any leading or

trailing section consisting of characters in the specified string,

which may be more than just the string itself (if $end contains the

digit 9, it will strip the projection code).

It should probably just match the portion that it wants, e.g.:

        regexp -nocase {^([0-9]+)} $parts(projection) trash
parts(projection)

rather than trying to match and discard the portion that it doesn't

want.

_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
grass-user Info Page