The Stack Overflow podcast is back! Listen to an interview with our new CEO.

# Questions tagged [gdal]

GDAL (Geospatial Data Abstraction Library) is an open source translator library & set of command-line utilities for processing raster spatial data formats. As a library, it presents a single abstract data model to the calling application for all supported formats. It also comes with a variety of useful commandline utilities for data translation and processing.

4,104 questions
Filter by
Sorted by
Tagged with
37 views

### Getting inconsistent raster output from gdal_calc.py raster calculation

I'm attempting to do what is generally a straightforward raster calculation when I do this in QGIS, but am trying to do this with gdal_calc.py in terminal. The output is close, but produces banding ...
38 views

### Mathematical rule to convert between degrees and centimeters based upon projection

I have some Tanzania drone imagery data in a local geographic projection EPSG:32737 that uses the unit of meters. Then I have other vector data that is in EPSG:4326 which is denominated in degrees. In ...
32 views

### Batch processing of GDAL clip function

When I am trying to batch process GDAL clipping in QGIS 2.18 with 30 raster files I get the following Error: GDAL command output: ERROR 1: Cannot compute bounding box of cutline. My ...
8k views

### How to reproject raster from 0 360 to -180 180 with cutting 180 meridian

I have a geotiff raster image that has a coordinate system with longtitudes from 0 to 360. The horizontal center of the image is 180 longtitude. See image below: I want to transform it to EPSG:4326 ...
48 views

### Converting Longitude range from (0,360) to (-180,180) in Python or by using gdal commands

I have a raster downloaded. Visualising it in QGIS. I want to correctly project it so that its extent varies with longitudes from -180 to 180 instead of 0 to 360. gdalinfo filename.nc outputs the ...
37 views

### Cut raster by pixels in GDAL

i've some georeferenced images that have the size of 1280 X 960. I need to cut the outer pixels to have a size of 1220 X 900 (i need to cut 30 pixel for each borders). Can i do this using GDAL or a ...
481 views

### Using GDAL or Python, how can I merge/combine 3 NITF images (RGB) into one image and keep the RPC metadata intact?

I'm looking to merge 3 imagery bands that are saved as separate files. The file format is NITF. The reason they are saved as NITF is because they have RPC metadata embedded into the images. I would ...
27 views

### How can I easily determine the precision of an OGR geometry?

I'm writing a python tool to update some river catchment boundaries and keep running into geometry errors, such as WARNING: TopologyException: Input geom 1 is invalid: Self-intersection at or near ...
220 views

### Editing raster band metadata using GDAL?

How does one manually change STATISTIC_MIN/STATISTIC_MAX metadata within a raster band using gdal? I want to preserve the color scale but ensure that the STATISTIC values are set as needed.
43 views

### Converting GeoTIFF to tiles using gdal2tiles

I have a GeoTIFF of weather radar data that I cannot seem to get converted to a raster tileset using gdal2tiles. When the tileset is generated, there are TONS of empty folders in the output directory, ...
6k views

### Impossible to sum rasters because of nodata pixels

I have a set of rasters (.vrt) with daily soil moisture data. I want to sum the pixels of all rasters in order to have a measure by month. However, the whole world is not covered each day, which ...
3k views

### Looping through all raster cell values using GDAL via Python?

I'm trying to identify null/0 values in each of my raster bands. How can I loop through all the values of each band? I've tried this code, straight from the gdal/python cookbook website but this just ...
9k views

### Adding field with filename when merging shapefiles with ogr2ogr?

I'm merging some shapefiles and I had some problems doing so inside QGIS, so i'm using ogr2ogr directly. I'm doing this (in a batch): ogr2ogr -overwrite %destination% %n1% ogr2ogr -update -append %...
40k views

### Fully load raster into a numpy array?

I have been trying to check my filters on DEM raster for pattern recognition and it is always resulting in missing last rows and columns(like..20). I have tried with PIL library, image load. Then with ...
32 views

### import gdal, return “ImportError: DLL load failed:”

I came up against this problem during the installation of gdal, I tried several solutions already read on the site but none helped me. Here's what I did: 1) uninstall gdal 2) uninstall Anaconda 3) ...
34 views

### Using raster calculator with GDAL in python?

i am using an hyperspectral image with 158 bands. I want to calculate raster. i am using the following python script import gdal # Import GDAL library bindings from osgeo.gdalnumeric import * from ...
375 views

### artifacts in SRTM contour layers processed with GDAL tools and rendered with mapnik?

Here is my workflow for importing individual SRTM tiles into postgis using the GDAL utils and rendering a png using mapnik: gdal_fillnodata.py -srcnodata -32768 gdal_contour -i 10 -a ele -snodata -...
40 views

### Python GDAL writing image output all pixels as zeros

I have an array "array" with numbers range from -5 to 1 (with decimal) and I tried to write it as a geotiff. However, the output geotiff turns out to be all zeros. Can someone tell me why? Here the ...
479 views

### NetCDF layer (.nc) appears flipped and rotated in QGIS

I'm trying to import NetCDF layers with environmental information to QGIS and they appear flipped and rotated In the top-left you can see the Europe coastal line I was using, in the bottom-right the ...
17 views

### Unable to install gdal2tiles on PyCharm

I have installed gdal 2.4.1 while installing gdal2tiles. I am getting this error: ERROR: Could not find a version that satisfies the requirement GDAL==2.4.1 (from gdal2tiles) (from versions: 1....
47 views

### How can I remove clouds' borders on Sentinel-2 images?

I have to replace area with clouds from another image without clouds. So I have a problem when I remove clouds from my mask I have borders of clouds. I use Sentinel-2 SLC image. For begin I open my ...
164 views

### gdal_retile for big mosaic file

I have some big mosaic files (about 3GB, 50k x 50k) and use gdal_retile.py to generate the pyramid tiles for geoserver. It takes very long time to generate all tiles (about one day in my computer). ...
341 views

### GeoTIFF (ESA Copernicus data) georeferencing coordinates are mirrored and projection slightly off when checking on Google Maps

I worked on downloading a Sentinel 5P data in my question at Converting a netCDF4 file to (georeferenced) GeoTIFF, problems with georeferencing and also transforming the netCDF4 (.nc) file into a ...
48 views

### gdalwarp - correct for a slight spatial misregistration?

Some Sentinel-2B band images have slight spatial misalignments as I explained on the step forum. https://forum.step.esa.int/t/sentinel-2-tci-10m-level-2-images-slight-spatial-misregistrations/14235 ...
222 views

### GeoTools and GDAL: CRS WKT

I would like to achieve the same output as for GDAL using the GeoTools library: CoordinateReferenceSystem crs = CRS.decode("EPSG:32632"); String wkt = crs.toWKT(); System.out.println(wkt);...
33 views

### Getting string attribute from a shapefile with GDAL Feature.GetFieldAsString(name) returns incomplete value

I read a shapefile (zipped) with GDAL library in C#. Shapefile contains .cpg file with "UTF-8" encoding specified. When I call Feature.GetFieldAsString(attributeName) some of the attribute values get ...
26 views

### Seeking documentation on DEMProcessing from GDAL?

I am using python 3.X and I am transforming a DEM (from a raster GeoTIFF file) into a slop tif file. I am using GDAL and rasterio to do that. Specifically, I am using the method: gdal....
86 views

### Convert worldfile for jpg to worldfile for png

I am using 3 band jpeg files with 1 band png masks for image analysis. The names match except for extension, and I am merging the jpgs using gdalbuildvrt, then gdal_translate to generate a geotiff. I ...
5k views

### Raster reclassify using python, gdal and numpy

I would like to reclassify a raster file from a raster with 10 classes to a raster with 8 classes using pyhton, gdal and/or numpy. The classes are represented as integers. I have tried following the ...
30 views

### Many-Many Relationship in GDAL Pixel Functions

I am using pixel functions (in Python) in VRT derived data sets. As far as I know it is only possible to use One-One or Many-One relationships within a pixel function. In other words, the in_ar ...
34 views

### gdalbuiltvrt output is different than the source images, when using dstalpha?

I have warped some images from various state plane coordinate to EPSG 3857, but the output of gdalbuildvrt is messed up (see image). I've tried dozens of different combinations of gdalwarped and ...
1k views

### stack raster using GDAL and numpy dstack

I am testing Savitzky-Golay filter with my MODIS dataset. Currently I am testing for 10 rasters (but later on will use my whole dataset) only just to test how should I create my script. So my initial ...
14 views

### GDAL C# Bindings ogr2ogr's clipsrc

I am trying to call ogr2ogr's clipsrc command from C#, but I can't find any reference other than implementing what the command does from scratch. I can imagine Using gdalwarp with c# bindings? is ...
118 views

### Improving quality of tiles generated from Ordnance Survey Raster Data

I'm trying to generate some map tiles based on the Ordnance Survey Open Data (available from here). I don't have much experience with this, but I've read a few tutorials online and have managed to ...
39 views

### Python gdal_translate move raster

I would like to translate from TIFF to ASCII, import os os.system("gdal_translate -of AAIGrid -a_srs EPSG:25830 " + 'my.tif' + " " + 'my.asc') But when I do that the ASCII file is moved: ASCII ...
6k views

### Import error: no module named _gdal_array

I am using python 2.7 and have gdal installed. I want to read an entire .jpg image at once and so I used statement import gdal from gdalconst import * driver = gdal.GetDriverByName('JPEG') driver....
163 views

### How can I write a zipped shapefile with ogr2ogr and /vsizip/?

After reading a bit of GDAL Virtual File Systems docs, I am trying to write a zipped Shapefile using this gdal command involving the use of /vsizip/: ogr2ogr -f "ESRI Shapefile" /vsizip/test.zip\test....
56 views

### Convert gnomonic projection to Mercator

I'm trying for some time to convert a weather radar map (gnomonical projection) to mercator (EPSG_3395) and then layout it onto third-party web map so far unsuccessfully. The original image: The ...
2k views

### gdal_rasterize is giving no data while converting a shapefile to raster

I have used next command: gdal_rasterize -burn 1 -tr 30 30 fire_2010.shp fireRaster2010.tif to convert shapefile to raster. But I am getting no data in the raster. The same command works for another ...
125 views

### QGIS GDAL Installation Error

I am using a Mac OS High Sierra, version 10.13.6. While installing the more recent version of QGIS, I ran into a popup that said "Failure, The GDAL 2.3 framework is required." Naturally, I opened ...
25 views

### GDAL project lat lon coordinates to UTM in C

I have dug up some old code I wrote 6 years ago that was doing the conversion from Lat Lon coordinates to UTM. I have tried to run it today and the code returns NaN values. I suspect there has been ...
1k views

### Ogr2ogr: ERROR 1: PROJ: pj_obj_create: Cannot find proj.db

I start using GDAL 3.0.0 using conda build. I successfully installed GDAL on my laptop (Windows 10) and I am trying to ingest MapInfo tab file into Elasticsearch index. I understood that I have to ...
80 views

### Extracting single band from multiple band raster with PyQGIS?

I'm approaching naw in the script and I'm trying to select many multi-band files from a folder and extract a single band from the file, putting everything in an output folder with the single-band ...
288 views

### Not able to import GDAL into Python env

I am new to Python scripting. Can anyone tell me if there is any way to import gdal into Python environment (ArcGIS Desktop 10). I am getting error while importing. Please check attached picture.
78 views

### Read RAT (raster attribute table) using GDAL or other python libraries?

Referring to this post, is there any update on the reason why GDAL function band.GetDefaultRAT() always returns NoneType? I can't find much documentation. I've tried to create a RAT for testing (...
63 views

### Gdal Build Curl Error

I'm building gdal 2.4.1 with the following config options ./configure --with-libtiff=internal --with-geotiff=internal --with-jpeg=internal --with-gif=internal --with-openjpeg --with-opencl=yes --...
39 views

### GDAL module in python error

I have some troubles with GDAL module on Python. When I try to import gdal, console displays this: Файл "c:/rstp/Lib/site-packages/osgeo/__init__.py", строка 48, из <module> __version__ = ...
3k views

### GDAL_TRANSLATE Assumes Picture is Orientated North? [closed]

I used gdal_translate to change a jpeg to a geotiff. Attempting to use gdalwarp to create a mosaic I found the images skewed and this lead me to the observation in the title of the question. Below I'...