Friday, 26 February 2016

Following symbolic links in QGIS to load data on Linux?



Can QGIS 2.4 follow Linux soft links?


I want to add a number of raster layers from a store of NED30m elevation data, and thought I'd do it by creating a collection of softlinks in one directory to the elevation files nested in the store.


However, when I try to add a layer from one of the links, QGIS 2.4 complains:



Raster layer: somepath/elev_ned30m_links/n46w105.adf is not a supported raster data source



However, n46w105.adf is the result of a linux ln -s command:



ln -s /Mapstore/ned30m/grid/n46w105_1/w001001.adf




QGIS will open w001001.adf just fine if approached directly, but that means digging down into each tile's directory structure, while the softlinks can be created programmatically with a script.



Answer



Yes QGIS can follow symbolic links.


However, an ArcGIS Grid coverage can't be linked like that, the raster data is not just the .adf file, it is a directory of related files stored in a parent directory (workspace) with an INFO directory and you can not change either the directory structure or the .adf filename (both of which you did with the ln -s command), see format description:


structure


However, you have another option...


Use your script to create VRT headers pointing to the Grid .adf files and store them in a single directory. Replace the bit in your script that does the ln -s ... with


gdal_translate -of VRT /absolute/path/to/wNNNN.adf /absolute/path/to/vrt/directory/someraster.vrt

Alternatively, if you wish to mosaic the GRIDS, create a textfile with the paths of all the GRIDs (either /path/to/GRID folder path or /path/to/GRID/w001001.adf file path) and then use



gdalbuildvrt -input_file_list /path/to/gridlist.txt your_new_mosaic.vrt

No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...