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
0
votes
1answer
9 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
20 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 ...
0
votes
1answer
25 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
46 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
0answers
35 views

Hacks to make Python scripts faster? [on hold]

I've got a GDAL/OGR-based Python script that's drawing buffers around roads. In any particular area, it goes road by road (feature by feature) drawing a buffer around a road, and appends that road's ...
0
votes
0answers
13 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
12 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
41 views

Obtaining geographic coordinates of satellite images using Python? [closed]

Using a satellite image of a band it is possible to obtain the geographic coordinates and the value of the color in a matrix. I just obtained an array using GDAL but it just represents the colors of ...
0
votes
0answers
24 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?
0
votes
0answers
28 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
0answers
24 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 '...
0
votes
1answer
30 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
17 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
22 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
19 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 ...
0
votes
0answers
19 views

Unable to merge rasters: ImportError: DLL load failed: The specified module could not be found [closed]

I have recently come across an issue that I can't figure out how to solve. I am trying to merge two rasters (which I have previously done successfully on QGIS 3.4) however I keep getting this error ...
2
votes
1answer
40 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
45 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
41 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. -----------------------------------------------------------...
1
vote
1answer
38 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
19 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
51 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
26 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
46 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
23 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 ...
0
votes
0answers
19 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
27 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
50 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
54 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
45 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 ...
-1
votes
0answers
27 views

Extracting Z coordinate from DEM - Python

I'm writing an algorithm in Python to extract Z coordinate of an DEM for a pair of X,Y coordinates. I'm using GDAL. The algorithm works correctly by extracting the Z coordinate from the DEM: Z = ...
0
votes
0answers
20 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
87 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
45 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
13 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
46 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
33 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
22 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
60 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. ...
1
vote
1answer
199 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
0answers
43 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
20 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
49 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
57 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
31 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
14 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
47 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
29 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
31 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
21 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", ...