New answers tagged

1 vote
Accepted

Extract shapes and shape data from GeoTIFF using Rasterio and store as GeoJSON

shapes returns an iterable of tuples with geometry and value, you can use geopandas to parse the geometry into a valid geojson. import geopandas as gpd import rasterio from rasterio import features ...
user avatar
  • 52.6k
0 votes

Finding latitude and longitude for pixel values

You could do something like the following which: only reads the data into memory once and as required as it uses dataset.sample() instead of dataset.read() and generators instead of list ...
user avatar
  • 52.6k
1 vote

TIFF file to Google My Maps

The choose a file to import option, suggests CSV, XLSX, KML, or GPX are the only options for imports. KML supports rasters, but the help tells us that: KML files may not import all their data. The ...
user avatar
  • 11.9k
1 vote
Accepted

Make black pixels transparent in GeoTIFF using Python

Use gdal.Warp to make a new file with black as nodata using WarpOptions with kwargs. Here is an example using Python and gdal on Windows. The WarpOptions may be slightly different that the command ...
user avatar
  • 7,172
1 vote

Problem generating GeoTIFF from JPEG using GQIS Georeferencer tool

Alright, so I've finally successfully generated a nice looking GeoTIFF file. I discovered a slightly different tutorial outlining more-or-less the same QGIS process but with a little more detail ...
user avatar
  • 131
0 votes

Using Rasterio or GDAL to stack multiple bands without using subprocess commands

With gdal and numpy the following is possible assuming the images are the same size (rows and columns) and have the same CRS (e.g. 10m bands from a Sentinel 2 scene). import gdal import numpy as np ...
user avatar
  • 1,491
0 votes

Should I use TIFF or PNG Maps

Both PNG and TIF are lossless compression formats so you are not loosing information with either format. See here for a comparison. I see that there is no associated world file for the PNG (the inage ...
user avatar
  • 7,172
1 vote

In gdaldem: NODATA value in GeoTIFF found in earlier version but not recognized in GDAL 3.4.2

As said in a comment, if you have the GDAL Python utilities available it would be best to set the nodata with gdal_edit -a_nodata -32767 Mt_Fuji.tif And if you do not have the Python utilities you ...
user avatar
  • 52.3k
0 votes

Convert TIF file to CSV/ASCII format using QGIS v. 3.24.1-Tisler

In the Processing Toolbox, GDAL >> gdal2xyz.
user avatar
  • 409
1 vote

Convert TIF file to CSV/ASCII format using QGIS v. 3.24.1-Tisler

If you export the raster file to XYZ format in QGIS, it is in fact the CSV (ASCII Gridded - see: https://gdal.org/drivers/raster/xyz.html) - each line contains X, Y and the Z value separated by space (...
user avatar
  • 515
0 votes

How to convert a coordinates to indice array (vice versa) in a NetworkX graph?

Maybe this is what you are looking for import numpy as np import matplotlib.pyplot as plt import pandas as pd import scipy from scipy import spatial, stats import networkx as nx We generate the ...
user avatar
  • 101
0 votes
Accepted

QgsRasterFileWriter in QGIS gives blank output

Because you are saving your raster in a different CRS, you need to use the QgsRasterProjector class. Try this modified version of your script below. def clip_raster(raster, column_count, row_count, ...
user avatar
  • 14.3k

Top 50 recent answers are included