Tag Info

Hot answers tagged

5

I doubt your process "gets caught in a loop", I think it will just take a long time to complete as your rasters are actually quite large. Those "small rasters totally less than 100mb" are roughly 2Gb uncompressed, each. The layer properties you included in your question show that particular raster has dimensions of 36702 cols, 14147 rows and 4 bands with ...


4

The following script determines the bounding box of a raster and creates based on the bounding box a geometry. import ogr, gdal raster = gdal.Open('sample.tif') vector = ogr.Open('sample.shp') # Get raster geometry transform = raster.GetGeoTransform() pixelWidth = transform[1] pixelHeight = transform[5] cols = raster.RasterXSize rows = raster.RasterYSize ...


3

For irregular polygons, and assuming that your geotiff raster file is a binary raster, you could use GDAL_Calc: GDAL_Calc.py -A Mask.tif -B CutBigImageToClip.tif --outfile=SmallerFile.tif --NoDataValue=0 --Calc="B*(A>0)" This query will populate 0 where Mask.tif <= 0 and BigImage where the Mask > 0. To do this both rasters must be the same cell ...


2

Turns out this is a projection issue. Prior to merging, I'm reprojecting the tiles from EPSG:4326 to EPSG:3785. When this is done after the merge no problems occur.


2

For this, you need to create new ogr features and save them to the layer and not simply create geometries ( geom1.AddPoint(linkpoint[0],linkpoint[1]), feature1.SetGeometry(geom1)), with dataSource.SyncToDisk() at the end (SyncToDisk() might be helpful to ensure that a particular feature is flushed to disk but it is not necessary here, look at the script). # ...


2

Here was my problem: No way the SRTM data is that messed up. The SRTM data IS that messed up. The warping above is actually in the DEMs in the SRTM3 dataset (downloaded from http://dds.cr.usgs.gov). After examining DEMs from the improved SRTM4 dataset (available here) I found that most of these "gaps" were filled by interpolation but other issues ...


2

So I figured it out! gdal_translate -b 2 input_rgb.tiff output_green.tiff gdaldem color-relief output_green.tiff green_colortable.txt output_green_rgb.tiff taking the colortable from QGIS. I did this for both red and green bands. After that I combined them by using Mapnik!


1

It is not really documented in http://www.gdal.org/gdal_polygonize.html that gdal_polygonize is using only one band of the source image. Better wording would be: creates vector polygons for all connected regions of pixels in the raster sharing a common pixel value on the selected band From the script itself you can see that by default band 1 is ...


1

You could try to install everything from packages first, then add the hdf5 libs and re-build gdal with that. All other ways (except self-compiling all) will end in the problems you discovered.


1

The correct syntax is: print multiline.ExportToWkt() 'MULTILINESTRING ((0 0,0 1),(0 1,0 2),(0 2,0 3,0 4))' line = ogr.ForceToLineString(multiline) print line.ExportToWkt() 'LINESTRING (0 0,0 1,0 2,0 3,0 4)' It is easier with Shapely coords = [((0,0),(0,1)),((0,1),(0,2)),((0,2),(0,3),(0,4))] from shapely.geometry import LineString, MultiLineString line1 = ...


1

I don't know if it's possible to clip a raster with an other raster but you could use gdaltindex to build the shapefile with the extent of your raster. http://www.gdal.org/gdaltindex.html


1

I've work with both OTB and SAGA but I would advise on Ubuntu to install both libraries using the ubuntugis-unstable PPA: https://launchpad.net/~ubuntugis/+archive/ubuntu/ubuntugis-unstable/ It should allow you to install last stable release of both otb and saga and also qgis using the same gdal version. Take care to uninstall previous versions on your ...


1

As mentioned by @iant, there are several possibilities. I therefore suggest that you use the proj4 string with gdal, which you can customize based on your needs. e.g. "+proj=eqc +lat_ts=60 +lat_0=0 +lon_0=0 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs"


1

How about EPSG:4087? Otherwise one of this list


1

You need to apply a shear to your affine transformation matrix used for SetGeoTransform. One package that is intended to work with these is affine. For example: from affine import Affine xmin = 1; xres = 2; ymax = 3; yres = 4 # dummy values # construct geotransform matrix geotransform = Affine( xres, 0, xmin, 0, -yres, ymax) # or import from ...


1

ECW comes from Erdas and is not fully supported by GDAL without Erdas licence. According to the help : The ECW 4.x SDK from ERDAS is only free for image decompression. To compress images it is necessary to build with the read/write SDK and to provide an OEM licensing key at runtime which may be purchased from ERDAS. So you can decompress your ...


1

I hit the same error message and even though my code is python (using GDAL python bindings) the behaviour is exactly the same, "Cannot Find GPTS Object" is thrown on an attempt to open the file and there is no obvious way to silence it or get around it. It looks like the error is thrown, because gdal makes an assumption about the PDF format that is not true ...


1

Your 'ENGL_NAME' shouldn't be abbreviated at all (less than 10 characters), but writeOGR has its own will, it seems. Instead of writeOGR(shp, "PolygonsV2", speciesname, driver="ESRI Shapefile") you might try currdir <- getwd() #store your current working directory setwd(paste(currdir,"PolygonsV2",sep="/")) #switch to your desired folder ...


1

Installing Python package gdal into virualenv on Linux GDAL provides nice toolkit for GEO related operations. However, installing it to virtualenv on Linux is not trivial task. This recipe describes, how to do that. note here I use lowercase gdal for Python package and upper case GDAL for general system wide library. Requirements allow using ...



Only top voted, non community-wiki answers of a minimum length are eligible