Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. Listen now

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.

Filter by
Sorted by
Tagged with
1
vote
0answers
62 views

Writing to file geodatabase in R on Windows?

The title above basically states the question. I have looked around but haven't quite found anything yet. I see this driver: https://gdal.org/drivers/vector/filegdb.html I haven't seen any R ...
1
vote
0answers
10 views

Band rerendering netcdf file by variable not time. Using gdal, nco, cdo

I want to average netcdf data (band1: precipitation) in bins (i.e. 0.01,0.10,0.25,0.5,0.75,1.0, etc.). What nco, gdal, or nco tools can I use to regrid the netcdf file this way?
3
votes
0answers
42 views

What does “OFT” stand for?

What does "OFT" stand for? I'm getting the message "Invalid OFT field name given" in a Python program that uses GDAL, and before I debug it, I'd like to know what it means.
1
vote
1answer
47 views

File size inflation using GDAL

New to GDAL, have some tiff files and I'm trying to do the following: "0 to NoData" to avoid black background in Mapbox: gdalwarp -dstnodata 0 -dstalpha [input file] [output file] The problem is, ...
0
votes
1answer
33 views

GetRasterBand()Method for GDAL in Python

I'm working on getting the NDVI value of Landsat imagery 2018 using band 4 and 5 but I have encountered a slight problem. import osgeo from osgeo import gdal#gdal, data conversion tool from ...
0
votes
1answer
197 views

GDAL 2.4.2 from UbuntuGIS unstable broken because of missing libogdi.so.3.2? [closed]

After an unthoughtful apt-get update today, GDAL no longer works on my Ubuntu Machine (bionic) because libogdi.so.3.2 is missing: daniel@gin-nuest:~$ gdalinfo gdalinfo: error while loading shared ...
0
votes
0answers
43 views

PostGIS Out-DB Rasters - Segmentation Fault

I am loading data from a NETCDF file with raster2pgsql, which I would like to keep as an out-DB raster. The command I use is (note the -R option): raster2pgsql -s 96482 -I -d -F -R NETCDF:"/home/...
2
votes
0answers
18 views

Horizontal color lines artifacts / bug with GDAL Tiff

I would like to document a bug I encountered, and scratched my head against several hours: I wrote a python script for extracting (cropping) many images from a big TIF image. I used both gdal....
-2
votes
1answer
31 views

What do some of the parameters in gdalinfo represent? [closed]

For example, on the gdalinfo documentation, we have gdalinfo ~/openev/utm.tif Driver: GTiff/GeoTIFF Size is 512, 512 Coordinate System is: PROJCS["NAD27 / UTM zone 11N", GEOGCS["NAD27", ...
0
votes
0answers
41 views

Joining file pair for batch gdal_merge.py

I am new to Python and I have been going through past questions and searching trying to determine best way to batch mosaic files. I have a list of .tifs that have been converted from .hdf files I am ...
0
votes
0answers
22 views

gdal_retile.py killed when dealing with large .vrt + pixel function

I have to retile about 100,000 images of size about 2667x2667 pixels for geoserver. The source images' nodata area were badly damaged due to compression so I decided to use VRT pixel function max to ...
0
votes
1answer
43 views

Opening .Jp2 image in QGIS on Mac?

I am trying to open a Jp2 file in QGIS 3.4.5 on a macOS 10.14.5 Mojave. I am new to QGIS and have been looking through forums that discuss GRASS and GDAL but I don't understand the connection to QGIS....
0
votes
0answers
13 views

Initialize spatial_ref_sys table in MySQL 5.7

Using MySQL 5.7 for a spatial application and kind of baffled as to why there doesn't seem to be any nice way to prepopulate spatial_ref_sys. Isn't there any premade SQL script out there to fill the ...
0
votes
2answers
59 views

Invalid geometry after gdal.polygonize

After converting a raster file to a vector file using gdal.polygonize, I cannot carry out further commands (e.g. Clip) because the vector is produced with invalid geometries (as determined by the QGIS ...
0
votes
0answers
28 views

gdal_rasterized failed in terminal

I have this command: gdal_rasterize -l training -a "MC_ID" -ts 3473 4075 -te 42.4132272 -85.3704013 42.41419 -85.3692901 -ot Float32 -of GTiff "training.shp" "training_rasterized2.tif" What I am ...
1
vote
1answer
78 views

Cannot access LibKML driver using OGR in Python

I am trying to read a kmz file using OGR in Python. I believe the standard driver for reading .kmz files is LibKML (Can ogr2ogr read .kmz files? How?), but I am only getting None when I am building ...
0
votes
0answers
116 views

Clipping raster by feature using GDAL in QGIS?

I have successfully selected the feature from a shapefile (boundary) and intend to use this as a mask to clip the raster map underneath. However, having followed instructions when I open the GDAL > ...
0
votes
1answer
26 views

GDAL NULL Path Value On Production Server

I am using c# and visual studio. I have an app using GDAL that works perfectly on the Dev Server. When I transfer it to Production the app fails. I receive the following error message: An error ...
1
vote
1answer
25 views

ogr2ogr MSSQLSpatial truncating attribute fields

I have a Shapefile with a number of attribute fields defined in its corresponding .dbf file. I am trying to transfer this data to an Azure SQL Server DB using the following command: ogr2ogr -f ...
0
votes
0answers
25 views

Unsupervised classification using Python? [duplicate]

Is there a way to use unsupervised classification with satellite images to determine similar regions using python with gdal or with any library?
1
vote
0answers
86 views

Gdalwarp orthorectification WorldView-3 not using RPC projection properly

I have a high-resolution WorldView-3 image that I am trying to orthorectify using gdalwarp -rpc -to "RPC_DEM=dem.tif" input.tif output.tif However the output is not aligned with Bing or Google maps ...
2
votes
1answer
46 views

GDAL Warp Memory Datasource as Cutline

I am attempting to use a memory vector to crop a raster using GDAL warp but I get the following error: ERROR 1: Cannot open <osgeo.ogr.DataSource; proxy of <Swig Object of type '...
1
vote
1answer
52 views

Offset in GeoTIFF coordinates Google Earth Engine extracts

I download a certain geographic location (lon,lat) with buffer radius around for MODIS products, such as MCD43A2/MCD43A4 from Google Earth Engine using ee, such as: lon = 10.452175 lat = 51.079206 ...
1
vote
0answers
46 views

Correct syntax for specifying multiple Layer Creation Options in ogr2ogr

I am trying to run a GDAL 300 command line command to convert a file to GeoJSONSeq, projecting output using ESRI:102008 (Albers North America), using a SQL query to choose and rename some columns, and ...
0
votes
0answers
28 views

Possible to import current version (v2) of the SQL Server Spatial binary format with QGIS/GDAL?

I'm running QGIS 3.4.3 on a Windows 10 machine and when loading vector layers from our MS SQL Server version 12 everything seems to be working great. No problems connecting or visualizing the data. ...
0
votes
0answers
60 views

Creating virtual tiles of raster in Python?

I have a large raster and want to analyze it on smaller subsets but also want to save space so I am trying to avoid actually tiling the raster. Is there a way to make virtual tiles that python can ...
2
votes
1answer
65 views

How to change the field value of a specific feature in a Shapefile using GDAL/OGR?

I am trying to change the field value of a shapefile, but only in some specific features. However the code I have changes the value for all features in the shapefile. Is there any way of accessing the ...
3
votes
0answers
86 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 ...
1
vote
0answers
122 views

Unable to import GDAL in Python 3.7 [closed]

I have installed GDAL using conda and it installed successfully. But when I try import gdal in jupyter notebook, it is showing this error. -----------------------------------------------------------...
2
votes
1answer
81 views

How to make 'gdalUtils' package in R to use GDAL installed in OSGeo's directory instead of QGIS's directory

I have GDAL installed through QGIS and OSGeo in the directories: C:\Program Files\QGIS 3.6\bin\gdalinfo.exe C:\OSGeo4W64\bin\gdalinfo.exe My gdalUtils package uses GDAL installed in QGIS and I want ...
1
vote
0answers
29 views

Get maximum value from two raster using gdal_calc.py with option Ignore NoData calculation enabled

I would like to get maximum value from two raster using gdal_calc.py with option Ignore NoData calculation enabled. My question is similar to this unsolved problem: How do I get the maximum value of ...
2
votes
2answers
128 views

Calculate coverage percentage of an area covered by shapefiles using GDAL? [closed]

I have thousands of shapefiles covering around the world. I need to calculate coverage percentage. For example, a pixel located in Hawaii was covered by 100 of all shapefiles, then this pixel value of ...
1
vote
1answer
110 views

ogr2ogr write multiple layers to one geopackage

I'm using ogr2ogr to write a SQL query from PostGIS to a GeoPackage in a linux shell. Query by Query to many GPKG: ogr2ogr -f "GPKG" point.gpkg PG:"host=localhost dbname=data user=user password=******...
1
vote
2answers
63 views

What is the correct GDAL Calc Syntax?

I need to calculate in gdal_calc the following python script. if (A == 0 and B == 0): wd = 0.0 else: wd = np.arctan2(A,B) I have tried if(A = 0 && B = 0,(0.0), else,(...
0
votes
1answer
28 views

Error using gdalwarp

I have this NetCDF file of the Greenland ice sheet velocities but the coordinate system is NSIDC Sea Ice Polar Stereographic North (y: -655750 to -3355750 and x: -639750 to 855750 meters). I wanted to ...
1
vote
1answer
116 views

Create elevation-service from geotiff using python and gdal

I'd like to create a little server for us, that tells us the elevation of a point in a geotiff file. I already got it working basically using the following: dataset = gdal.Open('test_file.tif', gdal....
1
vote
1answer
42 views

Finding GDAL Build Format List?

I am building GDAL from source to limit the list of supported drivers however I cannot find a definitive list of formats and their appropriate shorthand names to use in my ./configure list to set them ...
3
votes
1answer
101 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 ...
2
votes
1answer
86 views

How to write a single pixel or a line of pixels to GeoTIFF using GDAL/Python

Let's say I want to write a single pixel or a 1D array of pixels (e.g.all at the same latitude) of pixels to a single-band of a Float32 GeoTIFF using the Python GDAL bindings. How can I do so? Or is ...
3
votes
2answers
62 views

Detecting 12bit images in 16bit

Setting For the purpose of a machine learning algorithm I'm tying to automatically scale images of arbitrary bitdepth to unit interval, i.e. I want to map pixels from [0,2x] to [0,1] simply by ...
0
votes
0answers
26 views

Error with Datetime fields when loading Tab file to SQL Server using OGR2OGR

I have a MapInfo Tab file that needs to be loaded to a MSSQL Server DDBB in a scheduled basis and I want to use OGR for this task. The tab is going to be appended in an existing DDBB table that has ...
0
votes
0answers
202 views

Why Does Jupyter/IPython Fail to load GDAL?

I've been trying to put together some Jupyter Notebooks which demonstrate some GDAL functionality but when I do from osgeo import gdal I get ImportError: DLL load failed: The specified procedure could ...
3
votes
1answer
69 views

Reclassify multiple raster files with GDAL [closed]

I have a directory containing multiple .tif files which I want to reclassify and save to a new directory. The following code already worked for a single raster. Unfortunately, I don't know how to use ...
0
votes
0answers
53 views

runGdal returns “gdalinfo failed - unable to open” […] “.hdf” file

I'm trying to use the function runGdalin R on a Mac and it seems that gdalinfo is not able to open the file. In the terminal, when I entered gdalinfo /MODIS/MCD12Q1.006/2009.01.01/MCD12Q1.A2009001....
1
vote
2answers
66 views

How to save raster with projection into Python

I applied a raster processing that is already in a known coordinate system with this code, import cv2 import numpy as np from matplotlib import pyplot as src img = cv2.imread(r'E:\2_PROJETS_DISK_E\...
0
votes
0answers
50 views

Converting CSV to GeoTIFF in QGIS/GDAL

I have a custom CSV file with the columns UTM easting, UTM northing, red, green, blue. The latter values represent a RGB color of the pixel value. Now I want to convert this CSV to a raster GeoTIFF. I'...
2
votes
0answers
28 views

Rasterize a geometry using gdal.RasterizeLayer()

I am writing a processing script using QGIS 3.4. I need to rasterize a polygon using gdal.RasterizeLayer. The problem is the polygon is a list of QgsGeometry objects and not a layer. n = (2*radiusInt)...
3
votes
0answers
72 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. ...
2
votes
2answers
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 ...
0
votes
1answer
140 views

GDAL polygonize only particular values

I want to polygonize .tiff raster file for specific values. For example, using one method I firstly reclassified the raster by gdal_calc.py --calc="A*logical_and(A>0,A<1)" then used gdal....