Opened 2 months ago

Closed 2 months ago

#7261 closed defect (fixed)

GDAL XYZ Driver not recognising header field names

Reported by: aharfoot Owned by: warmerdam
Priority: normal Milestone: 2.3.0
Component: Utilities Version: 2.2.3
Severity: normal Keywords:
Cc:

Description

I'm trying to translate gridded XYZ data files into GeoTIFFs using gdal_translate. The files do not have the data in the conventional X,Y,Z order however (it's Y,X,-,-,-,-,Z), and to avoid having to reorder columns I hoped to use the header parsing functionality documented here http://www.gdal.org/frmt_xyz.html

I have tried the data file with TAB, space and comma separators, and all three of the suggested column name variants, but the output of gdalinfo and gdal_translate suggests that GDAL is ignoring the header row and assuming a XYZ column order in each case.

I am using GDAL 2.23 installed through the OSGeo4W package installer, on Win10 x64.

Change History (6)

comment:1 Changed 2 months ago by Jukka Rahkonen

I had a try with these minimal files with one space as a separator:

30 59 2
31 59 3
30 60 3
30 61 4
y x z
59 30 2
59 31 3
60 30 3
61 30 4

In both cases gdalinfo gives the same result so it does seem to me that the header line is read and used correctly.

Gdal-dev mailing list is the primary forum for questions but if you can provide with test data that does not behave correctly you can add that as an attachment to this ticket.

comment:2 Changed 2 months ago by Even Rouault

Apparently the issue is if you have non-numeric values in the columns that are ignored

comment:3 Changed 2 months ago by Even Rouault

Following is OK

Y X - Z
3751290 440750 0 107
3751290 440810 0 123
3751230 440750 0 115
3751230 440810 0 132

but following is not

Y X - Z
3751290 440750 x 107
3751290 440810 0 123
3751230 440750 0 115
3751230 440810 0 132

comment:4 Changed 2 months ago by aharfoot

That makes sense, the ignored columns are numeric, but have 'NaN' values (which have just tripped me up whilst scripting a workaround!)

comment:5 Changed 2 months ago by Even Rouault

I've a patch fixing this. Waiting for the github migration to commit it

comment:6 Changed 2 months ago by Even Rouault

Milestone: 2.3.0
Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.