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

2011-01-28 Thread Mohammed Rashad
   OGRPolygon *polygon = (OGRPolygon *) poGeometry;



OGRLinearRing  *extring = polygon->getExteriorRing();
for(int i=0;igetNumPoints();i++)
{
 cout << extring->getX(i) << ":" <<
extring->getY(i) << endl;
 }

the shapefile is in UTM projection
the above said code gives me error . here is the output

..
.
.

-269341:2.7739e+06
-270188:2.77958e+06
-267595:2.78341e+06
-266748:2.78775e+06
-265868:2.78773e+06
-262193:2.78899e+06
-260416:2.79265e+06
-258088:2.79378e+06
-257291:2.79542e+06
-257241:2.79553e+06
-256359:2.79637e+06
-254724:2.79808e+06
-253177:2.79897e+06
-252022:2.79541e+06
-252103:2.79144e+06
-248101:2.79034e+06
-246005:2.79466e+06
-244207:2.79732e+06
-240802:2.79897e+06
-238885:2.80189e+06
-239955:2.80502e+06
-240802:2.80936e+06


.
..
-240802:2.80936e+06 how to get rid of e+06 and convert it to double
-- 
Rashad
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

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

2011-01-28 Thread Frank Warmerdam

On 11-01-28 10:57 AM, Mohammed Rashad wrote:

OGRPolygon *polygon = (OGRPolygon *) poGeometry;


 OGRLinearRing  *extring = polygon->getExteriorRing();
 for(int i=0;igetNumPoints();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, warmer...@pobox.com
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
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev