Hi Joaquim,

Interesting. Thanks for sharing. As always with OpenSource there are more solutions than just one ;-)

Yes, I am aware about the missing data in the lower right corner - this is outside of the province and outside of my area of interest.

Thanks and greetings,

Andreas


On 11.09.2017 16:45, Joaquim Luis wrote:
You could have done it with GMT as well

gmtinfo DTM_swissALTI3D_XYZ.txt -I2
-R2708001/2717999/1210001/1219999

xyz2grd -R2708001/2717999/1210001/1219999 -I2 -GDTM_swissALTI3D_XYZ.grd DTM_swissALTI3D_XYZ.txt

and you get a netCDF grid (it can do GeoTIFs too but would need to go see the docs)

The grid misses a tile of data at the lower right corner

Joaquim

    Hi Mark (and others),

    Your sort command worked like a charm. It was also very fast!

    Now gdalinfo produces this nice information output:

    Driver: XYZ/ASCII Gridded XYZ
    Files: dtmav_sorted.xyz
    Size is 5000, 5000
    Coordinate System is `'
    Origin = (2708000.000000000000000,1210000.000000000000000)
    Pixel Size = (2.000000000000000,2.000000000000000)
    Corner Coordinates:
    Upper Left  ( 2708000.000, 1210000.000)
    Lower Left  ( 2708000.000, 1220000.000)
    Upper Right ( 2718000.000, 1210000.000)
    Lower Right ( 2718000.000, 1220000.000)
    Center      ( 2713000.000, 1215000.000)
    Band 1 Block=5000x1 Type=Float32, ColorInterp=Undefined
      Min=728.210 Max=2294.290
      NoData Value=0

    Now I can open this in QGIS as a normal data source and simply
    safe as a GeoTIFF file.

    Thanks a lot to all who answered so quickly!

    Glad that a simple sort command on the command line helped to
    solve the issue! I will contact the data provider and ask them if
    they could deliver this data in an already sorted form so that
    GDAL recognizes it as gridded data.

    Andreas


    On 11.09.2017 16:12, Mark Johnson wrote:
    You must sort the data beforehand
    - the y position must be sorted properly (ASC or DESC)

    Standard linux sort program:

    sort -k2 -n -k1 392_5810.xyz <http://392_5810.xyz> -o
    392_5810.sort.xyz <http://392_5810.sort.xyz>

    (2nd column (y) as numeric, then first column (x) -o = output file

    As a zip file you can also do:

    unzip -p 390_5820.zip | sort -k2 -n -k1 -o ../xyz/390_5820.dhhn92.txt

    that would deal with problem in 1 step.

    ogr needs to know the range/area to build (minx,miny,maxx, maxy),
    so when the y switches it assumes a new column.

    Mark


    _______________________________________________
    gdal-dev mailing list
    [email protected]
    https://lists.osgeo.org/mailman/listinfo/gdal-dev





_______________________________________________
gdal-dev mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to