Opened 6 years ago

Closed 6 years 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 by Jukka Rahkonen, 6 years ago

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 by Even Rouault, 6 years ago

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

comment:3 by Even Rouault, 6 years ago

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 by aharfoot, 6 years ago

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

comment:5 by Even Rouault, 6 years ago

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

comment:6 by Even Rouault, 6 years ago

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