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
