Skip to main content

All Questions

Tagged with or
Filter by
Sorted by
Tagged with
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
  • 437
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
13 votes
4 answers
29k views

Converting NetCDF dataset array to GeoTiff using rasterio Python

I have read a NetCDF file using the netCDF4 library and then read one of its datasets ("Evapotranspiration") into a variable (variable contains array) using the following code. Subsequently ...
RRSC NGP's user avatar
  • 678
8 votes
3 answers
9k views

Averaging overlapping rasters with GDAL [closed]

I am working on creating a class which will merge several georeferenced rasters into one using different strategies, essentially taking average, max, min where the images are overlapping. So far I've ...
Владислав Мокроусов's user avatar
6 votes
1 answer
3k views

Reprojecting LiDAR data with libLAS, error: "latitude or longitude exceeded limits"?

I have a lidar file (file.las) with the following spatial reference: Spatial Reference: PROJCS["NAD83 / UTM zone 11N", GEOGCS["NAD83", DATUM["North_American_Datum_1983", ...
cpiury's user avatar
  • 315
5 votes
1 answer
14k views

Python - gdal.Grid() correct use

Is there any good, complete API for the GDAL Python bindings? I am interpolating and rasterizing points with elevation data using the gdal.Grid() method; output = gdal.Grid('outcome.tif','newpoints....
Willem van Opstal's user avatar
2 votes
1 answer
3k views

gdal.VectorTranslate returns an empty file

When testing the following code: from osgeo import gdal import json def read_file(filename): f = gdal.VSIFOpenL(filename, "rb") if f is None: return None content = gdal.VSIFReadL(...
Ricardo Barros Lourenço's user avatar
2 votes
2 answers
913 views

Export geospatial PDF from QGIS on Mac

I am trying to take advantage of the new georeferenced PDF export in QGIS 3.10 but the checkbox is grayed out with a message that "GeoPDF creation required GDAL version 3.0 or later". The answers ...
neal's user avatar
  • 123
2 votes
4 answers
4k views

How to get ECW support on QGIS 2.16 - Ubuntu 16.04?

after several attempts I am still not able to enable ECW support on QGIS on Ubuntu Xenial. Before updating to latest version of Ubuntu, solution proposed here worked for me on the same machine, but ...
mmicotti's user avatar
  • 121
40 votes
3 answers
50k views

gdalwarp cutline along with shapefile

I am trying to clip my Raster file according to a shapefile geometry. I am using the following code gdalwarp -cutline INPUT.shp INPUT.tif OUTPUT.tif But it is resulting a black color outside the ...
Devils Dream's user avatar
  • 3,217
24 votes
4 answers
16k views

Smoothing/interpolating raster in Python using GDAL?

I am developing in Python and using GDAL from OSGEO to manipulate and interact with rasters and shapefiles. I want to take a shapefile that has point features and interpolate it into a surface raster....
Doug's user avatar
  • 627
22 votes
7 answers
14k views

How to cut a 'tiled image' from a raster dataset using GDAL?

I am working on an app that needs to create tiles (jpeg) from a given raster dataset. My initial inclination was to use gdal2tiles.py, but its performance seems like it could be improved. That leads ...
user890's user avatar
  • 5,733
21 votes
4 answers
20k views

gdal_calc raster calculator syntax for logical operators and other functions

In documentation for gdal_calc it is stated Command line raster calculator with numpy syntax. Later on there are few examples where in one of them: gdal_calc.py -A input.tif --outfile=result.tif --...
Miro's user avatar
  • 9,794
20 votes
2 answers
48k views

How to convert QGIS generated tiff images into jpg/jpeg using GDAL command line utilities?

I want to develop a web portal that will show the images dynamically produced by QGIS, but QGIS provided tiff images are too big in size and it is not possible to show it on website using image ...
Enamul Haque's user avatar
20 votes
1 answer
18k views

How to export only one band from an image using GDAL?

I have a multi-band GeoTiff, and I want to extract only the first band and write a new image consisting of only that band. How do I do this using GDAL?
Devdatta Tengshe's user avatar
18 votes
3 answers
8k views

Join CSV file to shapefile using gdal/ogr

I have a shapefile with several attributes, for example "YEAR", "COUNTY", and "AREA". I also have a CSV file with more fields that I want in the shapefile, such as "...
Lincoln Mullen's user avatar
18 votes
3 answers
18k views

Python equivalent of gdalbuildvrt

Is there a way to perform the same task as the gdalbuildvrt utility using GDAL Python bindings? So far I have not found any way to do this other than creating a vrt of a single dataset and manually ...
Brian's user avatar
  • 4,229
18 votes
1 answer
16k views

Georeferencing using GDAL?

I have a .tiff image that I am trying to overlay in google earth. For that I require to georeference it first. The image projection is UTM with NAD83 as datum. I know the lat/long of the four corners ...
Akd's user avatar
  • 399
17 votes
2 answers
31k views

Merging all tiles from one directory using GDAL

I would like to use GDAL (under Windows; OSGeo4W Shell) to merge all GeoTIFFs from one directory into a new GeoTIFF. I have tried to address them by writing c:\data\....\*.tif which however does not ...
Arne's user avatar
  • 825
16 votes
3 answers
23k views

How to create polygon shapefile from a list of coordinates using python gdal/ogr?

I am trying to create a polygon shapefile from a list of coordinates using open source python tools. The following is what I have so far which was hacked together from the Python GDAL/OGR Cookbook and ...
Aaron's user avatar
  • 51.8k
13 votes
3 answers
22k views

How to add color interpretation for raster bands using GDAL?

I have 3 separate 1-band GeoTIFF files. The color interpretation for band is gray. I want a 3-band RGB file. I've used gdal_merge.py gdal_merge.py -separate file1.tif file2.tif file3.tif -o ...
Jorge Arévalo's user avatar
12 votes
3 answers
3k views

Create Geospatial PDF (GeoPDF) is greyed out in PDF export options in QGIS 3.10

I installed QGIS 3.10 standalone version today and I know it has a new feature introduced in this version to export GeoPDF. But for some reason, it is greyed out.
Raj's user avatar
  • 487
12 votes
2 answers
3k views

Clarification of the "25D" option in ogr2ogr

[EDIT: In my original post, I had received an error that was based on a typo, so I scrapped that part of the question, but left the questions that still apply.] In the ogr2ogr docs it says: -nlt ...
BenjaminGolder's user avatar
11 votes
6 answers
9k views

How do I create blank geotiff with same spatial properties as existing geotiff?

How do I use gdal to create a blank geotiff with the same spatial properties (size, resolution, extent, projection) as an existing geotiff? (The reason that I want to do this is that I'm using ...
user1521655's user avatar
  • 1,339
11 votes
1 answer
19k views

convert from HDF to GeoTiff

I am having some problems with the conversion from HDF to GeoTiff. I am following the steps described in this webpage. The problem is that I can't find what is the NDVI subdataset name (XXXX) in ...
Gago-Silva's user avatar
  • 2,546
10 votes
4 answers
9k views

For looping folder to batch clip rasters by polygon using python and QGIS?

I am using Python and QGIS 2.0. I am trying to clip rasters in a folder by one polygon feature. It's the first time for me using PyQGIS; I was used to ArcPy before. How do I get my script to work? ...
umbe1987's user avatar
  • 3,785
8 votes
1 answer
7k views

Adding projection to Satellite NetCDF file

I have been working with satellite data from the GOES-16 satellite for quite some time now. A sample .nc file for this data is located at this NOAA AWS link I use gdalwarp to transform it for Mapbox ...
David 's user avatar
  • 252
7 votes
5 answers
11k views

Converting csv to kml/geojson using ogr2ogr or equivalent command line tools? [duplicate]

I've just unsuccessfully tried to use ogr2ogr to convert CSV into KML like so: ogr2ogr -f "KML" output.kml input.csv The csv has "latitude" and "longitude" columns. The attributes are all loaded ...
boulder_ruby's user avatar
  • 1,834
7 votes
2 answers
16k views

GDAL python cut geotiff image with geojson file

I wrote the function which cutting geotiff image by bounding box. First image is original. At second you can see result off my code. I don't use gdalwarp or any console utilities. But I have no idea ...
Andrii's user avatar
  • 475
7 votes
2 answers
8k views

Cannot install a version of GDAL via Anaconda that permits reading BigTIFFs

I have some BigTiff files that I need to read into Python using gdal to do some analyses. According to GDAL's documentation: When built with internal libtiff or with libtiff >= 4.0, GDAL also ...
Jon's user avatar
  • 2,904
6 votes
1 answer
2k views

gdalwarp won't export AAIGrid

I'm trying to use gdalwarp to reproject an ascii grid file. According to http://www.gdal.org/formats_list.html this shouldn't be a problem and indeed I can happily use gdal_translate to create grd ...
mercergeoinfo's user avatar
4 votes
1 answer
3k views

Clipping polygon precisely to raster (extent) using GDAL?

I need to clip a vector layer to the extent of a raster. It has to be very precise that's why I would not want to draw a polygon myself (and clip the two polygons). There seem to be some ways to clip ...
Li12's user avatar
  • 317
4 votes
2 answers
2k views

Updating raster value to reflect total number of points within cell using Python?

I have to do a task in Python/ArcPy/GDAL/whatever because I'm trying to automate this process for a hundred or so different raster/shapefile combos. This is what I need to do: I have an empty ...
user20408's user avatar
  • 1,545
2 votes
1 answer
2k views

WKT for local mine grid

I have been trying to create a WKT entry to use in gdalwarp etc. I need an affine transform from coordinates in MGA94 Zone 54 to our local mine grid. All efforts have so far failed, including using ...
Tonyb's user avatar
  • 23
57 votes
3 answers
54k views

How can I get a shapefile from a postgis query?

My data is in a PostGIS database. I would like to generate a shapefile from a query. How can I do that?
rudivonstaden's user avatar
39 votes
3 answers
7k views

Creating transparent hillshade?

I get elegant transparent hillshades via a combination gdal and convert. Compare to grey-based hillshade commonly used, such transparent hillshades are very cool because they can be placed between the ...
Hugolpz's user avatar
  • 2,673
18 votes
8 answers
107k views

Installing GDAL and OGR for Python?

I am developing some code in Python, and I want to use the GDAL/OGR python bindings. What is the minimum I need to install in order to use the GDAL and OGR python bindings? What is the easiest way to ...
18 votes
2 answers
12k views

Adding band to existing GeoTiff using GDAL?

This seems like it should be straightforward but I can't for the life of me figure it out. Given an existing GeoTiff containing a single band, how can you add another band to that GeoTiff? Is the ...
TheOx's user avatar
  • 384
17 votes
1 answer
24k views

how to take cell size from raster using python or GDAL or RASTERIO

How to take cell size per X,Y using simple python or GDAL or RASTERIO? and hot to count how many pixels have my raster with some packages.. I have find some code but is pyqgis and I don't need this ...
Chris Papas's user avatar
17 votes
2 answers
21k views

Seting 0 values in GeoTIFF to nodata using GDAL?

Is there a way to set all the 0 value pixels on a raster to nodata using GDAL? I would like to use fillnodata to fill some holes, but holes are set to 0, so I need to delete them first
Andrea Ghensi's user avatar
17 votes
2 answers
17k views

GDAL polygonize in python creating blank polygon?

I am having trouble using the Polygonize function in python. The cookbook example for this can be found here. The relevant portion of my code is: sourceRaster = gdal.Open('myraster.tif') band = ...
asdflkjwqerqwr's user avatar
15 votes
3 answers
12k views

Convert timeseries stack of GTiff raster to single NetCDF

Moving from gdal-dev mailing list: On Mon, Sep 2, 2013 at 7:09 PM, David Shean wrote: Hi list, I'm trying to package a timeseries of GTiff rasters with identical projection/extent/resolution as a ...
David Shean's user avatar
15 votes
3 answers
14k views

GDAL and Python: How to get coordinates for all cells having a specific value?

I've got an Arc/Info Binary Grid---specifically, an ArcGIS flow accumulation raster---and I'd like to identify all cells having a specific value (or in a range of values). Ultimately, I'd like a ...
elrobis's user avatar
  • 6,486
13 votes
2 answers
39k views

Obtain coordinates and corresponding pixel values from GeoTiff using python gdal and save them as numpy array

How can I obtain projected coordinates as well as the actual pixel values at those coordinates from a GeoTiff file and then save them into a numpy array? I have arsenci020l.tif file, and its ...
irakhman's user avatar
  • 165
12 votes
4 answers
5k views

Performance of google map tile creation processes

I know that question is rather vague but please bear w/me. I'm trying to get an idea of what sort of product performance - specifically timing - people have seen for various methodologies they have ...
malonso's user avatar
  • 395
11 votes
11 answers
16k 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 Python, GDAL and/or numpy. The classes are represented as integers. I have tried following the ...
PyMapr's user avatar
  • 1,660
8 votes
3 answers
4k 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 ...
Moskar's user avatar
  • 81
8 votes
1 answer
7k views

Store GeoTIFF with color table - Python [closed]

I have a large number of GeoTIFFs for which I would like to add and store symbology as Color table. What is the easiest way for doing that? I would like to use Python, maybe with GDAL.
defelix's user avatar
  • 315
8 votes
1 answer
9k views

How to import a raster into PostGIS?

I'm trying to follow the instructions here to load a raster into a PostGIS database: python raster2pgsql.py -s 4269 -I -r *.tif -F myschema.demelevation -o elev.sql I understand that I replace * ...
djq's user avatar
  • 16.3k
7 votes
4 answers
11k views

Linking to external files with relative path in QGIS actions

Objective: I have point layers with attributes that contain paths to external files (Visio, AutoCAD dwg...). I want to put them all in one folder together with the project file, compress the folder ...
Cao Minh Tu's user avatar
  • 2,024

1
2
3 4 5
22