Skip to main content

Questions tagged [gdal-python-binding]

A Python package with extensions and tools for programming and manipulating both GDAL (raster) and OGR (vector) data.

Filter by
Sorted by
Tagged with
0 votes
0 answers
24 views

GDAL Warp extremely slow on Python API

I am trying to export one VRT to TIFF using GDAL Warp. My VRT has some scale, offset, reprojections, etc, but nothing too crazy. I have observed that trying to perform the warp from the Python API is ...
Guillermo Moreno Castaño's user avatar
0 votes
1 answer
144 views

gdal_translate (python) seems to fail with (arbitrarily?) different window

I'm trying to take a satellite image tile (Sentinel 2, product 2A) and crop it to a smaller window using lat lon coords. I've created a tiff image combining all of the different Sentinel 2 bands using ...
Conrad S's user avatar
  • 103
0 votes
1 answer
598 views

Suppressing GDAL/Python logging

I'm using GDAL to clip lots (>100k) of small files from a large one with: translate = 'gdal_translate -epo -eco -ot Byte -b 1 -co NUM_THREADS=6 -co COMPRESS=DEFLATE -co PREDICTOR=2 -co ZLEVEL=...
Patrice Carbonneau's user avatar
0 votes
1 answer
225 views

Can GDAL georeference a (KML) ground overlay?

I'm using GDAL to georeference an image, but can't seem to find the information that I need. In the sample code below the upper left (ul) and lower right (lr) corner coordinates denote not the corners ...
Caterpillar's user avatar
2 votes
0 answers
319 views

GDAL's ReadAsArray() incredibly slow when reading an in-memory raster?

So I have a script set up in a conda environment on macOS Catalina running python 3.7, I'll post a paraphrased version of it: from osgeo import gdal import numpy as np grib_url = '/vsicurl/...
JWB's user avatar
  • 604
4 votes
2 answers
10k views

Installing GDAL on Windows 10 using binaries for command line functionality

I figured that I would ask this question hoping that someone finds a document or provides a description that actually works. I've followed countless sites, GitHub issues, and other forum posts but ...
lve's user avatar
  • 141
1 vote
1 answer
332 views

GDAL couldn't create raster with equal shape

I am trying to carry out pixel by pixel correlation for each image in a time series vs another 1d array of data. To do that, the arrays coming out of the raster files must be identical in shape. ...
wondim's user avatar
  • 1,383
1 vote
1 answer
129 views

GDAL's Python wrappers don't load correct asc header informaton

I have a Python script that I am using to load .asc raster files and then work with the contents therein. However, it isn't loading the correct information that is specified in the headers. The .asc ...
R. M. Spies's user avatar
3 votes
1 answer
985 views

GDAL Python API - statistics valid percent information

I would like to know if the STATISTICS_VALID_PERCENT (percentage of valid (not nodata) pixels) information is accessible through the GDAL Python API? It seems to be missing from the GetStatistics ...
Brent Edwards's user avatar
0 votes
0 answers
357 views

gdal.Warp workingType option default

I have been using gdal.Warp() in Python 3.6 for some time now and have just noticed the workingType option (see here for gdal.WarpOptions()). From its definition: workingType --- working type (...
tda's user avatar
  • 531
2 votes
2 answers
210 views

can't calculate numeric field with ogr python

I have created two functions: one to add a field to a layer and one to calculate a field. I am having issues with the calculate field function when trying to calculate values for a numeric column. I ...
kflaw's user avatar
  • 1,416
5 votes
1 answer
1k views

Compress GTiff External Overviews with GDAL API

Is it possible to build compressed external overviews with the gdal API? I see examples of using gdaladdo with a COMPRESS_OVERVIEW option passed to the configure flag, but I don't see an equivalent in ...
Rich's user avatar
  • 1,589
6 votes
1 answer
3k views

How to let ogr/gdal CreateLayer() create a `geom` field instead of `wkb_geometry`?

When creating a new table (PostGIS) using OGR/GDAL (2.1+), is there a way to select a specific name for the geometry field (such as geom), rather than using the default name? I created a new table ...
tinlyx's user avatar
  • 11.1k
2 votes
1 answer
2k views

Can I find the pixels of tiff file for given lat long if I have this information?

Driver: GTiff/GeoTIFF Files: correctly_merged.tif Size is 44835, 26402 Coordinate System is: GEOGCS["WGS 84", DATUM["WGS_1984", SPHEROID["WGS 84",6378137,298.257223563, ...
Leo's user avatar
  • 33
1 vote
0 answers
434 views

Unable to update features in tables without FID: How to use gid field as the FID column with ogr/gdal python?

I'm trying to update a PostGIS table using the SetField() method in python. The table is imported from a shapefile with pgsql2shp so it has a gid field, which can be used as FID or primary key. ...
tinlyx's user avatar
  • 11.1k
0 votes
1 answer
2k views

Module has no attribute Warp?

I'm using GDAL v2.14 on my Windows 10 machine. In that environment, I have two gdal python bindings. One is import gdal, the other is import osgeo. I installed Python's gdal using http://www.lfd.uci....
Matthew Mage's user avatar
5 votes
2 answers
1k views

How to merge 2 tile sets?

How to merge 2 overlapping tile sets into one tile set? What gdal utils can be used for that? By tile set I mean folder with tiles produced by gdal2tiles If it matters tiles are in .png format.
mrgloom's user avatar
  • 621
1 vote
1 answer
971 views

Installing Python bindings for 64-bit Python on Windows

I installed GDAL and its Python bindings from GISInternals. While I believe that GDAL was installed correctly, the Python bindings have an issue. After opening a file with gdal.open I cannot read ...
Thomas Becker's user avatar
1 vote
1 answer
936 views

Using GDAL's Python Bindings, how can I download an entire Layer?

I'm trying to write a Script, which will download an entire WFS layer to Disk. The output format could be GeoJSON, Spatilite or even Shapefile. I know how to do this using ogr2ogr, but I need to use ...
Devdatta Tengshe's user avatar
10 votes
0 answers
352 views

Cannot Open VRT of Sentinel2 image created by AutoCreateWarpedVRT [closed]

I am trying to create a warped VirtualRaster of a Sentinel2 image. Here the Python code I tried: from osgeo import gdal, osr srs = osr.SpatialReference() srs.SetFromUserInput('EPSG:32632') gdal....
Corrado's user avatar
  • 101
5 votes
2 answers
15k views

gdal_merge.py can't find libgdal.so.20

I am having some trouble with GDAL (v2.1-dev). I build it from source today using Poppler and OpenJPEG. All the command line utilities work fine, but none of the Python plugins work at all, ...
nronnei's user avatar
  • 568
1 vote
0 answers
601 views

How to build gdal_calc.py from source in MinGW

I was wondering how to build the gdal python binding from source using MinGW. In particular, I need to install python utility scripts such as gdal_calc.py. I've searched around and found this ...
tinlyx's user avatar
  • 11.1k