Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 144769

GDAL (Geospatial Data Abstraction Library) is an open source translator library for raster and vector geospatial data formats.

1 vote

Iterating through GDAL

Here are a couple of ideas/options. I have yet to try them, but hopefully it points you in the right direction. Use subprocess.call() to open a new instance to run what you have. With each pass throu …
Binx's user avatar
  • 1,390
1 vote
0 answers
92 views

cgohlke gdal wheels - early version location

version of gdal. … Alternate Solution: I can download a gdal-version.tar.gz file, but am unsure how to install from there. For example, here is an image of gdal 3.2.1. …
Binx's user avatar
  • 1,390
1 vote
Accepted

Remove empty image - gdal_retile.py

I found that the .tif was actually being created on the lines if MemDriver is None: and not where t_band.WriteRaster() is located. So checking for an empty .tif should go right above that. See the new …
Binx's user avatar
  • 1,390
0 votes
1 answer
70 views

GDAL processing - save as multiple formats

I am using the gdal_retile.py script, but this question can translate to other gdal processes. …
Binx's user avatar
  • 1,390
1 vote
1 answer
655 views

Gdal and Pillow Tiff to Jpeg

I have been using the Pillow code below to convert Tiff to Jpeg, but have recently found that I can use Gdal to also convert Tiff to Jpeg. … I would prefer to use the gdal code to limit the amount of packages I need in my overarching script. The purpose is to use the JPEG's within computer vision - tensorflow - pytorch - YOLO - etc. …
Binx's user avatar
  • 1,390
1 vote
1 answer
454 views

Remove empty image - gdal_retile.py

I've been working with the gdal_retile.py script recently to retile an orthomosaic. I originally was using the solution from this post, but found that gdal_retile.py is faster with orthos > 10GB. Ther …
Binx's user avatar
  • 1,390
2 votes
0 answers
188 views

Split Raster Missing Data

I have a code that will read a .tif and split the image into a specific number of rows and columns (code 1). I modified it to be able to be able to easily set the wanted image size (by pixels) (code 2 …
Binx's user avatar
  • 1,390
3 votes
1 answer
1k views

Calculate mean for each band in raster

I'd like to re-visit this answer given by Aaron that uses gdal and numpy to calculate the mean value of each band. Issue 1: With large TIFFs ~ 5-15GB, I am running into a memory error. … I am wondering if gdal is uncompressing the TIFF and making it explode? …
Binx's user avatar
  • 1,390
1 vote
Accepted

Calculate mean for each band in raster

From all the helpful comments and some additional troubleshooting, here is what I found: QGIS is treating the NaN values (pixels that fall within the extent of the ortho, but are not actually in the o …
Binx's user avatar
  • 1,390
1 vote
Accepted

Clipping Shapefile to Raster Extent using GDAL with Python

From the .tif I used, I extracted the extent and used the xmin, ymin, xmax, ymax values to create basically a grid. import shapefile import os import shutil import gdal import glob import geopandas import …
Binx's user avatar
  • 1,390
1 vote
1 answer
1k views

Clipping Shapefile to Raster Extent using GDAL with Python

A similar question was asked as Clipping polygon precisely to raster (extent) using GDAL?, with an answer that I have not been able to effectively use. … import gdal import subprocess import os # define file paths Ras_path = 'D:/images/' i = 0 for Raster in os.listdir('D:/images/'): src = gdal.Open(Ras_path + Raster) ulx, xres, xskew, uly, yskew …
Binx's user avatar
  • 1,390