[gdal-dev] Opening gridded xyz data that is out of order
Even Rouault
even.rouault at spatialys.com
Mon Sep 11 07:04:48 PDT 2017
On lundi 11 septembre 2017 15:43:47 CEST Andreas Neumann wrote:
> Hi,
>
> I received a DTM from a Swiss province (OpenData) which is of the
> following format:
>
> One coordinate per line, already gridded. See f.e.
>
> 2708001.00 1218001.00 1541.52
> 2708003.00 1218001.00 1542.35
> 2708005.00 1218001.00 1542.98
> 2708007.00 1218001.00 1543.58
> 2708009.00 1218001.00 1544.20
> 2708011.00 1218001.00 1545.13
> 2708013.00 1218001.00 1545.88
>
> The issue is that further down the file there seems to be an issue of
> ordering the coordinates. gdalinfo produces the following error:
>
> ERROR 1: Ungridded dataset: At line 4125001, change of Y direction
> gdalinfo failed - unable to open 'DTM_swissALTI3D_XYZ.txt'.
Andreas,
the message is probably misleading. It means that from the XYZ point of view, it cannot
handle the dataset since it doesn't match its expectations: ie successive lines with same Y and
constant positive X step, and when changing lines, with a constant positive or negative Y
step. The driver says probably a bit quickly that the dataset is ungridded.
>
> If GDAL could open the data - it would open as ungridded data - right?
> Issue is, this data is already gridded as you can see above. I actually
> want to save this is a gridded GeoTIFF file for later usage in QGIS.
>
> Is there still a chance that GDAL can open this data set, even if
> coordinates are out of order?
Not by the XYZ driver in its current design where it tries to not ingest the full file into
memory. It does a preliminary scan to check that the file organization meets its criteria, but
then reads its progressively efficiently. One could perhaps have a more relaxed mode that
would require more memory and/or be less I/O efficient for datasets such as the one you
tried.
You might try to open this file with the CSV driver and use gdal_grid (with a search radius of 2
since this apparently the horizontal resolution) to produce a GeoTIFF. You might possibly do a
preliminary conversions of the CSV to shapefile with spatial index or GPKG to improve
performance of gdal_grid.
Even
--
Spatialys - Geospatial professional services
http://www.spatialys.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20170911/66abc43a/attachment.html>
More information about the gdal-dev
mailing list