New answers tagged

1 vote

Rendering single-band raster in Python with set color ramp

import rasterio import matplotlib from matplotlib import pyplot as plt import matplotlib.colors rasterfile = r"/home/bera/Desktop/gistest/nvdi.tif" dataset = rasterio.open(rasterfile, mode=&...
BERA's user avatar
  • 71.2k
0 votes

Python: gdal.Warp how to crate mosaic and don't save?

#use EMPTY '' AND FORMAT = "MEM" from osgeo import gdal a = 'C:/Users/ja/Inne/Desktop/73776_931613_M-34-46-C-d-3-3.tif' b = 'C:/Users/ja/Inne/Desktop/73776_933044_M-34-58-A-b-1-1.tif' ...
Олег Цой's user avatar
1 vote
Accepted

How to use the 'sqlite' dialect in ogr2ogr queries when one of the GeoJSON property fields is "id"

GeoJSON defines a special meaning for "id" in https://datatracker.ietf.org/doc/html/rfc7946. If a Feature has a commonly used identifier, that identifier SHOULD be included as a member of ...
user30184's user avatar
  • 64.5k
1 vote

GDAL /vsicurl/ does not use range requests

Ok, after some more investigation, it turns out this issue has apparently been fixed in later versions of GDAL; 3.6.0 has this issue, 3.7.0 does not. Possibly related to https://github.com/OSGeo/gdal/...
Liedman's user avatar
  • 1,073
0 votes

How to read geoDataFrame into GDAL function?

The standard GDAL python bindings don't interface very easily with geopandas, as you noticed. There are several alternatives available though. They also use GDAL under the hood, but they have a "...
Pieter's user avatar
  • 1,465
0 votes

Installing GDAL for Python

If you already use OSGeo4W, just install its python-gdal package. Otherwise you are mixing potentially (or rather, probably) incompatible packages. Also, OSGeo4W comes with its own, isolated Python ...
bugmenot123's user avatar
  • 11.2k
0 votes

Installing GDAL for Python

An alternative option is to use the conda package/environment manager. You can install e.g. miniforge start the installed "Miniforge prompt" create a new environment with e.g. the name gdal ...
Pieter's user avatar
  • 1,465
0 votes

Installing GDAL for Python

I found the version I needed here: https://download.lfd.uci.edu/pythonlibs/archived/GDAL-3.4.3-cp311-cp311-win_amd64.whl Note this needs Python 3.11 and it will not work with Python 3.12. After ...
Fernando Soares's user avatar
1 vote
Accepted

Create copies of rasters in R via GDAL

The code below should be roughly equivalent to gdalmanage, and would work for the general case of a GDAL dataset which could be multi-file. It calls GDALCopyDatasetFiles(). GDAL needs to open the ...
Chris Toney's user avatar
3 votes
Accepted

Why doesn't `gdalinfo` with `json` flag report searched but not found attributes?

There is actually a json schema file for gdalinfo. Initially it was added more than a year ago due to this feature request https://github.com/OSGeo/gdal/issues/6850. The file has been moved into ...
user30184's user avatar
  • 64.5k
0 votes

Zoom level with gdaladdo

There is a hardcoded limit of z22 in the GDAL MBTiles driver that affects some operations. See this bug report https://github.com/OSGeo/gdal/issues/3126 The GeoPackage raster driver supports now zoom ...
user30184's user avatar
  • 64.5k
0 votes

Finding pixel location in raster using coordinates?

Another way to do this is to use the rasterio.transform.rowcol() method described in the rasterio transform docs. I have been using this, but while dealing with tens of thousand of latitudes and ...
Alex Punnen's user avatar
3 votes

QGIS 3.28/GDAL Unable to export ESRI file geodatabase layer to PostgreSQL

Of course it was an ESRI issue. Not an open source one. When the source CSV was imported into the file geodatabase, the date fields were all added using the DATE ONLY format. This format is not ...
Mike Smith's user avatar
0 votes

SQL functions supported by ogr2ogr

For the non-geometry columns, one can refer to the list of SQLite functions: https://sqlite.org/lang_corefunc.html
zabop's user avatar
  • 1,810
1 vote
Accepted

How do I set the result of a SELECT query equal to a new column in a GPKG file using ogrinfo?

Using ogr2ogr sql0="ALTER TABLE example ADD COLUMN col1 TEXT;" sql1="UPDATE example SET col1 = CONCAT(col0, col0);" ogrinfo -sql "${sql0}" example.gpkg ogrinfo -sql &...
zabop's user avatar
  • 1,810
0 votes

ECW support in GeoServer?

check my repo: i used original Docker Image docker.osgeo.org/geoserver:2.25.x, and built GDAL 3.8.3 with ECW SDK 5.5.4 https://github.com/cetindogu/geoserver-with-ecw
Çetin DOĞU's user avatar
4 votes
Accepted

Why can ogr2ogr upload data to a not previously existing table faster than to an existing empty one?

I believe that the difference comes from this documented feature https://gdal.org/drivers/vector/pg.html#configuration-options PG_USE_COPY=value: This may be "YES" for using COPY for ...
user30184's user avatar
  • 64.5k
3 votes
Accepted

ST_CLIP with one raster and one polygon

I have a raster table named nh, and a polygon table named polygon. I want to clip raster with rid=1 with polygon with id=1: CREATE TABLE test.clipped_raster AS SELECT 1 AS id, st_clip(r.rast, p.geom) ...
BERA's user avatar
  • 71.2k
0 votes

GDAL loop through gpkg layers

As it was mentioned in a comment that python is also an option... this is how you can do it using the geofileops package import geofileops as gfo path = r"C:\Temp\lds-nz-building-outlines\nz-...
Pieter's user avatar
  • 1,465
0 votes

Use gdal_translate on an orthographic PNG image of the Earth centered at Lat=+50N Lon=+5E to proper orthographic GeoTIFF format

To translate a full disc PNG image of the Earth in orthographic or perspective to a proper geotiff you must include the geographic limits in metres... This is the radius of the Earth (~6367444.65 ...
Molly's user avatar
  • 35

Top 50 recent answers are included