[gdal-dev] strange output in reading points of linear ring

Frank Warmerdam warmerdam at pobox.com
Fri Jan 28 11:07:09 EST 2011


On 11-01-28 10:57 AM, Mohammed Rashad wrote:
>     OGRPolygon *polygon = (OGRPolygon *) poGeometry;
>
>
>              OGRLinearRing  *extring = polygon->getExteriorRing();
>                  for(int i=0;i<extring->getNumPoints();i++)
>                  {
>                           cout << extring->getX(i) << ":::::" <<
> extring->getY(i) << endl;
>                   }
...
> -240802:::::2.80936e+06
>
> ................................
> .................
> ......
> -240802:::::2.80936e+06 how to get rid of e+06 and convert it to double

Rashad,

That is a c++ stream's formatting question, not a gdal-dev question.  I
would suggest you review the formatting options for the stream class:

   http://www.cplusplus.com/reference/iostream/ostream/

In particular pay attention to the "field width" and "display precision"
values.  Also I see something about scientific vs. fixed format in the setf()
method:

   http://www.cplusplus.com/reference/iostream/ios_base/setf/

Personally I hate the way formatting works with the C++ stream classes
but I'm very old fashioned.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent



More information about the gdal-dev mailing list