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
2answers
28 views

Transforming raster with gdal.Warp

I am trying to transform a raster with gdal.Warp in my own python script. Example: In the src raster one pixel presents 5 meters and I am trying to transform it where one pixel would present 6,5 ...
0
votes
1answer
111 views

Preventing GDAL-dissolve from ignoring attribute encoding?

Given a huge shapefile which needs desolving by one attribute field to reduce redundancy. The GDAL dissolve functionality does that quite swiftly but the output attributes change the encoding so äöü ...
0
votes
1answer
244 views

How I can remove the gap between the mosaic image

I tried to mosaic the 2 Landsat images through (gdal_merge.py stacklayer.tif stacklayer_1.tif -o mosaaic.tiff) following output come How I can remove the gap although there projection is same ...
1
vote
1answer
24 views

Check if function-argument is valid vector-geometry in Python GeoPandas

I wanto to build a function (let's call it clip) that accepts a vector-file (can be a shapefile, a geopackage....) and a raster. How can I make sure the argument that the users gives to the function ...
0
votes
1answer
675 views

Getting OGR to work on a Mac

I downloaded GDAL on my Mac (running Mojave 10.14.1) through Homebrew and I'm having trouble getting OGR to work with Postgresql. When I try the following to create a geojson from gpx files I have, I ...
1
vote
1answer
20 views

Connecting MapServer to a raster table in PostGIS

I am new in MapServer and I want to visualize some raster tables in MapServer. My mapfile is: MAP CONFIG "MS_ERRORFILE" "error.log" DEBUG 5 NAME "milad" STATUS on SIZE 600 600 EXTENT -8321547 ...
4
votes
0answers
26 views

OGR failing to unpack polygons and respective holes from shapefile

I'm trying to unpack shapefiles in Python (v3.7.4) using the GDAL-OGR library (v2.3.3). Each shapefile has only one feature containing multiple polygons with holes. They cannot be produced differently....
1
vote
1answer
33 views

Generate an empty large raster using GDAL?

Using GDAL, how can I simply create an empty single band raster? I can't seem to find out how. I know in PostGIS you can create a new table with a 'raster' column type, then insert a band into it. ...
1
vote
1answer
25 views

How to convert SPL2SMAP_S data (available in .h5 files) to *.tiff files?

I had downloaded some data from https://nsidc.org/data/SPL2SMAP_S The description of the data is given in the page. Using an earthdata login, one can download the data. The data consists of *.xml and *...
2
votes
1answer
121 views

Specifying pyproj lat and lon in radians

I'm using pyproj to do some conversions: import pyproj myprojection=pyproj.Proj('+proj=gnom +lat_0=1 +lon_0=1 +R=1.') print myprojection(30,30) Out: (0.5480783303637778, 0.6353400942474053) Now I ...
1
vote
0answers
22 views

prevent ogr2ogr from generating new fid attribute field

I am exporting data from PostGIS to gml using python script with ogr2ogr. But the output generates unwanted new field "fid" that contains the following string: "sql_statement.0" , "sql_statement.1", ....
1
vote
1answer
23 views

GDAL Virtual File System (vsitar, vsizip, vsicurl) not working

I want to access a landsat tar file like : gdalinfo "/vsitar/vsicurl/https://dds.cr.usgs.gov/ltaauth/hsm/lsat1/collection01/oli_tirs/T1/2018/146/039/LC08_L1TP_146039_20180119_20180206_01_T1.tar.gz?id=...
0
votes
0answers
14 views

How can I mosaic list of osgeo.gdal.Datasets and add overlapping grid cells?

I have a list of osgeo.gdal.Datasets that I created from a list of numpy arrays containing geo-referenced ice velocity values for a glacier. I would like to merge these all into a single mosaic and ...
4
votes
1answer
605 views

st_clip and gdal_translate: “Error browsing database for PostGIS Raster properties” - Why?

I'm using shell-script, PostGIS 2.0 and GDAL for trying to clip raster apart, using an overlapping raster and a the_geom-object. At first I create a view to clip the overlapping part of the raster. It ...
11
votes
2answers
1k views

Accessing file geodatabase (.gdb) rasters with GDAL?

I'm working on a tool that converts raster layers to arrays for processing with NumPy, and ideally I would like to be able to work with rasters that come packaged in a .gdb without exporting them all (...
9
votes
7answers
6k views

Raster reclassify using python, gdal and numpy

I would like to reclassify a raster file from a raster with 10 classes to a raster with 8 classes using pyhton, gdal and/or numpy. The classes are represented as integers. I have tried following the ...
3
votes
1answer
141 views

Add RGB values from CPT file to Int16 GeoTIFF using Python and Gdal

I want to add color, using RGB values stored in a CPT file, to a black and white Int16 GeoTIFF file using Python. I tried to use SetColorEntry(), but when I add the ColorTable to the RasterBand, I ...
2
votes
1answer
28 views

How to install additional driver to GDAL installed with apt-get

I have installed GDAL 2.2.3 on Ubuntu 18.04 using apt-get. I'd like to add the GeoJSONSeq driver. How can this be done?
0
votes
1answer
121 views

Reprojecting GeoTIFF from WGS84 to UTM with gdalwarp?

I have a GeoTIFF image in WGS84 and when I try with gdalwarp to reproject to UTM, it has a problem. Size of TIFF is J: 15769, W: 60027 J_LeftTop:2.0705046510 W_LeftTop:0.4974727391; J_RightTop:2....
0
votes
0answers
16 views

How set precision of point of polygon with OGR/GDAL in Python [closed]

I try to transform lot of geometry of shape to other projection, but when OGR take input geometry for rewriting, he can't because sometimes the geometry is too long. How I can solve that? I use OGR ...
1
vote
2answers
52 views

How do I merge .xyz tiles to one .tiff?

I am new to GIS and I want to merge xyz tiles to one raster tiff. Here is the source to the xyz files: dgm1_05314000_Bonn_EPSG4647_XYZ.zip I have downloaded the tiles as .xyz files, then sorted the ...
2
votes
1answer
38 views

QGis 3.4: GPKG vector layer with object form (relations with spatial and non-spatial datasets) to postgres database

I have QGis project with a geopackage included. One layer in the geopackage contains a attribute form with relations to other layers (spatial and non-spatial). I have to convert it to a postgres ...
0
votes
0answers
26 views

Illegal GeoJSON after converting from a copied SHAPE file [closed]

I am converting a copied SHAPE file into GeoJSON and for some reason the GDAL library is generating an illegal GeoJSON, see details below {"type": "FeatureCollection","features":[{"type":"Feature", "...
1
vote
1answer
41 views

System.ApplicationException: 'EPSG PCS/GCS code 4326 not found in EPSG support files. Is this a valid EPSG coordinate system?'

I have setup a consol app in C# that uses the GDAL.CORE NuGet, it seems to work fine when converting most of the .shp files I have, however with one .shp file I am getting the error below: System....
0
votes
0answers
29 views

QGIS use multiple rasterfiles: virtual raster with Python

I'm new to QGIS (using version 3.4). I'd like to make our raster files ready to use. There are 5k rasters in one folder with several subfolders. What's the best way to display them all in QGIS? I ...
1
vote
0answers
19 views

How to correct slight mismatch of Sentinel 1 GRDH and coastline shapefile?

I'm currently working on Sentinel 1 GRDH data with R (raster, rgdal, sp, rgeos, maptools ...). The geocoding of Sentinel data was made by the following command: gdalwarp(srcfile=paste0(root,"...
1
vote
1answer
238 views

Java unsatisfied link error at runtime

I'm getting an unsatisfied link error when running gdal.AllRegister() in my java application running on AWS Lambda. java.lang.UnsatisfiedLinkError: /var/task/lib/libgdaljni.so: libgdal.so: cannot ...
1
vote
1answer
278 views

NotImplementedError: Wrong number or type of arguments for overloaded function 'CoordinateTransformation_TransformPoint'

Hello I am new to working with GeoTiff data and I am trying to grab lat/lon values from a tiff image. Here is my code: import gdal import matplotlib.pyplot as plt import osr # open the dataset and ...
2
votes
0answers
35 views

Build Mosaic using gdal based on Modal value

I have an immense (~50,000) set of tiles that I want to mosaic using the mode for every pixel. The tiles have a size of 299x299 and are overlapping each other by 2/3 respectively. For the sake of ...
2
votes
1answer
38 views

Changing projection from 0 360 to -180 180 for a simple raster

I'm trying to convert a raster with projections of (0, 360) to (-180, 180), and I've tried various SO solutions such as this, but it gave me a cropped output that doesn't have the western hemisphere. ...
3
votes
1answer
255 views

rgb2pct.py increases size of file 20 fold!

I wanted to reduce the number of bands of a tif file from 3 to 1... I used this command rgb2pct.py -n 256 fnp_braunschweig.tif fnp_bs.tif and it increased the size from 31mb to 778mb I actually ...
0
votes
1answer
28 views

Create VRT from multiple hdf files with Rasterio/GDAL

I have several Landsat 8 Scenes, each consisting of 11 bands. I want to mosaic them by creating a VRT and afterwards exporting the mosaic as TIFF again. I tried using GDAL via Python. But maybe it ...
1
vote
1answer
664 views

GeoDjango can't find GDAL:

I'm following this tutorial: https://docs.djangoproject.com/en/2.2/ref/contrib/gis/tutorial/, I installed every component necessary. But it seems like Django can't find the gdal module. I have gdal ...
0
votes
0answers
31 views

Conversion from shapefile to GeoJSON fails with large shapefile [closed]

I just noticed that the conversion from shapefile to GeoJSON fails when the shapefile is too large, in my case the shapefile is 400 MB. The converted GeoJSON has coordinate values that are bigger ...
1
vote
1answer
23 views

Creating shapefile layer with OSGeo4W shell

I want to create an new empty shapefile with OSGeo4W shell. Is there a command line like: gdal_create -f "ESRI Shapefile" -wkt "point" -srs "EPSG:31256" -o output.shp
1
vote
0answers
23 views

Saving TIFF file in database with GeoDjango

I am trying to save a TIFF file in database with GeoDjango, but I get weird errors at dem.save(). Versions: Python: 3.7 PostgreSQL: 11 Django 3.0.2 django.contrib.gis.gdal.gdal_version(): 2.4.0 ...
2
votes
1answer
44 views

Rasterising multiple shapefiles into a single raster

I'm not even sure you can do this, but I want to convert multiple shapefiles into a single single-band raster. I'm pretty sure its going to be easier to first create a multi-band raster and then use ...
1
vote
0answers
37 views

Getting pixel size without opening raster using Python [closed]

I want to get the pixel size (resolution) of a raster without opening up the raster in gdal. I currently have my script opening the raster in GDAL using gdal.Open() and getting the resolution that way....
1
vote
0answers
36 views

Recenter maps to overlap in GDAL [closed]

I have a really basic question which I can't wrap my head around. I have a GeoTIFF of the world and a shapefile containing the oceans. The problem is that the GeoTIFF is centered at -180° longitude ...
1
vote
1answer
34 views

Get shortest/fastest path between two points from SpatialLines(DataFrame)

I have a large rivernetwork as a SpatialLines(DataFrame) and want to subset it so I get a SpatialLine with only the shortest/fastest path between two SpatialPoints(DataFrame) which propably need to be ...
0
votes
0answers
20 views

GDAL - docker in Gitlab

I have a problem with libgdal.so.26 Error: error while loading shared libraries: libgdal.so.26: cannot open shared object file: No such file or directory gitlab log: Running with gitlab-runner 12....
0
votes
0answers
23 views

Can't change store dir or create new raster store on GeoServer 2.16. Failed to create reader from file: data/

I tryied to change raster source for existing raster store, but face it: Could not list layers for this store, an error occurred retrieving them: Failed to create reader from file:data/...
1
vote
1answer
89 views

gdalwarp: differentiate between empty-in-source and outside-of-cutline?

I'm using gdalwarp to clip a polygon out of a map layer using --crop_to_cutline. The original map layer has a lot of empty pixels (well, transparent / alpha=0, to be precise). As it stands, my output ...
1
vote
1answer
15 views

Setting Default Nodata burn value with GDAL Rasterize Layer

I am trying to rasterize a layer as follows: attr = 'N_CT' tif_driver = gdal.GetDriverByName('MEM') raster = tif_driver.Create(path, x_res, y_res, num_bands, gdal.GDT_UInt16) shp_driver = ogr....
0
votes
1answer
39 views

Batch processing of GDAL clip function

When I am trying to batch process GDAL clipping in QGIS 2.18 with 30 raster files I get the following Error: GDAL command output: ERROR 1: Cannot compute bounding box of cutline. My ...
1
vote
0answers
34 views

Converting Vector (.shp) to Raster (.tiff) using Python GDAL library

I'm trying to convert a vector shapefile to a raster tiff file. I adapted the source code from Python Geospatial Analysis Cookbook by Michael Diener. The code works for line and polygon shapefiles but ...
0
votes
1answer
39 views

Deleting features with Null value in attribute field

I have polygonized a single band raster and created an area field. I want to keep the 10 largest polygons by area and delete the rest. The following script computes the area for all polygons and sorts ...
-1
votes
0answers
21 views

Sorting and deleting attribute features from shapefile [duplicate]

I am polygonizing a single band raster and creating an area field to the shapefile. I want to keep the 10 largest polygons by area and delete the rest. The following script computes the area for all ...
1
vote
1answer
37 views

Creating a raster based on values of other rasters

I have three single band rasters, raster_a, raster_b and raster_c with pixel values 1 and 0. I am trying to burn the values of raster_a to raster_b and create a "new_raster_b" where if: raster_a == ...
2
votes
1answer
66 views

Making polygon shapefile from unsorted point shapefile?

I have a point Shapefile with unsorted feature ID's (FID). I want to convert the same point file into polygon Shapefile by using python gdal/ogr. I got the help from link1 and link2. I'm able to make ...