I have list of many XYZ files with points without header an space delimited.
Example:
-877500 -1014000 471.95 -877500 -1013995 472.28 -877500 -1013990 472.61 -877500 -1013985 473.04 -877500 -1013980 473.39
I would like to merge all files into one QGIS point layer. I was trying this tutorial and no luck with Python. Anyway it doesn't describe working with CSV files as I have trouble defining sole VRT with custom delimiter. I couldn't find definitions for them in VRT driver neither CSV driver.
When trying ogrinfo
with .xyz file couldn't read the file. If I change the extension to .csv it reads without trouble. I was not aware that <OGRVRTLayer name=" ">
has to be the same as CSV file without extension. Finally I managed to combine files with suggestions from comments and using this code:
<OGRVRTDataSource>
<OGRVRTLayer name="merged">
<SrcDataSource relativeToVRT=1>merged.csv</SrcDataSource>
<GeometryType>wkbPoint</GeometryType>
<LayerSRS>EPSG:5514</LayerSRS>
<GeometryField encoding="PointFromColumns" x="field_1" y="field_2" z="field_3"/>
<Field name="x" type="Integer" src="field_1" />
<Field name="y" type="Integer" src="field_2" />
<Field name="z" type="Real" src="field_3" />
</OGRVRTLayer>
</OGRVRTDataSource>
The driver will also accept a semicolon, a tabulation or a space character as field separator
from gdal.org/drivers/vector/csv.htmlogrinfo
fro VRT I getWarning 1: Value '→' of field merged.x parsed incompletely to integer 0. Extent: (-877500.000000, -1020000.000000) - (0.000000, 0.000000)
with wrong extent. I don't know where the arrow character comes from.