Questions tagged [gdal-python-bindings]
19 questions
1
vote
1 answer
Compiling libgdal for AWS AMI fails
I try to get libgdal installed in an AWS AMI 2 to be used in ECR, together with Python bindings. The build runs within a Docker container which is provided by ECR and contains Python 3.9.
# Pull the base image with python 3.9 as a runtime for your…

Joysn
- 987
- 1
- 16
- 30
1
vote
0 answers
Creating a Raster Stack that will save tif filenames as band names in GDAL
I created a raster stack but i can't set the band names as I desired. I use this code for stacking with Python:
outvrt = ('result/raster_stack_vrt.tif')
outtif = ('result/raster_stack.tif')
tifs = glob.glob('data/*.tif')
outds =…

volkan
- 195
- 7
1
vote
1 answer
How to install GDAL Python Bindings for Postgres.app
I installed the latest Postgre.app version Version 2.5.6 (139) Universal version for my new MacBook Pro M1. After setting up the CLI tools, I am able to access all gdal binaries that come bundled like gdalinfo.
However I also need to install the…

Shaunak
- 17,377
- 5
- 53
- 84
0
votes
0 answers
Import error in conda environment for GDAL
I am trying to install GDAL==2.2.2 in a conda environment. But I get the following error for some reason:
from osgeo import gdal
Traceback (most recent call last):
File "", line 1, in
File…

Vinayak Huggannavar
- 29
- 6
0
votes
0 answers
Problems Processing GeoTiff files
I am trying to generate a geoTiff file via the following code in python:
import osr
import sys
import numpy
file=sys.argv[1]
ds = gdal.Open("/home/jason/new_wind_process/wx_process/"+file+".grib2")
temp = ds.GetRasterBand(3).ReadAsArray()
u…

jms1980
- 1,017
- 1
- 21
- 37
0
votes
1 answer
Downgrade setuptools inside tox dependencies
I have a gdal dependency in my tests.
I use rocky-linux 8. epel 8 provides gdal 3.0.4, so I must install the same version in python, but this version is incompatible with the latest version of setuptools. (See: Error building pygdal: Unknown…

Balaïtous
- 826
- 6
- 9
0
votes
0 answers
What is the right way to create a compound CRS in GDAL 3.4.3 using Python (upgrading from GDAL 2.x)
I have a Python project using GDAL 2.1.3 which creates a CRS like this:
srs = osr.SpatialReference()
srs.SetFromUserInput("EPSG:2226+5714")
print srs.GetLinearUnits()
which displays a value of 0.304800609601 which is correct as the conversion…

cary
- 21
- 3
0
votes
0 answers
Error Installing GDAL using pip on Ubuntu
I'm running Django rest api with the django 3.2 on GCPUbuntu 20.04.5 LTS (GNU/Linux 5.15.0-1025-gcp x86_64).I'm getting an error when i execute pip3 install gdal==3.6.2. I need to use GDAL in one of my project modules. I have also installed
sudo…

Earthling
- 83
- 3
- 13
0
votes
0 answers
Lambda Layer for GDAL
I am trying to use the GDAL as a lambda layer in my AWS environment. But I am getting this error response:
"errorMessage": "Unable to import module 'lambda_function': cannot import name '_gdal' from 'osgeo' (/opt/python/osgeo/__init__.py)",
…

cownan_kun
- 386
- 3
- 8
0
votes
0 answers
Reprojection from North Polar Stereo to Lat/Lon using Rioxarray causes dataset to become corrupted
I am attempting to reproject a CMC Snow Depth Map (in GeoTIFF format) from North Polar Stereo to Lat/Lon. The PROJ string of the file is: '+proj=stere +lat_0=90 +lat_ts=60 +lon_0=10 +x_0=0 +y_0=0 +R=6371200 +units=m +no_defs=True'. The data is…
0
votes
1 answer
How to query the highest altitude within an area of interest in a DTED?
I have a rectangular area of interest, and each vertex of this rectangle is defined by a pair of coordinates (latitude, longitude).
Parsing a DTED, how could I find the highest altitude within this rectangular region? I'm using the dted library for…

carraro
- 162
- 10
0
votes
1 answer
GDAL Warp produces a black image
I am calling GDAL warp using the python distribution on a NITF file and it simply outputs all zero values which creates an empty black image. The command I'm calling is
import osgeo.gdal as gdal
gdal.Warp("out.ntf", "inp.ntf")
I've tried using…

Sal Aslam
- 9
- 1
0
votes
1 answer
python gdal not processing grib file properly on CENTOS linux
I am trying to use python gdal to process a grib2 file into a geotiff file based on the following example:
https://geoexamples.com/d3-raster-tools-docs/code_samples/vardah.html
based on this I have the following code:
import gdal
import osr
ds =…

jms1980
- 1,017
- 1
- 21
- 37
0
votes
0 answers
How to use mapFieldType with gdal.VectorTranslate
I'm trying to export a postgresql database into a .gpkg file, but some of my fields are lists, and ogr2ogr send me the message :
Warning 1: The output driver does not natively support StringList type for field my_field_name. Misconversion can…

Vianney Morain
- 93
- 7
0
votes
1 answer
Python GDAL cannot find app GDAL on docker image
I'm trying to build an application into a docker container that uses the OSGEO/GDAL libraries in Python, which are wrappers around the GDAL program. The GDAL program appears to install ok (at least Docker reports => CACHED [3/9] RUN apk add…

DVA
- 331
- 2
- 13