[GRASS-dev] r.in.gdal fp precision loss

Markus Metz markus.metz.giswork at gmail.com
Tue Apr 9 10:19:46 PDT 2013


On Mon, Apr 8, 2013 at 11:58 AM, Glynn Clements
<glynn at gclements.plus.com> wrote:
>
> Markus Metz wrote:
>
>> I think I understand. If the largest values are in the range of 2^6 -
>> 2^7, the ULP would have a magnitude of 2^-17 ~= 7.629395e-06?
>
> Yes.
>
>> I am
>> asking because lately I observed slightly corrupted vector coordinates
>> in shapefiles created with recent ESRI software and suspect
>> float-double conversion artifacts. For latlon coordinates, the largest
>> values are in the range of 2^6 - 2^8, depending on the longitude.
>> v.in.ogr could then, based on the largest coordinate values, suggest a
>> threshold for snapping if topological errors are encountered.
>
> If cartographic projections or datum transformations are involved,
> there are likely to be more significant issues than floating-point
> rounding errors.

Yes, but I would like to suggest a method to fix at least
floating-point rounding errors, wherever they come from. I managed to
remove errors importing various shapefiles by using a snapping
threshold that is close to your ULP calculation.

v.in.ogr can not fix errors introduced by cartographic projections or
datum transformations. In this case, different mechanisms (software)
need to be used to perform cartographic projections or datum
transformations prior to import into GRASS (or do cartographic
projections or datum transformations in GRASS).

Markus M

>
> The main problem is that, for a non-affine transformation, the
> transformation of a line between two endpoints isn't the same as the
> line between the transformed endpoints.
>
> So e.g. if you have points A, B, and C, where C lies exactly on the
> line AB, transforming the points to A', B', and C' typically won't
> result in C' lying on the line A'B'.
>
> --
> Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list