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.

984 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
19
votes
0answers
537 views

SNAP vs. GDAL vs. Orfeo - image rescale, histogram cut

I work with a Sentinel-2 .jp2 image (red band, 10950 x 10950 pixels). My aim is to reach the same result what SNAP does with a Python script. See the SNAP method and parameters: So this is my ...
9
votes
0answers
261 views

Cannot Open VRT of Sentinel2 image created by AutoCreateWarpedVRT

I am trying to create a warped VirtualRaster of a Sentinel2 image. Here the Python code I tried: from osgeo import gdal, osr srs = osr.SpatialReference() srs.SetFromUserInput('EPSG:32632') gdal....
6
votes
0answers
203 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
0answers
233 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
740 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
568 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
2k views

Rasterize shapefile using another raster's size and resolution

Rasterizing a vector (shp) I face the following problem: I want my output file (the rasterized vector) to have the same resolution and dimensions as an existing raster. If I understand the interface ...
6
votes
0answers
1k 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
256 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
1answer
375 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
638 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 ...
5
votes
0answers
2k views

gdal/python: tif not recognised a supported file format

I'm trying to open a tif using gdal, read it as a array, do some math, and write it back as a tif. However, when I try to gdal.Open(tif) in python, I get the error: RuntimeError: /att/gpfsfs/...
5
votes
0answers
869 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 ...
5
votes
0answers
348 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
941 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 (...
5
votes
0answers
489 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 ...
5
votes
1answer
1k views

Can GDAL Perform Vertical Transformations?

Can GDAL perform vertical transformations? If the answer is yes, please indicate which amongst these listed pages can explain how exactly to accomplish vertical transformations? If there is some ...
4
votes
0answers
97 views

Single Sided Buffer Error QGIS

I have delineated a shoreline and created an offset "buffer" of 75' and 250'. When projected onto the screen it appears as though a computation error has occurred and the buffers extend onto the left ...
4
votes
0answers
94 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
216 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
310 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
691 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
702 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
381 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 ...
4
votes
0answers
469 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
161 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 ...
4
votes
0answers
231 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
2k 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
291 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
161 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
1answer
329 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., ...
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
4k 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
427 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

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. ...
4
votes
0answers
76 views

Cropping EUDEM with GDAL creates zig-zag terrain

I have downloaded EUDEM (20 Gb) from http://www.eea.europa.eu/data-and-maps/data/eu-dem#tab-original-data When I try to crop it by GDAL using: gdalwarp -dstalpha -of EHdr -crop_to_cutline -cutline ...
4
votes
0answers
2k views

Compression in GeoTIFF files with GDAL

I have an output from 3rd party program in TIFF format where gdalinfo gives the following information: Driver: GTiff/GeoTIFF Files: J:\ascend\Lufthavne - ImgRAW\S°nderborg\ortho\...
4
votes
0answers
1k views

Fortifying re-projected shapefile for ggplot2 in R

I have a shapefile of US county boundaries which I got from the NHGIS. I can load the file using the rgdal package and see information about it: library(rgdal) shp_1860 <- readOGR("shp", "...
4
votes
0answers
1k views

Buffering a Raster with GDAL and Numpy

I am using GDAL to convert a raster dataset into a numpy.array and then using numpy to buffer the data in the raster. For example, I need to know all the regions within 100ft of a school point ...
4
votes
0answers
615 views

How to create raster attribute table to a raster data using gdal python?

I classified a remote sensing data and saved it as a raster using Gdal python. I want to create a raster attribute table for this classified result.. my classified raster has five classes with 1,2,3,4,...
4
votes
1answer
1k views

How to save table from PostgreSQL to MapInfo File?

I have two tables: 1 with geometry in WGS 2 with geometry in Local System I tried this: ogr2ogr -f "MapInfo File" output2.tab PG:"host=localhost user=postgres password=123456 dbname=postgis" -sql ...
3
votes
0answers
46 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 ...
3
votes
1answer
51 views

Merging many rasters with Python script within QGIS using GDAL?

I have many rasters that im trying to combine in order to produce contours. They are in the .bil format so I understand that i need to translate them using gdal first but none of my attempts have ...
3
votes
0answers
60 views

Why an extra iteration on the first feature of a GeoJSON layer?

I'm using Python and GDAL to iterate over the features in a GeoJSON layer and I'm seeing this strange behavior where the first iteration is repeated a second time before moving onto the next feature. ...
3
votes
2answers
103 views

GeoServer not rendering GeoTIFFs after JPEG compression

I previously asked about some problems I was having converting JP2/MrSid data to GeoTIFF for use in GeoServer. It was suggested that I needed to add overview data to the 4 GB-sized GeoTIFF -- and that ...
3
votes
0answers
39 views

Rotating orthophoto based on polygon boundary (rotated pixel)?

When I clip an orthophoto using a vector polygon, the resulting pixels orientation is north-up like as shown in the graphic below. I used Global Mapper, ERDAS, Arcmap "Clip" "Extract by Mask", "...
3
votes
0answers
127 views

How do I fill Landsat 7 SLC gaps using QGIS?

I am currently using the QGIS 3.4.0 Raster -> Analysis -> Fill nodata (a tool for Landsat 7 data). I am using the directly downloaded USGS tiff band files with corresponding gap mask band tiffs ...
3
votes
0answers
389 views

Setting the correct raster no data value with gdal

I am trying to split a multi-band raster using gdal, and in the process set the nodata value to 0 (currently it is -9999). The way I thought to do this was as follows: gdal_translate -b 1 -a_nodata 0 ...
3
votes
0answers
48 views

How to get a layer object from a geometry

I have a polygon as a gdal geometry and I'd like to use it with gdal.RasterizeLayer(). As its name states, this method needs a layer object, not a geometry. So I need to convert/wrap my geometry into ...