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
3
votes
1answer
82 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
62 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
79 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
59 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
29 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
78 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
2k 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
183 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....
0
votes
0answers
78 views

Using GDAL Java Library on MacOS

I'm using GDAL 2.4.1 on MacOS. Now I want to write a small application using the GDAL Java Library. It appears to be just a bridge between my code and the native GDAL Libraries, therefore I have to ...
0
votes
1answer
76 views

Get maximum pixel value within numeric range

I am working with MODIS Global Primary Production (GPP) rasters and I am trying to pick the max GPP pixel value in a series of 15 dates for a study area and create a new raster layer. MODIS GPP ...
0
votes
0answers
352 views

TypeError: 'int' object does not support item assignment

I am trying python for the first time. I have a raster layer of Type Float32, and another raster output of Type Integer created from this raster layer outside the python code. I want to scan every ...
0
votes
0answers
40 views

gdallocationinfo behaviour from windows to linux

I used NETCDF for many years on windows (using GDAL ) now recently i tried on Linux for netcdf data value.I used gdallocationinfo on windows for retrieving atmospheric parameter value from netcdf ...
0
votes
0answers
20 views

Gdal_calc changing the values incorrectly

I am trying to re-project a file to a uniform grid EPSG:4326 and for that I am using the command: gdalwarp -t_srs EPSG:4326 -srcnodata -32767 HDF5:"LC08_L1TP_029037_20190611_20190611_01_RT_L2GEN_2.nc"...
1
vote
0answers
70 views

qgis gdaltransform versus OSGeo.OSR.CoordinateTransformation

I have implemented a simple coordinate transformation test in c# using GDAL 2.4.1 downloaded from https://www.nuget.org/packages/GDAL/. When comparing the result with gdaltransform (QGIS 3.4) and EPSG....
2
votes
0answers
118 views

Change corner coordinates GEOTIFF

I have a geotiff and I have the corner coordinates set using gdal_translate and the a_ullr argument setting out the min/max long/lat. This provides a bounding box for the geotiff to be projected. But ...
2
votes
1answer
34 views

PostgreSQL- query a raster by XY

Windows 10, PostgreSQL 11 I successfully managed to export a .tif raster into PostgreSQL using raster2pgsql: raster2pgsql -s 27700 -I -C -M -Y "D:\Data_Location\country.tif" -F -t 50x50 public....
2
votes
2answers
22 views

Information in gdalinfo not shown

I have a geotiff and I checked it's metadata using gdalinfo.exe: Driver: GTiff/GeoTIFF Files: C:/image_test.tif Size is 3956, 34151 Coordinate System is `' GCP Projection = GEOGCS["WGS 84", ...
1
vote
1answer
49 views

Values change after re-projecting the NetCDF files to TIFF file

I am trying to re-project a NetCDF file to a uniform grid EPSG: 4326 and convert it to a TIFF file. However, after the GDAL re-projection the values in the file change, i.e. the values are not ...
2
votes
2answers
123 views

OGR: Load layer with sql statement and write to new data set

I am having difficulties after loading a shapefile with a sql statement with ogr. The layer and its features seem to be correctly loaded. Still I am not able to write them into a new shapefile or pass ...
0
votes
0answers
85 views

Fail to import gdal from conda environment?

I installed gdal from this link: http://www.gisinternals.com/query.html?content=filelist&file=release-1911-x64-gdal-3-0-0-mapserver-7-4-0.zip When I use the the following command from this ...
0
votes
0answers
207 views

How to convert Lat, Lon, Alt to ECEF and EPSG 4979?

I am programmatically generating data to use in Cesium's 3D Tile System. The data I have is in (Latitude, Longitude, Altitude) format. To display the data in Cesium, I have to first define a region to ...
3
votes
1answer
65 views

How do I combine GeoTIFF files covering the same area but storing different data into a single file?

I have shapefile cutouts (same shapefile across all images) of different GeoTIFF rasters (with different metadata and sometimes resolutions). How do I merge them into a single GeoTIFF file? I'm well ...
1
vote
0answers
87 views

What would cause a Cesium 3D-Tiles tileset to not even request it's content?

I am generating an I3DM through Python. I know that the I3DM is probably ok, since the 3d-tiles-tools allow me to extract the binary GLTF file from it. However, when I go to render the tileset in ...
0
votes
0answers
22 views

How to make sure GDAL Java binding doesn't crash my whole application?

I'm using GDAL Java binding to convert some files (ogr2ogr), such as shapefile to GeoJSON. The problem is when something goes wrong it crashes the whole application and I have to start it up again. ...
1
vote
0answers
41 views

File Size Limits with MBtiles

I'm running into an issue where my MBtiles files are exceeding the max file size for the file system when created with gdal. Is there a known method of creating a set of mbtiles files that don't ...
0
votes
0answers
63 views

Creating color relief from GeoTIFF using gdaldem returns font name

I'm trying to generate a color relief map from a SNODAS greyscale geotiff file scaled from 16-bit to 8-bit. Given the type of data and the scaling, it seems the pixel values are set at 1-5, with 5 ...
5
votes
2answers
132 views

Improving quality of tiles generated from Ordnance Survey Raster Data

I'm trying to generate some map tiles based on the Ordnance Survey Open Data (available from here). I don't have much experience with this, but I've read a few tutorials online and have managed to ...
1
vote
1answer
565 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.
3
votes
1answer
58 views

Generate a viewshed and merge it with another image using GRASS/GDAL command line? [closed]

I've found a tutorial showing exactly what I want to do (merge viewshed and hill shade or map) but unfortunately it is for QGIS users and I need it in pure command line instructions because I'm in a ...
1
vote
0answers
55 views

GDAL ZIPDecode:Decoding error [closed]

I work with large many (tens of thousands) of large (0.1-10 gigabytes) rasters in GDAL and Python and occasionally will see the following error: ERROR 1: ZIPDecode:Decoding error at scanline [XXX], ...
1
vote
2answers
28 views

How to use gdal_contour to APPEND data?

I'm trying to import contours from SRTM HGT files. First try (nice): gdal_contour -f PostgreSQL -a elevation -i 10 srtm/S01W069.hgt "PG:host=volcano-db user=postgres password=guesswhat dbname=...
0
votes
1answer
33 views

gdal FlattenTo2D makes geom null

I have a df that has geoms as ogr geom in 3D. I was trying to convert to 2D but it empties out the geom. ipdb> df['default_geom'][0] <osgeo.ogr.Geometry; proxy of <Swig Object of ...
0
votes
1answer
107 views

GDAL Calc Set Specific Values to Another Number

I have a GeoTiff raster with a format of Float32 and values 0.00 to 5.00. I am attempting to change all raster cells with a value below 0.10 to 0.10, and leave all other cells in the raster dataset ...
2
votes
0answers
36 views

HGT Elevation vs Calculated Elevation

I wondering how to interpret the elevation calculation. Per example. We are in Canada and I use SRTM3 files. I use the GDAL library to extract my elevation, everyting is ok, except: Why (or how) the ...
0
votes
1answer
108 views

Transforming a image to a shape defined by image corners in earth coordinates - Python

I have a source satellite image. It is a rectangular shape x by y. I also have the stored lon/lat coordinates of the corners and the center point in the xml meta file. Is there a way with the gdal or ...
0
votes
0answers
16 views

NDFD Grib2 geotransform

I am trying to transform the projection for my data in grib2 format to long/lat, but I'm not sure I'm using the correct EPSG. The data says it uses a "Lambert_Conformal" projection with a WGS84 ...
0
votes
0answers
127 views

Convert a raster to a polygon with gdal in command line

I want to convert a raster (agric.tif) to a polygon layer (agric.shp). I want to use gdal in command line since the QGIS (raster to polygon) seems to takes for ever (still running over an hour). I am ...
0
votes
0answers
35 views

Ouput of gdalinfo.exe --formats

I would like to get the output of the following command : gdalinfo --formats > formats.txt In Linux, it works In Windows, it works but the output is not completed. Do you know how to get the ...
0
votes
0answers
102 views

GDAL OGR Polygon.Contains(Point) returns false but point is contained in QGIS map

I'm sure I must be missing something here but for the life of me I can't see what it might be. I have been struggling for the last hour with an issue with the Contains() method in OGR. I am iterating ...
0
votes
1answer
153 views

Grib Metadata with GDAL in Python

I'm trying to use GDAL in python to conditionally select raster bands from a grib file based on the time when the weather feature was measured (think temperature). If I run GetMetadata() on the ...
0
votes
1answer
48 views

gdal_grid does not work in cron but works in terminal

I use the gdal_grid interpolation command. When I work in the terminal everything works perfectly. However, when I try to run the command in the bash script from cron then it does not work. Bash ...
1
vote
0answers
70 views

Filtering anomalous pixels from masked raster in Python?

I am struggling to succesfully filter out anomalous pixels from a Sentinel-1 image band mask (Pixel based), produced in Python. I am new to Python. By anomalies, in this situation, I mean ...
2
votes
2answers
388 views

Averaging overlapping rasters with gdal

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 ...
1
vote
1answer
101 views

Cropping GeoTIFF to square at specific lat/long for use as Unity 3d terrain heightmap?

I have some GeoTIFF files that contain elevation data. I have an area defined by latitude and longitude, and I would like to extract the elevation as a heightmap from the GeoTIFF files to use in Unity....
3
votes
1answer
167 views

GRASS GIS producing different slope than GDAL?

When producing a slope in GRASS GIS 7.4 the results are different than with QGIS (GDAL) and ArcMap for the same input data and same parameter (Z ratio is 1.0 and degrees). QGIS and ArcMap generate ...
2
votes
1answer
80 views

Reading large image using GDAL?

I want to read large image. The image size is 92117 x 30313 pixels. So far I know cv2.imread can not read large size. How can I read using GDAL API?
1
vote
1answer
111 views

Clipping tiff image with a bounding box with GDAL in Java

Since GDAL 2.1 GDAL and OGR utilities can be used as library functions, so this task is incredibly simple now: from osgeo import gdal ds = gdal.Open('original.tif') ds = gdal.Translate('new.tif', ds,...
1
vote
3answers
186 views

Numpy masked array to raster

I am trying to transform a masked array, result of a NETCFD4 file, to a raster. The array is saved as a masked array, with shape (500,805), and the mask is the value 32768.0. The array looks like: ...
3
votes
1answer
126 views

Seeking code behind Fix Geometries tool in QGIS?

I used the very nice "Fix Geometries" tool in the Processing Toolbox of QGIS 3.6 to repair a vector layer that was giving me trouble. The tool in QGIS worked just fine, but I was hoping to find out ...
1
vote
1answer
69 views

Invalid geometry error after polygonizing a GeoTIFF file

I wanted to clip an OSM vector layer with the boundaries of a raster image--a GeoTIFF file. I was able to polygonize the raster and obtain its boundary in a vector format. But I am getting a error ...