12
votes
Accepted
Displaying GeoTIFF file in Python
Yes. It is just an issue related with the parameters. Without vmin and vmax, matplotlib uses nodata value as minimum value, and stretches the color map.
So, you need to specify min and max value:
...
8
votes
Accepted
Transform tif file to shapefile to get outer contour of area
Use the raster calculator to divide the raster by itself to create an output raster with 1 where there's data
Then polygonize the output raster:
6
votes
Accepted
Converting PNG to GeoTIFF using GDAL Python
I'm assuming that your PNG file doesn't have geolocation information embedded but you know what the corners of the data. I think you just had the wrong option for gdal.Translate. Check this out using ...
6
votes
Accepted
Where and what kind of information is geographic information stored in satellite images?
The definition of the TIFF file format allows for the storage of metadata in the file with the actual image data. This could be used by photographers for example, to store the exposure and aperture ...
5
votes
Accepted
How to convert GeoJSON to GeoTIFF
With the command line, https://gdal.org/programs/gdal_rasterize.html
With Python, you can use gdal.RasterizeLayer like in the tests from GDAL e.g https://github.com/OSGeo/gdal/blob/master/autotest/alg/...
5
votes
Accepted
Looking for QGIS equivalent of ArcGIS "Delete Colormap" tool
I did not find ready made tool for that. Could be a good option to add into gdal_edit.py.
Meanwhile you can remove the colortable with GDAL and Python. Writing an empty colortable seems to effect like ...
5
votes
Displaying GeoTIFF file in Python
Following the comment from @mikewatt, when you imported with rasterio you kept the fill/nodata values (in your case, -3.4e+38) in the raster. This throws off the scale for imshow such that you can't ...
4
votes
How to convert GeoTiff to PNG + World file in QGIS
Clearly do not know exactly how to proceed in QGIS but with GDAL command line utility gdal_translate, just need to do
gdal_translate -of PNG -scale -co "WORLDFILE=YES" input.tif output.png
...
4
votes
How to speed up the rendering time to display drone-derived orthophoto in QGIS
You need create overviews/pyramids.
You can create them within QGIS in Layer properties / Pyramids. Make sure to use external format to avoid messing up your carefully created, already huge TIFF.
That ...
4
votes
Accepted
Type error for gdal- GDAL-style transforms have been deprecated
Use the Affine.from_gdal method to convert any existing GDAL-style transforms:
from affine import Affine
transf = (583932.1992386435, 10.0, 0, 2223772.1491772938, 0, -10.0)
afn = Affine.from_gdal(*...
4
votes
Accepted
gdalinfo on partial GeoTIFF file
The TIFF metadata can indeed be spread in many places. Especially if you create overviews with gdaladdo the overviews and corresponding metadata are always written close to the end of the TIFF file.
...
4
votes
Opening .tif and .tfw in QGIS
Normally, QGIS will automatically find .tfw and draw the raster on its correct coordinates. If not, you need to search for the tool assign projection. Then set the raster to your desired coordinate ...
4
votes
Accepted
Is TFW file not enough to place a TIFF data in the correct location?
No. It isn't. You need to know crs of the data. Considering that you are working on Istanbul and that Easting and Northing of the upper values are 406443.06 and 4545334.18, the crs of the raster must ...
4
votes
Accepted
Empty data points in DEM in QGIS
Try the GDAL "Fill nodata" utility under Raster --> Analysis.
Documentation on the tool can be read here.
4
votes
Accepted
Create colour-coded raster from timeseries of binary GeoTIFFs based on date of pixel change
In Python, numpy can do this for you with a few lines of code.
import numpy as np
import rioxarray as rxr
# Read the raster files
raster_1 = rxr.open_rasterio('file.tif')
...
raster_k = rxr....
3
votes
Opening .tif drone photo in QGIS problem
Welcome to SE GIS! It appears that your .tif is a multiband image (confirm by reviewing your .tif's Layer Properties).
I can recreate your problem with a sample multiband image, as follows. Using ...
3
votes
Accepted
Extract pixels data from GeoTIFF
You don't say what kind of format you want to use (ASCII? Binary?). There are some standard formats that are quite simple to convert to using the GDAL command line utilities. For example to convert a ...
3
votes
Looking for QGIS equivalent of ArcGIS "Shift" tool
Besides the already existing answers, it can be done with gdal_translate, using the command line option a_ullr (see documentation).
With a_ullr you can specify the new upper-left and lower-right ...
3
votes
Accepted
PDF to TIFF tool not displaying image on ArcMap
This warning is triggered when the input PDF does not have any spatial context.
For example, if we use a PDF that was created using a GIS platform with some spatial association, the conversion will be ...
3
votes
Accepted
How to read the wavelength of each channel in a UAV .tif image
What you're looking for is the metadata of the raster. I prefer GDAL's command line tool gdalinfo, which is really good when you know all the rasters have the same metadata:
gdalinfo UAV.tif
If you ...
3
votes
Accepted
Calculations with .tif images using matplotlib or rasterio
If georeferencing is not important to you, you can simply do it with matplotlib.
import matplotlib.pyplot as plt
red = plt.imread('path/to/Red_channel.tif')
blue = plt.imread('path/to/Blue_channel....
3
votes
Accepted
How to read .tif image coordinates with Python
Rasterio would be an easy choice to get the information you need via Python. This code gets the bounding geometry of a geotiff.
import rasterio
dataset = rasterio.open('/home/gerry/Drone/MedTest/...
3
votes
Including own transformation file in QGIS 3.20
A bit of theory
The NTv2 (National Transformation version 2) shift intended to facilitate the transformation between datums. It can be achieved by means of a grid file (encapsulates the shift values ...
3
votes
"ValueError: negative dimensions are not allowed" when using raster created from NetCDF
Actually, it's related to a positive number, the y pixel dimension should be negative (pixel coords are top->bottom, but map coords are bottom->top), but it isn't. This is why a negative ...
3
votes
Accepted
Georeference a JPEG image knowing some random x,y point geocoordinates and CRS
You can add some ground control points (GCPs) and use GDAL to figure out the extent of the file and so on.
You should do this on a copy of your original file in case you screw things up, and I assume ...
3
votes
Accepted
Lowering GeoTIFF raster by fixed value using QGIS
Here are some instructions on using the raster calculator. All you would need to do is subtract 23 from your existing layer (assuming your elevation values are in meters) or 75if the units of measure ...
3
votes
Can I modify a GeoTIFF in Photoshop without losing the GIS data?
GIMP supports GeoTIFF tags since version 2.10.24
https://www.gimp.org/news/2021/03/29/gimp-2-10-24-released/
GeoTIFF metadata support (georeferencing information embedded within a
TIFF file used by ...
3
votes
Accepted
Raster Menu disappeared in QGIS 3.22.3 on Win10
Check if the Processing Extension is activated:
Plugins -> Manage and Install Plugins -> Installed
look for "Processing" and check if it's enabled
3
votes
Accepted
Finding the most frequent value in a GeoTIFF
You can use QGIS with gdal and numpy libraries:
import numpy as np
from osgeo import gdal
ds = gdal.Open(r"/home/bera/GIS/Segmentering_test/B02_clipped.tif")
band1 = np.array(ds....
3
votes
Converting PNG to GeoTIFF using GDAL Python
I know that the OP specifically asked for a gdal solution but may I offer another solution that works better for me ?
Here I'm using the rasterIo lib (available on both pipy and conda) to read the png,...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
geotiff-tiff × 1922gdal × 524
qgis × 365
raster × 352
python × 272
arcgis-desktop × 156
geoserver × 133
coordinate-system × 126
gdal-translate × 95
r × 89
georeferencing × 78
gdalwarp × 77
rasterio × 71
convert × 70
export × 60
dem × 59
arcmap × 58
geotools × 53
shapefile × 45
arcpy × 42
google-earth-engine × 38
netcdf × 38
wms × 36
java × 36
tiles × 35