I've found an answer on the project-page of exiftool itself.
Hereafter, I'll summarize what I found out with the kind help of the page-author Phil Harvey.
To copy all GeoTiff tags from one file to another, do this:
exiftool -tagsfromfile SRCFILE -GeoTiffDirectory -GeoTiffDoubleParams -GeoTiffAsciiParams DSTFILE
That does the trick.
I assume that those ...
I was able to recover the spatial referencing of the original georefernced tif using gdal translate.
import gdal, osr
original = gdal.Open('path to tif') # the original georeferenced tif
in_tif = 'path to watermarked tif' # the one that lost spatial reference
out_tif = 'path to tif to be created' # the georeferenced output tif
rf = ...
gdal_retile -s_srs option sets the source spatial reference system, from your question it is already set as something different. -s_srs is for situations when you know the projection of the data but the data (or associated metadata files) doesn't know or is incorrect. So never use this option if there is a projection set.
If you would like to reproject the ...
It looks like the only piece missing from your write call is a transform:
with rasterio.open(imgPath) as src:
win = Window(1000, 1000, 500, 300)
tile = src.read(1, window=win)
win_transform = src.window_transform(win)
You could also use rioxarray.
The most useful examples for your use case are:
# open the rasters
rds1 = rioxarray.open_rasterio("21_32/LC080210322016072801T1/LC08_L1TP_021032_20160728_20170221_01_T1_sr_band3.tif")
rds2 = rioxarray.open_rasterio("CDL_2018_18.tif")
# clip the rasters
The answer was in the gdal.WarpOptions. The two rasters were aligned and had the same shape after targetAlignedPixels was set as False and an additional argument outputBounds was included (corresponding raster image).
def gdal_reproject(src_path, dist_path, dst_crs, bounds, dst_res=(30, 30), interp=0, align=True):
opt = gdal.WarpOptions(dstSRS=dst_crs,
My understanding is that you want to read in all of the pixel values of a single band so that you access them with x and y values. I would do this by getting the entire band as a numpy array, then use the x and y indices of the array:
band_id = 1 # this assumes you want the first band, change to match the band number you want
raster = ...
I like to use rasterio in python to manipulate metadata tags. Here is a rough example:
with rasterio.open('raster.tif', 'r') as src_ds:
tags = src_ds.tags()
with rasterio.open('newraster.tif', 'w', **src_ds.meta) as dst_ds:
tags['NEWTAG'] = 'NEW VALUE'
You can use cloudcompare or meshroom software to convert the .ply mesh file to a point cloud (.las or .laz).
Once you have it in point cloud format (with normals computed), use a simple script in R to grid and output raster at desired resolution.
#set working directory
#read point cloud
There are a few different ways of doing this using GIS software or scripting/programming, but (in my opinion) the easiest way, requiring no additional software is to use a "world file", which is a secondary file with the same name but a different extension that contains information. It must also be in the same folder as the image file.
Create a file with ...
The main problem I see is that GDAL does not recognize the CRS/Transform information from the dataset. As such, transforming the dataset is not possible as the original information cannot be detected.
So, you need to construct the CRS/Transform yourself.
Step 0: Get the CRS of the dataset
Based on the link you gave, this should be the CRS of the ...