[gdal-dev] Bad values when reading GCPs from a VRT file with gdalinfo in GDAL 3.8.3

Rahkonen Jukka jukka.rahkonen at maanmittauslaitos.fi
Thu Jan 25 05:37:14 PST 2024


Hi,

Certainly, consistent behavior is expected but I did not notice that your VRT was created with GDAL.
I edited your vrt a bit:
<GCP Id="0" Pixel="0.0000" Line="0.0000" X="FIN" Y="FIN" Z="-FIN" />
and with gdalinfo I seem to get still the same
GCP[  0]: Id=0, Info=
          (0,0) -> (0,0,0)

And I tried also this:
gdal_translate -gcp 0 0 fin fin test.tif inftest.tif

gdalinfo inftest.tif
GCP[  0]: Id=1, Info=
          (0,0) -> (0,0,0)

Now perhaps GDAL could inform that “FIN” and “fin” are not valid double values, but on the other hand, I think that I have also some influence on the wrong behavior. But the issue with INF/inf seems to be fixed now by Even.

-Jukka Rahkonen-

Lähettäjä: Pierluigi Guasqui <guasqui at actgate.com>
Lähetetty: torstai 25. tammikuuta 2024 15.04
Vastaanottaja: Rahkonen Jukka <jukka.rahkonen at maanmittauslaitos.fi>
Aihe: Re: [gdal-dev] Bad values when reading GCPs from a VRT file with gdalinfo in GDAL 3.8.3

Jukka,

it is not documented but I expect GDAL to be consistent with itself. If I set GCP (0, 0, inf, inf, -inf) with GDAL I would expect to read the same values with GDAL.

Pierluigi

On Thu, Jan 25, 2024 at 1:24 PM Rahkonen Jukka <jukka.rahkonen at maanmittauslaitos.fi<mailto:jukka.rahkonen at maanmittauslaitos.fi>> wrote:
Hi,

I guessed so. Is that your own invention or is it documented somewhere that undefined GCPs should be marked that way by using INF? I ask because if it is something that should be reliable then I may have use for that feature in the future.

Problem may be limited to vrt. This test seems to pass
gdal_translate -gcp 0 0 inf inf test.tif inftest.tif

gdalinfo inftest.tif
…
GCP[  0]: Id=1, Info=
          (0,0) -> (inf,inf,0)

-Jukka Rahkonen-

Lähettäjä: Pierluigi Guasqui <guasqui at actgate.com<mailto:guasqui at actgate.com>>
Lähetetty: torstai 25. tammikuuta 2024 14.16
Vastaanottaja: Rahkonen Jukka <jukka.rahkonen at maanmittauslaitos.fi<mailto:jukka.rahkonen at maanmittauslaitos.fi>>
Aihe: Re: [gdal-dev] Bad values when reading GCPs from a VRT file with gdalinfo in GDAL 3.8.3

Hello Jukka,

in general using infinite values is to mark undefined or invalid GCPs.

Pierluigi

On Thu, Jan 25, 2024 at 12:44 PM Rahkonen Jukka <jukka.rahkonen at maanmittauslaitos.fi<mailto:jukka.rahkonen at maanmittauslaitos.fi>> wrote:
Hi,

Out of curiosity, what is the purpose of using inf or -inf as values? Is it to use them as placeholders telling that you do not know yet what the georeferenced coordinates of the ground control points are?

-Jukka Rahkonen-

Lähettäjä: gdal-dev <gdal-dev-bounces at lists.osgeo.org<mailto:gdal-dev-bounces at lists.osgeo.org>> Puolesta Pierluigi Guasqui via gdal-dev
Lähetetty: torstai 25. tammikuuta 2024 13.34
Vastaanottaja: gdal-dev at lists.osgeo.org<mailto:gdal-dev at lists.osgeo.org>
Aihe: [gdal-dev] Bad values when reading GCPs from a VRT file with gdalinfo in GDAL 3.8.3

Dear GDAL team,

I am using GDAL version 3.8.3 and I am trying to extract GCPs values with gdalinfo tool from a VRT file (attached).

As you can see by looking at the VRT file with a text editor GCP XYZ values are infinite values. When I read GCPs from the attached VRT file with gdalinfo (latest version GDAL v. 3.8.3) I am getting all zeros:

GCP[  0]: Id=0, Info=
          (0,0) -> (0,0,0)

Instead, if I use gdalinfo (GDAL v. 3.6.3) I am getting the correct values:

GCP[  0]: Id=0, Info=
          (0,0) -> (inf,inf,-inf)

Is this a bug with GDAL 3.8.3?

Thank you for your help!

--
Pierluigi Guasqui
Software Engineer

Applied Coherent Technology Corporation (ACT)
www.actgate.com<http://www.actgate.com/>


--
Pierluigi Guasqui
Software Engineer

Applied Coherent Technology Corporation (ACT)
www.actgate.com<http://www.actgate.com/>


--
Pierluigi Guasqui
Software Engineer

Applied Coherent Technology Corporation (ACT)
www.actgate.com<http://www.actgate.com/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20240125/f2298a00/attachment-0001.htm>


More information about the gdal-dev mailing list