[gdal-dev] Why does OGREnvelope default to valid values when uninitialized?
Vautour, André (INT)
Andre.Vautour at Teledyne.com
Tue Mar 21 05:14:52 PDT 2017
Hi all,
We've recently updated from GDAL 1.11.x to GDAL 2.1.x and ran into some failing unit tests.
I can simplify the failure to:
OGRPoint aPoint(0.0, 0.0);
OGRPoint anotherPoint(1.0, 1.0);
OGRMultiPoint multiPoint;
multiPoint.addGeometry(&aPoint);
multiPoint.addGeometry(&anotherPoint);
OGREnvelope envelope;
multiPoint.getEnvelope(&envelope);
The minx/miny are both 1.0, when I would have expected them to be 0.0.
Looks like OGRGeometryCollection::getEnvelope was updated to make use of OGREnvelope3D::Merge() during the curve geometry work. From what I can tell, the envelope of the 0.0, 0.0 point is seen as uninitialized since OGREnvelope::IsInit() returns false in that case.
Would it make sense to have the uninitialized envelope values be outside the range of typical coordinate reference systems to avoid such problems? Something like std::numeric_limits<double>::max().
Kind Regards,
André
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20170321/6980fd30/attachment-0001.html>
More information about the gdal-dev
mailing list