Questions tagged [gdal]

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

Filter by
Sorted by
Tagged with
110 votes
12 answers
190k views

Installing GDAL with Python on Windows

Can anyone explain how to install GDAL/OGR with Python on Windows? I have Windows Vista and I have tried following the information on the website and it does not seem to bind the *.exe files for me. ...
46 votes
1 answer
35k views

Getting pixel value of GDAL raster under OGR point without NumPy?

I am working on a computational model of the abundance of wild pollinators across a landscape. The model itself is complete, and I am now struggling with a post-processing step. I have my GDAL ...
James's user avatar
  • 803
43 votes
5 answers
15k views

Reprojecting raster from 0 360 to -180 180 with cutting 180 meridian using gdalwarp

I have a geotiff raster image that has a coordinate system with longitudes from 0 to 360. The horizontal center of the image is 180 longitude. See image below: I want to transform it to EPSG:4326 SRS ...
nextstopsun's user avatar
  • 1,129
57 votes
6 answers
83k views

How to call gdal_translate from Python code?

Is it possible to use some gdal API to call gdal_translate from Python code? I do not mean simply executing the gdal_translate.exe from the file system, but rather call it somehow in code so I do not ...
Katie E.'s user avatar
  • 629
24 votes
1 answer
10k views

File size inflation normal with gdalwarp?

After using gdalwarp to project and align-to-grid (via -tap) a number of rasters I noticed that the output rasters were significantly larger than the original rasters. A fairly thorough web search ...
Arthur's user avatar
  • 2,292
12 votes
3 answers
18k views

Installing ECW for QGIS in Ubuntu 12.04?

I have followed various online help guides on how to make ecw for QGIS 1.8 work in Ubuntu 12.04. I had it all working in Ubuntu 10.04 but since migration to 12.04 no such luck. Is there a guide that ...
jurgena's user avatar
  • 129
41 votes
5 answers
69k views

Writing numpy array to raster file

I'm new to GIS. I have some code that converts infrared images of Mars into thermal inertia maps, which are then stored as 2D numpy arrays. I've been saving these maps as hdf5 files but I'd really ...
EddyTheB's user avatar
  • 1,915
34 votes
6 answers
23k views

Splitting raster into smaller chunks using GDAL?

I have a raster (USGS DEM actually) and I need to split it up into smaller chunks like the image below shows. That was accomplished in ArcGIS 10.0 using the Split Raster tool. I would like a FOSS ...
Chad Cooper's user avatar
  • 12.7k
30 votes
6 answers
34k views

Using ogr2ogr to convert GML to shapefile in Python?

I am trying to convert a GML to an ESRI shapefile using ogr2ogr utility in a python script. I have successfully installed the GDAL/OGR package via osgeo but I am now struggling to find/understand ...
Matt's user avatar
  • 2,706
42 votes
6 answers
63k views

How to get raster corner coordinates using Python GDAL bindings?

Is there a way to get the corner coordinates (in degrees lat/long) from a raster file using gdal's Python bindings? A few searches online have convinced me that there is not, so I have developed a ...
EddyTheB's user avatar
  • 1,915
37 votes
4 answers
75k 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 ...
najuste's user avatar
  • 817
17 votes
1 answer
21k views

Georeferencing raster using GDAL and Python?

I want to georeference a raster using python and GDAL. My current approach is to call gdal_translate and gdalwarp using os.system and an ugly list of ground control points. I'd really like a way to do ...
djq's user avatar
  • 16.3k
16 votes
4 answers
17k views

How to add support for FileGDB (Esri file gdb API) driver in fiona?

There has been a tons of questions on that but none of them solved my problem. I have a machine with: Windows 7 x64 Python 3.4.3 x64 gdal installed: gdalinfo --version --> GDAL 1.11.4, released ...
Alex Tereshenkov's user avatar
15 votes
4 answers
34k views

Clipping raster layer with *raster* mask layer in QGIS

Given two input layers The clip layer - an arbitrary layer (though in my case it's a float 1 band geotiff) The mask layer - a paletted raster in which every pixel is either NO DATA or a single "...
Llaves's user avatar
  • 5,951
20 votes
4 answers
30k views

gdal ImportError in python on Windows

Trying to import gdal for Python 2.7.3 on Windows XP: >>> import gdal Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Python27\lib\site-...
meetar's user avatar
  • 431
11 votes
5 answers
16k views

Creating compressed GeoTIFF with QGIS Clipper tool?

I have a geo-tiff created by Pix4D which is about 375 Mb in file size. I have clipped it to a smaller area using Qgis 2.8(using Raster ‣ Extraction ‣ Clipper), and the output file is about 900 MB in ...
Devdatta Tengshe's user avatar
33 votes
5 answers
50k views

Installing GDAL on Linux Ubuntu Server

apt-get install python-gdal installs version 1.6.0 and this is already installed. I would like to install the 1.9.0 version. Do I have to de-install 1.6.0 first and then compile manually or is there ...
Robert Buckley's user avatar
30 votes
3 answers
41k views

Clipping raster with vector layer using GDAL

I have installed GDAL using the Osgeo installer. How can I clip a raster layer with a vector layer programmatically? Is there any GDAL API available which can help me with this? I am using Python.
Vicky's user avatar
  • 1,852
18 votes
2 answers
18k views

Changing color of raster images based on their data values - gdal [duplicate]

Let's say I have 1 band raster images with Gray Color Interpretation and I want to change their color based on their data values. Data values -1, will be Blue, -0.5 will be Light Blue, 0 will be ...
lovelyvm's user avatar
  • 517
13 votes
5 answers
9k views

Calculating Image boundary / footprint of satellite images using open source tools?

I need to create the polygon outlines of several single layer raster images, not the extent/bounding box, but the area without the nodata values, as shown here: Creating shapefile showing footprints ...
spib's user avatar
  • 483
60 votes
3 answers
24k views

What is Lanczos resampling useful for in a spatial context?

GDAL includes a resampling method beyond the normal mix of nearest neighbor, bilinear, cubic and splines: "Lanczos windowed sinc resampling". I understand that its a convolution filter, but unlike ...
scw's user avatar
  • 16.4k
23 votes
1 answer
45k views

Getting coordinate system name from SpatialReference using GDAL/Python

In Python, using GDAL, I've extracted a raster's projection as a WKT string as follows: wkt = dataset.GetProjection() # wkt is 'PROJCS["GDA_1994_Transverse_Mercator",GEOGCS["GDA_1994",DATUM["GDA_1994"...
hendra's user avatar
  • 1,398
19 votes
4 answers
27k views

Using Rasterio or GDAL to stack multiple bands without using subprocess commands

Does anyone have a eloquent way of stacking multiple .tif files into a multiple band stack using Rasterio and/or GDAL? I am looking for a way to avoid using a subprocess command like gdal_merge.py ...
Jens Hiestermann's user avatar
16 votes
2 answers
24k views

How to add a color table to a one band tiff using GDAL?

I have 1-band GeoTIFF file. The color interpretation for band is gray. I want a color table in order to transform my Col.tiff to Col.jpeg or Col.png. I tried putting a color table in this tiff via a ....
Faquarl's user avatar
  • 163
13 votes
1 answer
18k views

GDAL scripts not found in QGIS 3 on OSX

I installed QGIS 3, and tried to execute tools like "sieve" "merge" and "polygonize". All of them gave me the error message: GDAL command output: /bin/sh: (scriptname).py: command not found I found ...
Iris 's user avatar
  • 133
6 votes
1 answer
9k views

Reprojecting MODIS Swath data to WGS84 using GDAL [closed]

Im new to GIS and now working with MODIS04L2 Aerosol Optical Thickness image. I need to reproject the image to other coordinate system such as WGS84 for later work but now Im stuck with it. I have try ...
Hung Luu's user avatar
  • 133
4 votes
1 answer
4k views

Can't install support for ECW in QGIS 3.6 / 3.4 on Ubuntu 18.04

I've been trying to install support for ECW so I can load them in latest QGIS 3.6 (also tried in QGIS 3.4.4) Having tried the following tutorials: https://wiki.openstreetmap.org/wiki/ECW (gdal 2.2....
Rossoe's user avatar
  • 353
4 votes
2 answers
6k views

Convert raster to CSV with lat, lon, and value columns

I'm looking for a process to convert ASCII gridded data (in this case 60min/1 degree gridded ASCII population data (GPW) from SEDAC: https://sedac.ciesin.columbia.edu/data/set/gpw-v4-population-count-...
interwebjill's user avatar
3 votes
2 answers
6k views

GDAL2Tiles: MapTiles from BSB/KAP are Switched

As an example I have a BSB file from NOAA which is a navigational map. The map has a SRS of WGS84 and a Mercator projection. I initially translate the file from BSB format to GTiff format using the ...
user914425's user avatar
1 vote
1 answer
2k views

Reverse gdal_rasterize (-i option) does not work

When I use: gdal_rasterize -b 1 -b 2 -b 3 -burn 255 -burn 255 -burn 255 polygon.shp tiff.tiff I get a new tiff with a white hole in it with the shape of the polygon shp. However, when I use the ...
Gery's user avatar
  • 2,149
101 votes
27 answers
157k views

Python GDAL package missing header file when installing via pip

I asked this question on Stack Overflow before I realised this site existed. As this site it more appropriate, I'll ask it here too. I'm trying to install gdal from pip pip install gdal inside a ...
Kevin's user avatar
  • 1,111
69 votes
8 answers
37k views

Should GDAL be set to produce GeoTIFF files with compression? Which algorithm should be used?

I have a folder of GIS data that consists mainly of GeoTIFF files. The whole set weighs in at about 1.2 GB. I noticed that if I pack the contents into a tarball, it smashes down to about 82 MB. I ...
Sharpie's user avatar
  • 1,190
18 votes
8 answers
13k 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 %...
vascobnunes's user avatar
  • 5,540
18 votes
2 answers
27k views

Convert .tif with .tfw to a GeoTiff?

I have a tif image file, and a .tfw world file (created from OSM data with Mapertive). How can I (using linux command line) convert that to a GeoTIFF file? (i.e. I want to have one file, not 2). I'm ...
Amandasaurus's user avatar
15 votes
2 answers
25k views

Extract raster values within shapefile with pygeoprocessing or gdal

I would like to know how to get all the raster values within a polygon using gdal or pygeoprocessing, without reading the entire grid as an array. pygeoprocessing and gdal can do zonal statistics but ...
egayer's user avatar
  • 193
13 votes
3 answers
21k views

Convert huge XYZ CSV to GeoTIFF

I have a huge amount of data in the form of CSV containing UTM coordinates as X and Y and an elevation value as Z information. I need to convert these data into a DEM as GeoTIFF for further analysis. ...
Arne's user avatar
  • 815
12 votes
5 answers
29k views

Retrieve pixel value with geographic coordinate as input with gdal

I have a list of X,Y coordinates in UTM called coords. I also have a .tif of a digital terrain model (DTM) also referenced in UTM. I would like to use the Python wrapper for gdal to return the pixel ...
Bryce Frank's user avatar
  • 1,312
12 votes
5 answers
10k views

Vertical Datum conversion of a raster with gdal

Is there a tool available in gdal to do vertical datum conversion of a raster DEM? I'm looking for a single command line to execute the vertical datum conversion of a raster like the las2las of Liblas ...
Josée-Anne Langlois's user avatar
9 votes
1 answer
8k views

QGis Save Raster as Rendered Image

In QGIS 1.9.0 Master, when you right click on a raster in the Layers Panel and select "Save As", you can select the output mode to be "Raw Data" or "Renedered Image". When selecting the Rendered ...
Gavin Taylor's user avatar
9 votes
3 answers
20k views

Rasterizing shapefiles with GDAL and Python?

I am trying to rasterize a shapefile, and write values from a specific column of the shapefile into the resulting GTiff. Here is what I've done so far, but that only creates a GTiff of zeros. from ...
Thomas Becker's user avatar
7 votes
3 answers
9k views

Reclassifying rasters using GDAL and Python?

Using @SS_Rebelious very useful answer, I am trying to reclassify rasters using GDAL and Python. I have a grayscale raster (with values ranging from 0 to 255) and I want to reclassify it to a binary ...
djq's user avatar
  • 16.3k
5 votes
3 answers
7k views

Extracting data from a raster

I'm currently working on a project where I have to use the Corine Land Cover (CLC) map. https://land.copernicus.eu/pan-european/corine-land-cover/clc2018 (You can download the map in the .tif format) ...
ktop's user avatar
  • 55
4 votes
1 answer
3k views

How to run OGR in ArcGIS Scripts?

When I run my script outside ArcGIS it works because during execution script uses a GDAL and OGR modules from osgeo. When I use script as a tool in ArcGIS it does not work. In PySripter I can import ...
ConeGIS's user avatar
  • 389
3 votes
1 answer
8k views

How to conditionnally assign a new value to pixels of a raster image?

Given a topographic GIS raster of one country crop.tif: Given a know pixel value such as elevation (z) is +73 : $ gdallocationinfo crop.tif 1 1 -valonly > 73 Given an elevation threshold n = 50 (...
Hugolpz's user avatar
  • 2,653
2 votes
1 answer
779 views

Anti-aliased rasterization of vectors in QGIS?

I have some polygons that I want to rasterize, but in a fairly low-resolution grid (cell size 250x250m). The raster values of the area inside the polygons should normally have the same value (100), ...
tgerdin's user avatar
  • 63
31 votes
3 answers
31k views

Accessing feature classes in file geodatabases using Python and GDAL

I am trying to access a vector dataset in an Esri File Geodatabase using Python and GDAL. I have successfully compiled GDAL with the file geodatabase API. The FileGDB driver is working correctly since ...
Niels's user avatar
  • 313
28 votes
6 answers
26k views

How to efficiently access files with GDAL from an S3 bucket using VSIS3?

So, GDAL has recently added a new feature that allows random reading of S3 bucket files. I am looking to crop GDAL images from multiple tiles of an image without having to download the whole file. I'...
Skylion's user avatar
  • 529
24 votes
5 answers
48k views

Installing GDAL on MacOSX?

Does anybody know what's the easiest way to install GDAL 2.0 on a MacOSX? The usual suspects kingchaos binary distribution and homebrew seem to be stuck on GDAL 1.11 I need support for TopoJSON ...
tato's user avatar
  • 823
14 votes
3 answers
4k views

Accessing file geodatabase (.gdb) rasters with GDAL?

I'm working on a tool that converts raster layers to arrays for processing with NumPy, and ideally I would like to be able to work with rasters that come packaged in a .gdb without exporting them all (...
triphook's user avatar
  • 427
13 votes
1 answer
14k views

GDAL RasterizeLayer does not Burn All Polygons to Raster?

I am trying to burn a shapefile to a raster using GDAL's RasterizeLayer. I pre-create an area of interest raster from a different shapefile, given a specific pixel size. This AOI then serves as a base ...
Lark's user avatar
  • 423

1
2 3 4 5
21