![]() Transform the read band into an array, to work with it. ![]() Read the bands of your raster using GetRasterBand step2 = step1.GetRasterBand(1) Knowing the location of your raster to be opened, you can open it using the command: step1 = gdal.Open('path_of_the_file.tif', gdal.GA_ReadOnly)įor opening the raster read-only and saving it on step1 variable.Ĭopy the transformation to a variable, it will be useful later. I read it can be installed using pip as well, but have not tried it: pip install gdalĪnd then load the package gdal from osgeo on your Python console or script. How to do itįirst thing you will need to do: install GDAL on Python using Anaconda conda install gdal We are going to use GDAL on Python, installed through Conda, to do this. I showed another way to do batch processing here. It also can be used to do batch processing. Maybe you need to run every pixel in a raster through a Python function, or you want to do custom operations with them that are not available on GUI software such as QGIS. Today, I am going to write about how to open, edit and save raster files using Python if you are familiarized with Python (mainly Anaconda). I also do not authorize any copies of my content. I have no responsibility if you lose data or mess up your installation. ![]() I’d like to start with a disclaimer – I may be a researcher of this very area but that doesn’t mean everything I do or write here will work for you, in your own desktop configurations and package versions. Fellow researchers and open-source GIS enthusiasts,
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |