Questions tagged [gdal]
GDAL (Geospatial Data Abstraction Library) is an open source translator library for raster and vector geospatial data formats.
6,050
questions
1
vote
1
answer
80
views
Close a file created using GDAL
I have problems to close a file created in GDAL
I have the following code (it's a part of bigger piece of code):
driver = gdal.GetDriverByName("GTiff")
SAL01=driver. Create(Fnout1,afile....
1
vote
1
answer
27
views
Differences in raster statistics using gdal and gdalinfo
I want to know the basic stats (max, min, mean, std) of my raster file. I use two different methods and get similar, but different results. I assume the results should be exactly the same with any ...
0
votes
0
answers
3
views
AWS Lambda layer in eu-west-2 containing gdal & python-gdal bindings
I need to write a Lambda that uses GDAL. I've tried using https://github.com/developmentseed/geolambda, but I need the layer from eu-west-2 region due to other dependencies. I've tried other Lambda ...
0
votes
0
answers
20
views
Result of merge in QGIS is image that doesn't contains all the merged raster
I'm trying to merge ~10 rasters that I have on qgis. Each raster has 2 bands.The rasters overlap each other, and their no-data value is -9999.
This is how all the rasters look like before merging (the ...
0
votes
1
answer
62
views
Simplify my vector data to display it more efficiently [closed]
I have >1Billions points data (in geoparquet but could gpck) that I have to display in QGIS in a scale that doesn't need such precision (=we will not see all the details). It takes age to load in ...
0
votes
0
answers
20
views
Warp result of GDAL translate jpg to geotiff using osgeo.gdal
I am attempting to warp a geotiff created from gdal.Translate where the original file was a jpg. I first obtain the ground control points from a co-located text file. The results of gdal.Translate ...
1
vote
1
answer
33
views
Convert KML to GeoTIFF with Python (osgeo.gdal)
I have a KML file provided by a user that looks like:
<?xml version="1.0" encoding="utf-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://...
1
vote
0
answers
12
views
GDAL error with renv virtual environment in R
I recently started using renv (on a Mac) to manage project environments and I’ve noticed a troublesome problem. When I activate an environment (with sf and terra installed) I cannot set the CRS for or ...
2
votes
0
answers
14
views
Building a tileset incrementally, using GDAL / gdal2tiles.py
I have a tileset covering a local area (currently around 500km2, but growing towards 3000km2). The tileset is built from a number of ecw files with gdal2tiles.py:
$ gdalbuildvrt all.vrt parts/*.ecw
$ ...
0
votes
0
answers
26
views
How to add more data to a GeoTIFF file using GDAL
I have succesfully merged a number of ECW-files into one GeoTIFF file, all.tif. But I want to continuously add more raster data (coming from ECW files) to this TIFF.
I know it is possible to merge ...
-1
votes
0
answers
34
views
Extracting ridgelines from DEM using Python 3 without using any ArcGIS-related products like ArcPy [closed]
How do I extract ridgelines from a DEM of type "tif" using Python 3?
I am looking for algorithms for doing this task without the use of any ArcGIS-related products.
0
votes
1
answer
30
views
Buffer lines using ogr2ogr
I'm trying to create a contour around polygons. I already managed to convert the polygons to lines and now I am trying to use SQLite and the ogr2ogr command to give them thickness. From online ...
1
vote
0
answers
21
views
Warnings on converting NetCDF using gdalwarp
I have a curvilinear NetCDF file, which currently has a single time step (for a mean across time). The variable I am looking at is DIC at a single depth.
I am trying to convert this NetCDF file to ...
0
votes
0
answers
19
views
Debugging import of cloud optimized GeoTIFFs into PostGIS
I have a fairly basic setup where an Apache web server is sitting alongside a PostGIS instance, all run and created together using docker compose.
I have a number of cloud optimized GeoTIFFs (COGs) ...
3
votes
0
answers
38
views
Reading GeoTIFF from path and converting it into PostGIS raster data type
I need to read the raster file (DEM) from path directory and turn it into PostGIS raster data type. I formed this SQL query:
SELECT ST_FromGDALRaster(pg_read_binary_file('D:\dems\img.tif'))
FROM ...
0
votes
0
answers
12
views
No-Data in clipping .vrt file with GDAL
I am facing some problems while clipping the raster file with the polygon shapefile.
I have 8 GeoTIFFs with different projections (different UTM Zones). My aim is to clip these rasters to the extent ...
0
votes
0
answers
30
views
Convert GeoTIFF DEM to DTED level 2 (.dt2) without modifying bounds
I tried converting GeoTIFF DEM to DTED using GDAL with following command
gdal_translate -of DTED -outsize 1201 1201 -projwin_srs EPSG:4326 -co LEVEL=2 somefile.tif somefile.dt2
It gives a warning &...
0
votes
0
answers
26
views
Rasterizing GeoJSON in C# to generate TIFF file
I'm trying to use gdal and C# to rasterize a GeoJSON object to TIFF. I can get my code to compile and run but the image is coming up blank.
I'm not sure what I'm doing wrong. Maybe I need to specify ...
1
vote
1
answer
23
views
Create a bounding box for a GeoTIFF using GDAL on the commandline
How can I create a bounding box for a GeoTIFF using GDAL on the commandline?
I often have a folder of TIFFs that I want to generate GeoJSONs for.
I'd rather not make a Python script, since it's a lot ...
1
vote
1
answer
38
views
How to get information of raster in rasterio similar to gdal?
I would like to print the raster statistics from its header. This can be done in gdal using the commands.
gdalinfo dataset.tif
or in Python bindings
src = gdal.Open('dataset.tif')
info = gdal.Info(...
0
votes
0
answers
26
views
gdaltransform Cartesian transform change 2.2.0 to 3.4.1 proj.4 to?
Here are my results with 2.2.0 and 3.4.1. Can someone explain why this has changed?
echo -e "6720419.518191041 1878355.8391366536 1387.976960406033" | \
gdaltransform \
-s_srs "+...
0
votes
0
answers
11
views
Trying to extract a PNG from a WMS service using gdal_translate
I'm trying to run the following command
gdal_translate -of PNG -projwin_srs "-200357 200375 200375 -200305" -outsize 512 512 frmt_wms_openstreetmap_tms.xml openstreetmap.png
The ...
1
vote
0
answers
27
views
QGIS Graphical Modeler - Altitude offset / translation - Something wrong with my raster calculator (gdal) expression
I've recently started exploring QGIS' Graphical Modeler, and I want to build a model that will:
Iterate over a vector layer's features
Use these features as masks to extract from a raster
Calculate ...
2
votes
2
answers
73
views
Cannot import QgsVectorLayer from osgeo.ogr
I am trying to write a simple script to convert an ESRI geodatabase to a geopackage using gdal/ogr.
Here's the example I was using:
from osgeo import ogr
fgdb = r"C:\GIS\data\somefilegeodatabase....
0
votes
2
answers
38
views
Find distance from point to coastline
I have a layer of ~2 million line segments representing rivers, and a layer of ~300 000 line segments representing the coastline. I want to extract the river outlets.
I've tried a bunch of different ...
0
votes
0
answers
34
views
Shift rotated GeoTIFF
I have images that are rotated (pixels are not rectangular in X, Y but rotated ~8°). How do I shift this image and keep the rotation? I don't understand where the rotation information is kept to be ...
0
votes
0
answers
19
views
GDAL Installation Failing on CentOs Error: config.status: error: invalid argument: `src/proj_config.h'
I need a version of GDAL > 3 so I am installing from source and having an issue, this is the error I am getting.
make[2]: Leaving directory `/var/task'
12.28 cd .. && /bin/sh ./config....
0
votes
0
answers
24
views
Read KML file with GDAL/OGR and access all its attributes
I have a KML file and I'm trying to access a specific attribute named "styleUrl".
A feature of this KML looks like this:
<Placemark>
<name/>
<styleUrl>BoundaryStyle</...
0
votes
0
answers
24
views
GDAL warp removing half of the map
I am using gdal warp to transform a geotiff between espg:4326 to epsg:3857, I have successfully done this previously on similar images but with the current geotiff it doesn't seem to be working. I am ...
0
votes
1
answer
68
views
Python unable to import GDAL
I am trying to run a Python code with GDAL library. I've created the environment and installed GDAL and GeoPandas but the Python won't import the GDAL for some reason.
What am I doing wrong here?
Here ...
0
votes
0
answers
21
views
Retiling a mosaic from new coordinates using GDAL
I am trying to retile a large mosaic tiff that I have created, but re-clip the large tiff using some slightly different coordinates that I have created that allow me to introduce a little bit of ...
0
votes
1
answer
44
views
Incorrect geometry check from OGR and shapely
I have multipolygon and trying to check for validity. Both OGR(.IsValid()) and shapely (is_valid) return True. But if I open the same geometry with QGIS and check with theCheck Geometries plugin it ...
0
votes
1
answer
51
views
Converting map from 0 to 360 to -180 to 180
this is second part of How to convert VICAR data to TIFF.
I was able to get the VICAR data into TIFF form by using VICAR2isis to make a .cub then gdal to make a tiff. (Yes i eventually found out I ...
0
votes
1
answer
43
views
Converting VICAR data to TIFF
I want to convert the VICAR data found at this ASU link
to TIFF that I can use in ArcGIS Pro.
How am I able to do this?
0
votes
0
answers
23
views
Translate a JPEG image to NITF in C++? (maybe using GDAL?)
The following question is similar, and shows how to do translation from PNG to NITF on the linux command line using GDAL:
Performing gdal translate to png/jpeg?
I need to do something similar in C++. ...
0
votes
0
answers
15
views
GDAL 3.6.4 not building on Windows Server 2012 R2 machine
I am trying to build GDAL 3.6.4 on Windows Server 2012 R2 machine with VS2017 installed. These are the steps I am using:
cmake -G "Visual Studio 15 2017" -DCMAKE_BUILD_T
YPE=Release -...
0
votes
0
answers
29
views
Landcover GeoTIFF to MBTiles with gdal_polygonize and Tippecanoe
I am downloading GeoTIFF files from https://livingatlas.arcgis.com/landcoverexplorer and would ultimately like to turn that data into vector MBTiles files.
My process so far:
Download GeoTIFF
Use ...
1
vote
1
answer
51
views
Converting GPKG to GDB-Feature Class with gdal.VectorTranslate [closed]
I am trying to convert a geopackage (GPKG) to a ESRI GDB feature class using gdal.VectorTranslate(). My code is like:
translate_options = gdal.VectorTranslateOptions(format="OpenFileGDB", ...
2
votes
1
answer
81
views
Opening a Sentinel 2 imagery from AWS servers using Python rasterio module
I am trying to access this file from S3 using Python's rasterio:
"s3://sentinel-cogs/sentinel-s2-l2a-cogs/36/N/YF/2023/6/S2B_36NYF_20230605_0_L2A/"
I will be using these two bands : B08.tif(...
1
vote
0
answers
21
views
GDAL output 3-band RGB in Python
I am using the following code to output a floating point GeoTIFF file:
driver = gdal.GetDriverByName('GTiff')
outRaster = driver.Create(newRasterfn, cols, rows, 1, gdal.GDT_Float32)
...
1
vote
1
answer
41
views
GDAL DEMProcessing returning -9999 values
I'm working with some DEM data I've downloaded from the USGS and am trying to calculate the slope, aspect, and hillshade data of the TIFF file downloaded. Here is the code I'm using:
slope_cmd = "...
0
votes
1
answer
25
views
Raster to Vector GDAL raster conversion error QGIS 3.28
I'm trying to convert a raster layer with values 1 to 0 in vector layer using GDAL raster conversion - Polygonize (Raster to Vector) in QGIS 3.28.
After processing i got an error at the Log window:
...
0
votes
1
answer
49
views
Where is the GDAL configuration file after installing via OSGeo4W Setup
According to this post it is possible to tweak GDAL globally via the configuration file. On the GDAL website I found the supposed location of the file - $(USERPROFILE)/.gdal/gdalrc - unfortunately, in ...
1
vote
1
answer
29
views
Percentile values of a raster file are nan
I am trying to extract some statistics from all rasters in a directory and saving them into a CSV file using Python. The script works, but the results for all percentile values are always nan. Any ...
0
votes
0
answers
10
views
QGIS 3.22 dialogs sometimes adding extra backslashes to commands resulting in errors
Fairly frequently when I try to run raster commands in QGIS 3.22 (and earlier versions of Q3), I can't get the command to run because it appears that the GDAL command adds extra "". For ...
1
vote
0
answers
29
views
MRR build for GDAL version 3.7
Precisely provide MapInfo MRR Raster SDK Binaries and GDAL plugin for QGIS (https://support.precisely.com/product-downloads/item/mapinfo-mrr-sdk-download/), however the plugins are specific to ...
1
vote
1
answer
72
views
Getting UTM coordinates from TIFF
I am trying to extract UTM coordinates (in meters) of every pixel in a TIFF file using the following syntax in Python.
tifImage = rasterio.open(tif_file)
dx = tifImage.transform[0]
dy = tifImage....
0
votes
1
answer
38
views
Passing geometry dataset type to gdal.Warp() for a clip operation - order of operations and file type confusion
Trying to wrap my head around the correct order of operations and file type(s) required by gdal.Warp().
I have a valid geometry object created from the shapely object.unary_union.convex_hull method. ...
2
votes
1
answer
40
views
Does QGIS and GDAL result in a loss of clarity when converting a 16-bit image to 8-bit?
I am converting a 16-bit image to an 8-bit for an ML dataset.
The conversion script considers the min and max values of each band instead of a linear scale from 0-65535 to 0-255. However, the 8-bit ...
0
votes
1
answer
28
views
Create vector from boundary of raster GDAL or QGIS
I have a DEM, a.vrt from HEC-RAS model. It's massive. Approximately 100k X 100k pixels. I need to trace it's boundaries. So everywhere that's not NaN.
My current workflow is:
Create new raster ...