Op 13-01-2021 om 16:48 schreef Lorenzo Di Giacomo:
Hello, i noticed that when i read an tiff image (using GeoTiffReader), the GridCoverage2D has a GeneralEnvelope that is not precise.

Image extension: 6.9999999999999991,35.9999999999999929 : 18.0000000000000000,47.0000000000000000

Grid General Envelope: GeneralEnvelope[(6.999999999999999, 36.0),(18.0, 47.0)]

Why is this happening?

GeneralEnvelope uses a double array internally, see https://github.com/geotools/geotools/blob/24e2b886c85f4f8878c9f437ce59e16eb4f1d124/modules/library/referencing/src/main/java/org/geotools/geometry/GeneralEnvelope.java#L71-L78 so it is never exact/precise, what you are seeing is how floating point numbers behave in a computer.

And why only on the Latitude and not on longitude?

sheer luck I guess, it may be different when the weather changes.

BTW. your question is better suited for the GeoTools users list <geotools-gt2-us...@lists.sourceforge.net>.

-
Mark



_______________________________________________
GeoTools-Devel mailing list
GeoTools-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to