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
16 views

GetRasterBand()Method for GDAL in Python

I'm working on getting the NDVI value of Landsat imagery 2018 using band 4 and 5 but I have encountered a slight problem. import osgeo from osgeo import gdal#gdal, data conversion tool from ...
0
votes
0answers
18 views

GDAL 2.4.2 from UbuntuGIS unstable broken because of missing libogdi.so.3.2?

After an unthoughtful apt-get update today, GDAL no longer works on my Ubuntu Machine (bionic) because libogdi.so.3.2 is missing: daniel@gin-nuest:~$ gdalinfo gdalinfo: error while loading shared ...
2
votes
1answer
91 views

R dissagregate method in python

It seems an easy question, but I can't find the Python equivalent of R's Dissaggregate: Disaggregate a RasterLayer to create a new RasterLayer with a higher resolution (smaller cells) I expected ...
0
votes
0answers
17 views

PostGIS Out-DB Rasters - Segmentation Fault

I am loading data from a NETCDF file with raster2pgsql, which I would like to keep as an out-DB raster. The command I use is (note the -R option): raster2pgsql -s 96482 -I -d -F -R NETCDF:"/home/...
5
votes
4answers
5k views

Replacing NaN pixel values in GeoTIFF using GDAL?

I was wondering if there is a easy way (GDAL) to replace GeoTIFF pixels that are -nan with a different value (e.g. 100)? I tried gdal_calc.py -A my.tif --outfile=result.tif --calc="A-(A==-nan)*(-...
1
vote
1answer
48 views
+50

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....
2
votes
1answer
68 views

Is there a GDAL function similar to OpenCV's WarpPerspective?

I't trying to mosaic a GeoTiff raster against another. Initially, they were both georeferenced in WGS-84 CRS. Using OpenCV, I calculated a homography transformation (a 3x3 projection matrix), that ...
1
vote
0answers
11 views

Horizontal color lines artifacts / bug with GDAL Tiff

I would like to document a bug I encountered, and scratched my head against several hours: I wrote a python script for extracting (cropping) many images from a big TIF image. I used both gdal....
0
votes
0answers
8 views

gdal_retile.py killed when dealing with large .vrt + pixel function

I have to retile about 100,000 images of size about 2667x2667 pixels for geoserver. The source images' nodata area were badly damaged due to compression so I decided to use VRT pixel function max to ...
-2
votes
1answer
27 views

What do some of the parameters in gdalinfo represent? [on hold]

For example, on the gdalinfo documentation, we have gdalinfo ~/openev/utm.tif Driver: GTiff/GeoTIFF Size is 512, 512 Coordinate System is: PROJCS["NAD27 / UTM zone 11N", GEOGCS["NAD27", ...
0
votes
0answers
14 views

Is there a way to get the scale of a map using gdalinfo? [on hold]

I'm completely new to GIS and using GDAL, and I was wondering if there was any way to extract the scale of a map, using information such as the Geo Transform, Corner Coordinates, WGS84 Extent, or ...
0
votes
0answers
26 views

Joining file pair for batch gdal_merge.py

I am new to Python and I have been going through past questions and searching trying to determine best way to batch mosaic files. I have a list of .tifs that have been converted from .hdf files I am ...
2
votes
1answer
413 views

Write ogrinfo result to text file

I have obtained a desired value from a dataset using: ogrinfo input.shp -dialect SQLite -sql "SELECT SUM(field) from input The ogrinfo command prints the desired value via the command line when I ...
0
votes
1answer
20 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 ...
0
votes
2answers
27 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
1answer
24 views

Opening .Jp2 image in QGIS on Mac?

I am trying to open a Jp2 file in QGIS 3.4.5 on a macOS 10.14.5 Mojave. I am new to QGIS and have been looking through forums that discuss GRASS and GDAL but I don't understand the connection to QGIS....
1
vote
1answer
136 views

Converting NetCDF dataset array to GeoTiff using rasterio Python

I have read a NetCDF file using the netCDF4 library and then read one of its datasets ("Evapotranspiration") into a variable (variable contains array) using the following code. Subsequently now I am ...
0
votes
1answer
21 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
2answers
130 views

Breaking Mosaic into Large Tiles using GDAL?

I have 607 aerial images of Massachusetts in .jp2 format. They are in a mosaic however I need to break down the 607 images into groupings of 16(4x4) spatially so that I can more easily process ...
0
votes
0answers
6 views

Initialize spatial_ref_sys table in MySQL 5.7

Using MySQL 5.7 for a spatial application and kind of baffled as to why there doesn't seem to be any nice way to prepopulate spatial_ref_sys. Isn't there any premade SQL script out there to fill the ...
13
votes
3answers
3k views

How to equalise colour, brightness and contrast across several scanned paper maps

I am a vectors guy mostly, but for a current project I need to work with a bunch of old scanned paper maps (ww2 bomb damage maps for London, if your interested!) We scanned and georeferenced the maps,...
1
vote
1answer
2k views

Example of C++ code in Visual Studio initializing a created raster

I refer to Sample for MS Visual Studio C++ using GDAL library I noticed that the answer mentions that when GDAL is built from source there would be a tools folder with examples of how to initialize a ...
0
votes
1answer
33 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
50 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 > ...
2
votes
2answers
2k views

Georeferencing png using gdal?

I have created my own fantasy map, I have the map in a full size png and the map broken down into tiles ( with no geo data ) I installed MS4W and tried to use it to get the georeference data put is ...
6
votes
5answers
6k views

Converting csv to kml/geojson using ogr2ogr or equivalent command line tools? [duplicate]

I've just unsuccessfully tried to use ogr2ogr to convert CSV into KML like so: ogr2ogr -f "KML" output.kml input.csv The csv has "latitude" and "longitude" columns. The attributes are all loaded ...
0
votes
0answers
23 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 ...
1
vote
1answer
182 views

Georeferencing metadata in GeoTIFF files

I am generating maps as TIFFs using the raster package (writeRaster) in R to generate small tiles, then as a final step, combining the tiles via the GDAL script gdal_merge.py. I thought the resulting ...
2
votes
1answer
23 views

GDAL Raster: How to obtain the cell ( and also the position) where maximum occurs?

I can obtain the maximum/minimum value of a raster via the ComputeRasterMinMax code: using (var ds = Gdal.Open(tiffFile, Access.GA_ReadOnly)) { var nCol = ds.RasterXSize; var nRow = ds....
6
votes
2answers
5k views

Split a large GeoTIFF into smaller regions with Python and GDAL [duplicate]

I have quite a large GeoTIFF-file (compressed 50MB but unpacked 6GB) and want to split it into several smaller regional files. I am using Python, and as I am a new GDAL user I do not really have an ...
0
votes
1answer
33 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
34 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 ...
5
votes
3answers
5k views

Generating random coordinates in multipolygon in Python?

How to generate random points in multi-polygon using geojson in python ? thus far I found a class in JavaScript named : randomPointsOnPolygon(numberOfPoints, polygon) but I need to use something ...
3
votes
3answers
4k views

Read KML file with GDAL/OGR for Python

I have file : test.kml and I try to open it with GDAL/OGR (1.6) librairie in Python (2.5). But I don't succed can you help me ? This is my code : from osgeo import ogr adresse = 'test.kml' driver ...
31
votes
5answers
53k views

Splitting shapefile into separate files for each feature using QGIS/GDAL/SAGA?

I have a polyline shapefile with about 20 kinds of roads. I would like to know how can I create automatically a vector file for each one. I am aware of how to do it using ArcGIS for Desktop - see ...
5
votes
1answer
3k views

Seeking way to tile/pyramid 4 million images using gdal for geoserver WMS?

My scenario consist of 4 million geolocated images each measuring 1536x1536 pixels in size. What is the most efficient way to pyramid these images? My end goal is to serve these images using ...
1
vote
1answer
1k views

ValueError: array larger than output file, or offset off edge Python GDAL

I have been working on this iterator that would count instances where data conformed to a set of conditions over a number of rasters. I had people help me with other aspects of this script (Counting ...
0
votes
0answers
36 views

Hacks to make Python scripts faster? [closed]

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 ...
1
vote
1answer
14 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
43 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
2answers
218 views

GDAL installation on MAC OSX via conda fails, linked due to Libpoppler and font configuration

When installing GDAL via Conda, install fails, on OSX Mojave and Python 3.7: dlopen(/Users/tomkom/anaconda3/lib/python3.7/site-packages/osgeo/_gdal.cpython-37m-darwin.so, 2): Library not loaded: @...
3
votes
2answers
2k views

Installing GeoDjango dependencies on Windows 10 or Windows Server 2012 R2?

I have followed the guide here and many others but no luck so far. I am wondering if the two Operating systems are even supported by geodjango due to the dependencies. I have set the environment ...
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?
1
vote
1answer
182 views

How to close open files after processing.runlag() command (Qgis: Error No 24)

I'm creating a pyqgis script. In this script I use the processing.runalg command several times. The problem is that these processes are within a for loop. After several iterations, the error number 24 ...
2
votes
0answers
26 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 '...
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 ...
3
votes
0answers
768 views

Converting classification image to aggregated polygon in shapefile using gdal/python? [closed]

My goal is convert a 2D numpy array to shapefile. The matrix results from a classification, so the numbers have a meaning. I solved my problem, but the solution is somehow convoluted and complicated. ...
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
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. ...
2
votes
1answer
42 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 ...