GDAL supports a mask layer, but it also supports a "no data" colour which I tend to use because it cuts the size of the final image down by 25%. So the steps I would use with your data, after cutting off the collar is:
gdal_translate -expand rgb -gcp <pixel/coordinate pairs> -co TILED=YES -a_srs <EPSG code for the map's projection> -a_nodata 255 255 255 original.tif translated.tif
Note, I've put in Ground Control Points (GCPs) and a projection which you'll have to determine empirically. Also note I've assigned pure white to the nodata value.
These images are still not properly georeferenced however, as they still only have GCPs rather than proper coordinates. So you will need to run gdalwarp
:
gdalwarp -t_srs EPSG:4326 -co TILED=YES -srcnodata 255 255 255 -dstnodata 255 255 255 translated.tif warped.tif
Note again the explicit setting of the nodata values. This is probably overkill, but it doesn't hurt, and I've had gdalwarp
ignore what I thought was implicit nodata vales.
Next, you need to run gdalbuildvrt
like you have it, but I usually explicitly specify the nodata values again, to be on the safe side:
gdalbuildvrt -srcnodata 255 255 255 -vrtnodata 255 255 255 temp.vrt <warped files>.tif
Edit
This may be closer to what you want:
gdalbuildvrt -srcnodata 255 255 255 -hidenodata temp.vrt <warped files>.tif
Finally, you can call gdal2tiles.py
as you have it.
Your VRT is a vector dataset. gdal_translate
is used to convert between raster formats not from vector to raster.
Instead, you can use:
ogr2ogr
to output a shapefile or other vector format,
- QGIS Processing toolbox | GDAL | Vector Conversion | Convert format
gdal_rasterize
to burn the points to a tiff, or
- QGIS Processing toolbox | GDAL | Vector Conversion | Rasterize
gdal_grid
to interpolate the points to a surface raster (I noticed some elevation fields in your VRT).
- QGIS Processing toolbox | GDAL | Raster Analysis | Grid (*)
If the underlying CSV file is meant to be a raster dataset in XYZ format, gdal/QGIS should be able to read it directly as a raster if you drop the additional fields and just keep the "pnt_lon", "pnt_lat" and "pnt_height" (OR "pnt_demheight" but not both), sorted by lat then by lon. You could then use gdal_translate xyz.csv out.tif
GDAL supports reading and writing ASCII gridded XYZ raster datasets (i.e. ungridded XYZ, LIDAR XYZ etc. must be opened by other means. See the documentation of the gdal_grid utility).
Those datasets are ASCII files with (at least) 3 columns, each line
containing the X and Y coordinates of the center of the cell and the
value of the cell.
The spacing between each cell must be constant and no missing value is
supported. Cells with same Y coordinates must be placed on consecutive
lines. For a same Y coordinate value, the lines in the dataset must be
organized by increasing X values. The value of the Y coordinate can
increase or decrease however. The supported column separators are
space, comma, semicolon and tabulations.
The driver tries to autodetect an header line and will look for 'x',
'lon' or 'east' names to detect the index of the X column, 'y', 'lat'
or 'north' for the Y column and 'z', 'alt' or 'height' for the Z
column. If no header is present or one of the column could not be
identified in the header, the X, Y and Z columns (in that order) are
assumed to be the first 3 columns of each line.
Best Answer
No, you need to use gdalbuildvrt The instructions on the page are pretty clear, but to save you a mouse click, one of the examples is: