Rasterizing a GDAL layer

EDIT: I guess I’d use qGIS python bindings: http://www.qgis.org/wiki/Python_Bindings That’s the easiest way I can think of. I remember hand rolling something before, but it’s ugly. qGIS would be easier, even if you had to make a separate Windows installation (to get python to work with it) then set up an XML-RPC server to run … Read more

Downsample array in Python

scikit-image has implemented a working version of downsampling here, although they shy away from calling it downsampling for it not being a downsampling in terms of DSP, if I understand correctly: http://scikit-image.org/docs/dev/api/skimage.measure.html#skimage.measure.block_reduce but it works very well, and it is the only downsampler that I found in Python that can deal with np.nan in the … Read more

Error while installing GDAL

Check that you installed GDAL using this command gdal-config –version Then run this commands: pip download=”some_path” GDAL cd some_path tar -xvzf GDAL-<version>.tar.gz cd GDAL-<version> python setup.py build_ext –include-dirs=/usr/include/gdal/ python setup.py install

How to fix symbol lookup error: undefined symbol errors in a cluster environment

After two dozens of comments to understand the situation, it was found that the libhdf5.so.7 was actually a symlink (with several levels of indirection) to a file that was not shared between the queued processes and the interactive processes. This means even though the symlink itself lies on a shared filesystem, the contents of the … Read more

python GDAL 2.1 installation on Ubuntu 16.04

What worked for me is this: https://gis.stackexchange.com/a/193828/66527 Below, I copy that answer: You can download GDAL 2.1 for Windows from GIS Internals. There is an installer and a portable version that doesn’t require installation. GDAL 2.1 is available for Ubuntu 16.04 from the UbuntuGIS-Stable PPA sudo add-apt-repository -y ppa:ubuntugis/ppa sudo apt update sudo apt upgrade … Read more

Obtain Latitude and Longitude from a GeoTIFF File

To get the coordinates of the corners of your geotiff do the following: from osgeo import gdal ds = gdal.Open(‘path/to/file’) width = ds.RasterXSize height = ds.RasterYSize gt = ds.GetGeoTransform() minx = gt[0] miny = gt[3] + width*gt[4] + height*gt[5] maxx = gt[0] + width*gt[1] + height*gt[2] maxy = gt[3] However, these might not be in … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)