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.

1,274 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
7
votes
0answers
1k views

Setting band names when writing multiple layer rasters using GDAL with Python?

I want to write a raster file (using GDAL+Python) with multiply bands. However, I do not know how to named bands. Their names are always "Band 1", "Band 2", etc. I search and found a function that ...
7
votes
0answers
913 views

ogr2ogr (or other) simplification of polygons with shared boundaries

I am trying to simplify a collection of 100,000 or so polygons containing nearly 4 million vertices. The data is stored in a 2GB shapefile so there is no explicit representation of the topology ...
6
votes
0answers
96 views

OGR failing to unpack polygons and respective holes from shapefile

I'm trying to unpack shapefiles in Python (v3.7.4) using the GDAL-OGR library (v2.3.3). Each shapefile has only one feature containing multiple polygons with holes. They cannot be produced differently....
6
votes
0answers
320 views

GDAL contour line generation at DEM edges

In a Python application I use gdal.ContourGenerate() to generate contour lines (GDAL version 1.11.4 and 2.2.1) from DTED tiles. DTED tiles overlap at the top and the right with neighboring tiles. ...
6
votes
2answers
535 views

extract() in R raster package slow with non-native format

I've noticed that running extract takes very different amounts of time depending on whether or not the raster is in memory, on disk in the Native format (.grd), or on disk in another format (e.g., ...
6
votes
0answers
246 views

Different results from GDAL raster attribute table command on mac and windows

I am trying to get the raster attribute table of the following file: Shift_cult_past_current_prediction_20160107_gr1DD.tif available here: https://www.dropbox.com/s/fmomfpro3j6dmz8/...
6
votes
0answers
705 views

Gdal and module import error when creating an .exe application with pyinstaller

I’ve been struggling since three days in a row to create a windows executable application from my python application. I have managed to get results but I’m not at all satisfied with the workarounds I ...
6
votes
0answers
1k views

Is it possible to do parallel processing in GDAL and QGIS?

It seems like processing a large raster dataset in QGIS can cause a crash, for example in QGIS failing to complete clip or intersect and crash dump in qgis. Is it possible to use GDAL parallel ...
6
votes
0answers
594 views

Ignore empty tiles in gdal2tiles.py when generating tiles

I am in the process of generating a large set of tiles from a .vrt file composed of many images. The image is following a road section, being very long and small strip of images and due the shape of ...
6
votes
0answers
2k views

Uploading raster format(*.tif) to postgis through raster2pgsql

I'm new to postgis and raster file format. i currently working on netcdf files and i want to import it into postgis through curl command line tool but its failed for me.so i jump on to GDAL v1.9.2 ...
5
votes
0answers
55 views

Reading raster backward using GDAL

I am currently working on two-scan raster algorithms (euclidean distance transformations, cost surface analysis, etc.). Those algorithms require a line-wise forward raster scan (from top left to ...
5
votes
1answer
144 views

Rasterize/Filter with Burn and Weight variables in QGIS

Using QGIS 3.10.1, I am attempting to rasterize some demographic polygons, and then apply a filter (Gaussian) to create a smooth/graduated surface. This works fine for some of my values (e.g. total ...
5
votes
0answers
52 views

Specify open options in datasource

I am using the GDAL csv driver and I can open a csv and specify geometry columns with ogrinfo using the -oo flags. However, when I want to specify these as part of another command-line tool, for ...
5
votes
0answers
482 views

R sf package - link to GDAL

Is it possible to ask R {sf} package to use a GDAL installation I prefer? So far I found how to check external software it uses: library(sf) sf_extSoftVersion() # GEOS GDAL ...
5
votes
0answers
305 views

When should I use gdal_merge.py?

When building a single georeferenced image from a collection of tiles, gdalbuildvrt followed by gdal_translate is much faster than gdal_merge.py. In my own measurements of gdal_merge.py \ --...
5
votes
0answers
544 views

Fuller/Dymaxion in proj4/gdal/qgis?

I know this question has been asked a million times already, but I can't find many detailed responses on exactly what I want to do. As far as I can tell, the full C code for the fuller projection is ...
5
votes
0answers
248 views

How do I get the maximum value of raster cells ignoring nodata with gdal_calc?

I have two integer rasters, A and B, with the same dimensions and cell sizes. I want to compare each cell in A with each cell in B and keep the maximum value. In cases where both have nodata, I want ...
5
votes
1answer
651 views

Competing versions of GDAL

This is confusing, and a question I've harvested from a duplicate, so let me start with my setup. OS: Windows 7 x64 GIS Client 1: ArcGIS Desktop 10.5 GIS Client 2: ArcGIS Pro 1.4 GIS Client 3: ...
5
votes
0answers
430 views

How to use GDAL Correlator?

I need to align several images using FOSS. There is Correlator tool in GDAL (source) that seems to be suitable for the job. But I was unable to find documentation for it or a tutorial. Can someone ...
5
votes
0answers
1k views

How to set Vertical Coordinate system when creating a 3D shapefile?

I'm working with GDAL v1.11 and am seeing the vertical CS stripped when exporting a 3D shapefile (from oracle spatial). This is the command I'm running: ogr2ogr -f "ESRI Shapefile" B_POINT.shp (...
4
votes
0answers
28 views

ogr2ogr creates too many columns with LEFT JOIN

I am creating a GeoPackage using several shapefiles using ogr2ogr (GDAL 2.2.4): ogr2ogr -f GPKG /path/to/out.gpkg -append -nln out -a_srs EPSG:4326 /path/to/in1.shp ogr2ogr -f GPKG /path/to/out.gpkg -...
4
votes
0answers
44 views

Gdalwarp fails to properly reproject to custom projection

I am trying to reproject my tif file to custom EPSG:3857 projection. Input file picture + gdalinfo: Driver: GTiff/GeoTIFF Files: shd_120arcsec.tif shd_120arcsec.tif.aux.xml Size is 10800, 5100 ...
4
votes
1answer
131 views

Installing GDAL with MrSID fails on Ubuntu

I'm trying to install GDAL from source on Ubuntu or CentoOS both, but it fails both times. I also tried GDAL 3.0 which did the same thing. Is there any way easily get GDAL working with MrSID? I can ...
4
votes
0answers
453 views

Exporting QGIS Atlas using PyQGIS (qgis.core)

Windows 10, PyCharm, QGIS 3.10 installed via osgeo4w (64bit). I set up a simple QGIS composer layout with a vector layer and a WMS base map on the map layout. The vector layer contains about 10 ...
4
votes
0answers
66 views

Telling gdal_polygonize.py how to interpret colors / what does the `DN` field mean

I have lots of raster files I am converting to polys with gdal_polygonize.py. All these images have a consistent palette which I'd like to map to an attribute in the resulting polygons. On most ...
4
votes
0answers
461 views

“Clip Raster by Mask Layer” produces zero values (and not Nodata) outside mask boundaries

This is my first question here. I have a big raster of the world's nighttime lights and want to clip it down to the Adm0 of a country: In order to do so, in QGIS 2.18 what I do is using the Clipper ...
4
votes
2answers
220 views

Writing Non Spatial Table into Geopackage - Python

Just wondering how to write a non spatial (aspatial) table to geopackage using python. I have attempted using Fiona, geopackage = 'some_geo.gpkg' layer = 'test_layer' schema = {'geometry': {'type'...
4
votes
0answers
209 views

Run GDAL on android and perform operations

Could one run gdal on android devices to perform some GIS operation, like viewshed, contours, etc?
4
votes
0answers
975 views

Min-max stretch using gdal_translate in a batch

I'm trying to do a min-max stretch on a raster and save it using gdal_translate. The syntax requires to enter source min and max raster values as arguments for a -scale option: -scale [src_min ...
4
votes
0answers
179 views

Adjusting georeferencing of GeoTIFF?

I have three thermal IR images of a boat acquired by a drone as it flew overhead. The images were taken at one second intervals, are GeoTIFF files and overlap one another. I don't know exactly how the ...
4
votes
0answers
266 views

Is it possible to get the compression level of a GeoTiff?

When creating a GeoTiff and using Deflate or LZW as compression it is possible to select the level of compression from 1 to 9. Is it possible afterwards to see which level was used? I have a lot of ...
4
votes
0answers
518 views

How to extract transformation coefficients calculated with GDAL based on GCPs?

I want to precompute the least squares fit polynomials from a provided set of GCPs, and store the coefficients for later transformation of points between pixel/line and georeferenced coordinates. Thus ...
4
votes
0answers
495 views

gdal_translate slightly changes output pixel values

I have used this batch script for /r %%g in (*.jp2) do gdal_translate -co COMPRESS=LZW -co NUM_THREADS=ALL_CPUS %%g %%~dpng.tif to recursively convert all my .jp2 files in .tif files. However, the ...
4
votes
0answers
1k views

How to perform spatial join and obtain attribute in python/GDAL?

I am working on a script that will take an unprojected raster, and using a UTM grid (shapefile), will obtain the correct SRS (I have a shapefile where each zone is attributed with its numerical SRS) ...
4
votes
0answers
737 views

Install OSGeo module in virtualenv

How can you install the osgeo module in a virtualenv? I downloaded QGIS using KyngChaos (www.kyngchaos.com/software/qgis) following https://arset.gsfc.nasa.gov/sites/default/files/land/webinars/...
4
votes
0answers
205 views

Gdal.open crashes python for some .tif images

I just upgraded to GDAL 2.2.0 and now I'm having issues with my python kernel crashing when I run gdal.Open() on certain files that it used to work on when I had GDAL 2.1.2. It seems to only be ...
4
votes
0answers
676 views

Performing histogram streching using gdal_translate?

I have some rasters I want to perform histogram stretching on, and I want to use only open source tools, preferably using shell/bash command line. I was thinking of using gdal_translate with setting -...
4
votes
0answers
355 views

Disable readdir on open in gdal_translate when using /vsicurl/

I'm using /vsicurl/ file handler to read Landsat 8 data out of S3. Following GDAL documentation "to minimize the total number of HTTP requests outside of the target GeoTIFF file" I set ...
4
votes
0answers
3k views

What is the fastest version of gdal2tiles?

I have multi-CPU linux server, so I wonder what is the fastest parallel version of gdal2tiles.py ? My Ubuntu version: lsb_release -a Description: Ubuntu 12.04.5 LTS How I install the package: ...
4
votes
0answers
283 views

Can gdal be used to generate a single patch of the HEALPix projection?

Given a geo-referenced map of the world, I am able to produce a version with a HEALPix projection using gdalwarp like this: gdalwarp -t_srs '+proj=healpix +a=1 +ellps=WGS84 +wktext' -te -3.14159265 -...
4
votes
0answers
453 views

netCDF has wrong spatial extent in metadata

I have a netCDF file with spatial data ranging from x:528500 573500 y:350500 399500 on EPSG: 31287. If I open and explore the file with Panoply and show the data on a map all works like it should. ...
4
votes
0answers
173 views

Gdal Python problem: black strips in image translation

I have a 500 x 500 m resolution world map of clumping index data (He et al., 2012) and I am trying to do two things at the same time: 1) to isolate the variables per plant functional type following ...
4
votes
2answers
4k views

How to use gdal to convert HDF multi-band file to a single GeoTiff file?

I have a multi-band HDF file that I want to convert to a single GeoTiff file, using free tools, preferably gdal. I'm trying to use gdal_translate, but I either get back multiple output .tif files, or ...
4
votes
0answers
1k views

GDAL RasterIO performance in C++ vs ReadAsArray in python/numpy

I'm currently writing optimisations for a raster viewer program which uses gdal as it's base. It's currently written purely in python, and has some major speed issues which cause problems when we are ...
4
votes
0answers
1k views

Reading GRIB band metadata with GDAL

I'm trying to use GDAL in python to get only the temperature band from this GRIB file that has 2 bands. I can't just do temp_band = ds.GetRasterBand(1) because sometimes, but not always, the grib ...
4
votes
0answers
5k views

how to set the geotransform using GDAL in python

I am trying to create an image from a numpy array and georefenrece it so that I can import it into qgis. I have the latitude and longitude in degrees for the top left corner of the array as well as ...
4
votes
0answers
5k views

How to import netcdf in qgis

I have been trying to impot netcdf files following this guide online http://www.ggiuliani.ch/download/netcdf_qgis_GG.pdf into qgis 2.10 with no success. ALthough the file is imported, the dimensions ...
4
votes
0answers
550 views

gdal_retile.py leaving gaps in mosaic

I'm trying to create a seamless mosaic from the FAA's VFR aeronautical charts using gdal_retile.py. The end goal is to serve the mosaic using the ImagePyramid extension in GeoServer. However, I'm ...
4
votes
0answers
1k views

Zonal computations: computing raster pixel counts within polygons using GDAL versus rasterstats

I'm computing some zonal statistics, and was comparing the results obtained using the GDAL cookbook example code here with the rasterstats zonal_stats function. I want to compute the mean value per ...
4
votes
0answers
1k views

How to avoid “Unable to compute a transformation between pixel/line”?

I am trying to re-project from Equi-rectangular to the NASA global EASE grid (Equal Area Scalable Earth) grid 1383 586 with a ~25 km cylindrical projection (ESPG=3410). The file is provided as HDF5. ...

1
2 3 4 5
26