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 ...

learn more… | top users | synonyms

5
votes
1answer
2k views

How to create mask bands in GDAL and Python?

I have small program in Python that uses gdal and numpy to perform a logarithmic scale of some data into the RGB 0-255 range. Now this input data has a nodata value set to mask the valid values, and ...
0
votes
0answers
4 views

store the output of gdal_rasterize as a pgraster?

I was wondering when using gdal_rasterize to convert something to a raster, is it possible to store the output raster as the PostGIS raster instead of, say, a tif? For example: I have the following ...
0
votes
0answers
11 views

numpy.unique: ValueError: all the input arrays must have same number of dimensions

I'm trying to get the unique values of an array but am getting an error that doesn't make any sense. Here is my pseudo code: import numpy as np import gdal # I have a .tif file, call it ...
3
votes
1answer
24 views

Problem with algebra formulas for work with gdal_calc.py

I'm trying to update some values of a raster based on another raster. 1st raster (A): landuse data (values from 10 to 240) 2nd raster (B): mask data (only nodata values and a given value, for ...
1
vote
2answers
1k views

Changing color of raster images based on their data values - gdal

Let's say I have 1 band raster images with Gray Color Interpretation and I want to change their color based on their data values. Data values -1, will be Blue, -0.5 will be Light Blue, 0 will be ...
2
votes
0answers
23 views

Visualizing netCDF file with unknown projection

I'm having a tough time visualizing a netCDF file with poor metadata in ArcMap, which is probably not a surprise. I know the file to contain ozone concentrations over the United States. If I try to ...
1
vote
1answer
19 views

Why can't PHP insert new geometry on PostGIS?

(Copied this question from stackoverflow, since it may have more answers here.) I'm using ogr2ogr to upload a GPX file to PostGIS. When I do it on command line (Ubuntu 14.04), it works fine. ...
3
votes
1answer
50 views

Clip raster by mask layer returns error “wrong number of parameters”

Using Python for QGis 2.14 Essen i try to clip a raster by a Polygon, as indicated here: http://docs.qgis.org/2.6/de/docs/user_manual/processing_algs/gdalogr/gdal_extraction/cliprasterbymasklayer.html ...
0
votes
1answer
26 views

use of gdaltransform in C# code

I have a problem to use correctly gdaltransform in a C# project to transform a set of coordinates from a crs to another. If first try in console command and this line is working good my inpufile ...
2
votes
1answer
31 views

Tiff: How to calculate Tiff Tag ModelPixelScaleTag (field 33550) and Field 34735

I have to manage a service which can return images in tiff format. This service is requesting another WCS Service from which it receives the Image File without geo-referenced informations. So i need ...
1
vote
1answer
15 views

Error in opening shapefile located on network

I have been able to successfully open a shapefile using Gdal when it is situated on my local machine. However, when I put the file on another machine on the network and try to open it, it fails. ...
2
votes
1answer
28 views

Vertical Datum conversion of a raster with gdal

Is there a tool available in gdal to do vertical datum conversion of a raster DEM? I'm looking for a single command line to execute the vertical datum conversion of a raster like the las2las of Liblas ...
3
votes
2answers
64 views

GDAL/OGR ogr.Layer.Intersection fails when producing mixed geometry results

I am trying to intersect layers using the ogr.Layer.Intersection method, in Python. This works fine for pairs of polygons, but I have found intersecting two linestring layers containing matching ...
3
votes
2answers
28 views

Ogr2ogr is rounding numeric field from PostgreSQL to 6 decimals

I am using ogr2ogr to convert the data from PostgreSQL to GeoJSON. PostgreSQL contains field named shape.area, type numeric, which stores values up to 17 decimal places, like 0.15627328781960101. The ...
4
votes
1answer
437 views

GDAL minidriver and Tilecache

I'm trying to use GDAL minidriver to read tiles folders generated from Tilecache seeding. I have set this in my GDAL source <ServerUrl>http://myserver.com/test/${z}/${x}/${y}</ServerUrl>, ...
1
vote
1answer
26 views

How to reverse colour-ramped DEM to its original elevation value?

A have a GeoTIFF, LIDAR images which display DEM in its color-ramp version (color relief) from blue (minimum value) to red (maximum value) and green (in between). I dont have the original elevation ...
1
vote
0answers
10 views

Gdal overview creation [duplicate]

I need to generate gdal overview for tif image having parameter value 2 4.but when I run following error shows- Error 4:'example.tif.ovr' not recognized as a supported file format. overviews building ...
0
votes
0answers
20 views

Gdal overviews issue for tif images in image caching project

we have lots of tiff images having 1 meter resolution, when we start generating GDAL overviews with parameters value 2 4 , it shows an error- Error 4:'example.tif.ovr' not recognized as a supported ...
0
votes
0answers
29 views

How to georeference *.tiff to a given feature geometry automatically?

I´ve got the task to georeference an tiff image to the referencing polygon footprint (Polygon). I have found a lot of ways to do get the footprint from a raster but I could not find a way to use ...
2
votes
0answers
15 views

Reading raster attribute table using gdal in python

Is there a GDAL function that can read in a raster attribute table? Something functionally similar to this function in pygeoprocessing: ...
0
votes
1answer
35 views

How do I convert a DEM GeoTIFF to Contour Shapefile

I have a digital elevation model as a GeoTIFF and I'm looking to generate a Shapefile of contours with 5m bands on the command line. Is this possible? Ideally using GDAL and Python.
0
votes
0answers
40 views

Relation between contour_interval and DN values of a georeferenced image in gdal.ContourGenerate() function

I am generating contours from a georeferenced image by using gdal.ContourGenerate() function in python. One of the parameters of the function is contour_interval. The value of contour_interval ...
3
votes
3answers
110 views

How to get WKT for various Spatial Reference Systems?

I need to provide WKTs of spatial reference systems in the APIs provided by GDAL/OGR. Is there some specific place where I can look for WKTs of the spatial reference systems that I'm working with? Or ...
3
votes
2answers
37 views

Find points that intersect a user-defined polygon in GDAL

I'm trying to do something that I don't know is possible in GDAL/Python. I have a list, L, of pre-defined lat/long points that make up a uniform grid. A user will send me a set of points that make ...
0
votes
0answers
14 views

Read GeoTiff from memory in GDAL

Is it possible with the GDAL library to read an image (e.g. GeoTiff) from a memory stream, like stdin instead of a defined location on the local disk? It would be useful to read data in streaming ...
2
votes
1answer
272 views

Unsupervised raster classification using GDAL

Is there an equivalent in GDAL to the Arcpy ISO data unsupervised classification tool, or a series of methods using GDAL/python that can accomplish this?
0
votes
0answers
21 views

How to convert raster in UTM to lat/lon using GDAL (or other tool)

I have a .tiff file given with UTM coordinates that I'd like to convert to a .nc (NetCDF) file with latitude/longitude coordinates. I've tried with gdal_translate and gdal_warp but these did not work. ...
6
votes
1answer
97 views

Adding GDAL as dependency to Python package?

I am trying to package a Python script that uses GDAL for PyPI. I started by including a direct reference in my setup.py: install_requires=['GDAL==1.11.2'], This way the package failed to install in ...
0
votes
1answer
220 views

Can't get the correct version of GDAL installed to use ReadAsArray without getting error in Python

Using the instructions here . . . https://pythongisandstuff.wordpress.com/2011/07/07/installing-gdal-and-ogr-for-python-on-windows/ I downloaded the following files: GDAL-1.11.1.win-amd64-py2.7.msi ...
0
votes
1answer
26 views

Empty file after saving…? [closed]

Code below is working, but after opening - there are No features in shp file. What can be a problem? import osgeo, os from osgeo import ogr, gdal shpFile = r'C:\Users\ReBurns.shp' driver = ...
2
votes
1answer
199 views

NASA SRTM: precipitous contour lines in TileMill

I was trying to make a nice looking print map of Bali (Indonesia) in TileMill. After creating a terrain layer (using this walkthrough) I noticed that the island's coastline was precipitous. Is ...
7
votes
1answer
570 views

GDAL.RasterizeLayer not ported to the C# bindings?

I am trying to use the OSGeo.GDAL.Gdal.RasterizeLayer(…) from GDAL 1.9.2 and it requires some SWIGTYPE parameters: OSGeo.GDAL.Gdal.RasterizeLayer( OSGeo.GDAL.Dataset dataset, int bands, ...
2
votes
0answers
39 views

Using ogr2ogr for clipping vector files

I am looking for alternative (more efficient) methods for clipping large feature class datasets. When using the 'Clip' tool in ArcGIS, often times the tool will crash after many hours of processing. ...
3
votes
0answers
29 views

GDAL_merge - Stacking Files - Nodata Value wrong

I masked a large raster stack by separating the stack in 18 chunks, masking each and writing each chunk to a file (due to memory problems). Then, I use gdal_merge to stack the 18 GTiff files. All ...
1
vote
1answer
25 views

Remove/subset raster bands in Python GDAL

I'm trying to remove bands from a raster I have. Basically I just want the first band as a new GeoTIFF file. Here is my code so far: #!/usr/local/bin/python from osgeo import gdal # Load my GeoTIFF ...
1
vote
2answers
448 views

Import error: no module named _gdal_array

I am using python 2.7 and have gdal installed. I want to read an entire .jpg image at once and so I used statement import gdal from gdalconst import * driver = gdal.GetDriverByName('JPEG') ...
3
votes
2answers
282 views

How to have GDAL print layers of GeoPDF AND say which are raster vs vector

My Objective: I would like to use GDAL to convert a GeoPDF. I want the vector layers as shp files and the raster layers as tif files. I want to do this in a programmatic way. Edit: In reality, I ...
1
vote
3answers
181 views

ESRI Shapefile not loading into SQL Server

I have been loading a number of shapefiles into SQL server 2012 using ogr2ogr.exe and the MSSQLSpatial driver. Up until this point, I have been very successful with doing so. However, I have now run ...
1
vote
0answers
14 views

How to create tiles from c# code

I need to create tiles directly from c# code. The input file is in *.tif format. Is there a way to do this simply? I tried GDAL, but I found it complicated, I don't understand how to cut tiff into ...
1
vote
1answer
173 views

Accessing bands in .pix (PCIDSK) file in python/arcpy

I am trying to perform zonal statistics on a single band from a multi-band raster in .pix format. I have things working great with a tiff file. I am able to access the bands using this code: desc = ...
0
votes
2answers
34 views

Trouble getting shapely to run

I downloaded the GDAL complete Framework von Kyngchaos which also includes the GEOS Framework and shapely for python. I can import shapely without a problem, but when I try to perform some "geo ...
1
vote
1answer
41 views

Resampling a raster file with GDAL C#

Is it possible to resample the raster by using GDAL C# binaries, in a way that every other cell in a row and column is removed? Basically a replication of this GDAL command: gdal_translate -outsize ...
2
votes
0answers
13 views

units for gdalwrap output extent

I am attempting to write a small bash script that will mass process a large number of raster .tif files. It should do the following: Clip to a smaller extent Reproject to UTM This is what I have, ...
1
vote
1answer
1k views

How do I add elevation data to a GeoJSON line from a GPX file?

I understand that elevation can be added as an optional third value in Coordinates (lat, long, elev) in a geojson file, but I can't find a way to actually do that from a gpx file. I've used ogr2ogr to ...
0
votes
1answer
25 views

Combining data in two projections?

The PAMAP dataset comes divided between two different projections: Pennsylvania North State Plane and Pennsylvania South State Plane. I'd like a great big DEM of the whole state of Pennsylvania. ...
3
votes
1answer
679 views

Extract data from netcdf using a shapefile polygon in python

I need to subset data from a NetCDF using a specific shapefile. The data are sea surface temperature and ocean color at 1/4 degree resolution. I have 4 polygons describing the US. Northeast ...
2
votes
5answers
2k views

How to export raster from PostGIS enabled DB as GTiff with gdal_translate

When I want to export a GTiff from my PostGIS DB with this code: gdal_translate -of GTiff PG":host='localhost' port:'5432' dbname='landslide' user='postgres' password='pass' schema='public' ...
2
votes
2answers
369 views

How to reproject Geotiff correctly?

I am new for GIS programming. I try to change geotiff coordinate system from epsg 32635 to epsg 4326. I used the following gdal command: gdalwarp -rc -s_srs epsg:32635 -t_srs epsg:4326 -dstnodata 0 ...
0
votes
1answer
20 views

gdal writeArray causes appcrash at end of python script

i'm using OSGeo4W64 (gdal 2.0.2-8) with Python 2.7.5 on Windows 8.1 64bit. Editor is PyCharm 2016.1.2. I want to save an image with gdal, but i always get an error when the python script is complete. ...
1
vote
1answer
25 views

Export Line Feature using ogr2ogr.

I am trying to export a line feature class from an oracle spatial database to a file geodatabase. I can export polygons with no problem, but cannot find the appropriate command '-nlt' for Line ...