FYI, I've commited a fix in GDAL trunk so that 0 as a floating point value can be used as a valid value for -fl
Le mercredi 01 décembre 2010 05:44:09, Ole Nielsen a écrit : > Thanks for explaining the reason why the numeric value of 0.00 doesn't work > as a fixed level in gdal_contour while the value of 0 does. I understand > now the reason for this. > However I would have thought one could replace the test for 'zeroness' in > (atof(argv[i+1]) != 0 || EQUAL(argv[i+1], "0")) > with a test for whether argv]i+1] is not empty and can be converted to a > numeric value. This would be a duck-typing approach and more robust in my > humble opinion. > > Best regards > Ole Nielsen > > > -----Original Message----- > From: [email protected] > [mailto:[email protected]] On Behalf Of > [email protected] Sent: Monday, 29 November 2010 8:41 PM > To: [email protected] > Subject: gdal-dev Digest, Vol 78, Issue 64 > > Send gdal-dev mailing list submissions to > [email protected] > > To subscribe or unsubscribe via the World Wide Web, visit > http://lists.osgeo.org/mailman/listinfo/gdal-dev > or, via email, send a message with subject or body 'help' to > [email protected] > > You can reach the person managing the list at > [email protected] > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of gdal-dev digest..." > > > Today's Topics: > > 1. Re: GDAL contouring problem (Frank Warmerdam) > 2. Re: GDAL contouring problem (Francis Markham) > 3. Re: Delete a sqlite database (Ludovic Granjon) > 4. Re: Error building GDAL with GEOS on Solaris (Namrata) > 5. Making non-rectangular image edges transparent > (Just van den Broecke) > 6. geotiff conflict (Julien Malik) > 7. Re: RFC 31 - OGR 64bit Support (David Burken) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Sun, 28 Nov 2010 23:24:56 -0500 > From: Frank Warmerdam <[email protected]> > Subject: Re: [gdal-dev] GDAL contouring problem > To: Ole Nielsen <[email protected]> > Cc: "[email protected]" <[email protected]>, > "[email protected]" <[email protected]> > Message-ID: <[email protected]> > Content-Type: text/plain; charset=ISO-8859-1; format=flowed > > Ole Nielsen wrote: > > I am posting this again without test files attached due the 50K size > > limit. Anyone who wants to see them, please contact me directly. > > > > > > > > -- > > > > We have observed interesting anomaly with gdal_contour when one of the > > fixed levels is zero. > > > > If the zero contour is expressed as 0.0 (or indeed 0.0000) gdal_contour > > replies with the standard Usage message (see below). If the zero contour > > is expressed as the integer 0 (or 0.00000001) it works and produces the > > expected contours. > > Ole, > > The gdal_contour program has some rather hokey heuristics to try and > recognise the end of the list of contour levels. The code looks like: > > else if( EQUAL(argv[i],"-fl") && i < argc-1 ) > { > while( i < argc-1 > && nFixedLevelCount > < > (int)(sizeof(adfFixedLevels)/sizeof(double)) && (atof(argv[i+1]) != 0 || > EQUAL(argv[i+1],"0")) && !EQUAL(argv[i+1], "-3d")) > adfFixedLevels[nFixedLevelCount++] = atof(argv[++i]); > } > > So basically, it assumes everything is a "level" until something that > has a numeric value of 0 is encounter that isn't the specific string > "0". So your analysis of the problem is essentially correct, but it is > more or less intentional as we try to support a list of levels with no > explicit "end of list" marker in the arguments to the command. > > Best regards, > -- > ---------------------------------------+----------------------------------- > --- I set the clouds in motion - turn up | Frank Warmerdam, > [email protected] light and sound - activate the windows | > http://pobox.com/~warmerdam and watch the world go round - Rush | > Geospatial Programmer for Rent > > > > ------------------------------ > > Message: 2 > Date: Mon, 29 Nov 2010 16:48:56 +1100 > From: Francis Markham <[email protected]> > Subject: Re: [gdal-dev] GDAL contouring problem > To: Frank Warmerdam <[email protected]> > Cc: "[email protected]" <[email protected]>, Ole Nielsen > <[email protected]>, "[email protected]" <[email protected]> > Message-ID: > <[email protected]> > Content-Type: text/plain; charset=ISO-8859-1 > > Is there any reason not to include a heuristic that uses strtod() or > similar to test for the zeroness of the last argument? > > -Francis Markham > > On 29 November 2010 15:24, Frank Warmerdam <[email protected]> wrote: > > Ole Nielsen wrote: > >> I am posting this again without test files attached due the 50K size > >> limit. Anyone who wants to see them, please contact me directly. > >> > >> > >> -- > >> > >> We have observed interesting anomaly with gdal_contour when one of the > >> fixed levels is zero. > >> > >> If the zero contour is expressed as 0.0 (or indeed 0.0000) gdal_contour > >> replies with the standard Usage message (see below). If the zero contour > >> is expressed as the integer 0 (or 0.00000001) it works and produces the > >> expected contours. > > > > Ole, > > > > The gdal_contour program has some rather hokey heuristics to try and > > recognise the end of the list of contour levels. ?The code looks like: > > > > ? ? ? ?else if( EQUAL(argv[i],"-fl") && i < argc-1 ) > > ? ? ? ?{ > > ? ? ? ? ? ?while( i < argc-1 > > ? ? ? ? ? ? ? ? ? && nFixedLevelCount > > ? ? ? ? ? ? ? ? ? ? ? ? ? ? < > > (int)(sizeof(adfFixedLevels)/sizeof(double)) ? ? ? ? ? ? ? ? ? && > > (atof(argv[i+1]) != 0 || EQUAL(argv[i+1],"0")) ? ? ? ? ? ? ? ? ? && > > !EQUAL(argv[i+1], "-3d")) > > ? ? ? ? ? ? ? ?adfFixedLevels[nFixedLevelCount++] = atof(argv[++i]); > > ? ? ? ?} > > > > So basically, it assumes everything is a "level" until something that > > has a numeric value of 0 is encounter that isn't the specific string > > "0". ?So your analysis of the problem is essentially correct, but it is > > more or less intentional as we try to support a list of levels with no > > explicit "end of list" marker in the arguments to the command. > > > > Best regards, > > -- > > ---------------------------------------+--------------------------------- > > ----- I set the clouds in motion - turn up ? | Frank Warmerdam, > > [email protected] > > light and sound - activate the windows | http://pobox.com/~warmerdam > > and watch the world go round - Rush ? ?| Geospatial Programmer for Rent > > > > _______________________________________________ > > gdal-dev mailing list > > [email protected] > > http://lists.osgeo.org/mailman/listinfo/gdal-dev > > _______________________________________________ > gdal-dev mailing list > [email protected] > http://lists.osgeo.org/mailman/listinfo/gdal-dev _______________________________________________ gdal-dev mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/gdal-dev
