1

I use the great approach to large rasters as described here

gdaltindex an_index.shp *.tif
ogr2ogr -f CSV list.csv an_index.shp -spat xmin ymin xmax ymax
gdalbuildvrt -input_file_list list.csv mosaic.vrt
r.external input=/path/to/mosaic.vrt output=mosaic

the resulting list.csv file contains correct paths, but the first line is "location,". It is skipped when vrt file is build, but can I get rid of this line while creating the list.csv?

Grass version is GRASS 7.8.7 (2022)

2
  • 1
    Which approach do you try precisely? I don't fully get the problem.
    – markusN
    Commented May 25, 2023 at 22:41
  • Sorry, it was a wrong link. I updated the post. Commented May 26, 2023 at 7:45

1 Answer 1

0

You can output CSV to stdout using /vsistdout/ and remove first line with sed or another tool (e.g https://www.baeldung.com/linux/remove-first-line-text-file).

ogr2ogr -f CSV /vsistdout/ an_index.shp -spat xmin ymin xmax ymax >| sed '1d' list.csv

The other way would be to keep the same command and add one command to clean the CSV file.

ogr2ogr -f CSV list.csv an_index.shp -spat xmin ymin xmax ymax
sed -i '1d' list.csv

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.