New answers tagged

2

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 ...


1

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 = ...


1

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 ...


1

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) with rasterio.open( resPath, 'w', driver='GTiff', width=500, height=300, count=1, dtype=tile.dtype, ...


1

I got the information from here that gdal 3.0.2 does not yet include the "fast overviews for big TIFF" feature It will be included in the 3.1 version


0

You could also use rioxarray. The most useful examples for your use case are: clip reproject_match import rioxarray import fiona # 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 with fiona.open(...


0

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, ...


0

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: import rasterio band_id = 1 # this assumes you want the first band, change to match the band number you want raster = ...


2

I like to use rasterio in python to manipulate metadata tags. Here is a rough example: import rasterio 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' dst_ds.update_tags(**tags) dst_ds.write(src_ds.read()) ...


2

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. Sample script: #set working directory setwd("C:/Path/to/files/") #dependency library(lidR) #read point cloud ...


2

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 ...


2

Your input tif is lossily compressed with JPEG YCBCR which gives much higher compression than lossless LZW. Try "compress": "JPEG", "photometric": "YCBCR" instead.


0

import rasterio from rasterio.warp import calculate_default_transform, reproject, Resampling dst_crs = 'EPSG:4326' with rasterio.open('rasterio/tests/data/RGB.byte.tif') as src: transform, width, height = calculate_default_transform( src.crs, dst_crs, src.width, src.height, *src.bounds) kwargs = src.meta.copy() kwargs.update({ '...


1

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 ...


Top 50 recent answers are included