I wanted to read a mosaic image (Geotiff image) created with Metashape (formerly Photoscan) and process the image with Python. I tried to install a library called ** GDAL ** that can play with rasters and vectors. I had a hard time installing it and it took me a whole day today, so I'll write it down as a memorandum.
Reference: https://gdal.org/ 「GDAL documentation」
If you check with "GDAL Python installation" etc., it seems that you can install it by typing the following command with the anaconda prompt.
Reference: https://anaconda.org/conda-forge/gdal 「conda-forge/packages/gdal」
conda install -c conda-forge gdal
However, when I run this command, I get an error that stops at Solving Environment ...
Reference: https://teratail.com/questions/262267 "I want to install Gdal with Anaconda"
First of all, refer to the following site and ** GDAL version may be different. **I thought.
Reference: https://sites.google.com/view/takagilab/manual/program-%E7%92%B0%E5%A2%83%E3%81%AE%E6%A7%8B%E7%AF%89 "Construction of Program Environment, National Land Information Processing Engineering Laboratory"
You can check the version with the following command.
conda search gdal
As a result of version search, if it is conda install conda-forge gdal, it will be ** ver3.1.2 **, but ** ver3.0.2 ** is the latest? Appropriate? It turned out to be.
Specify the version and execute the command as follows.
conda install gdal==3.0.2
When I did this, the ** Solving Environment error ** was resolved, but this time I got a ** Conflict error **.
Reference: https://teratail.com/questions/262267 "I want to install Gdal with Anaconda"
I saw this Conflict error and it seems to last forever, so I decided to finish the installation and update the library version.
conda update --all
You have now updated all the libraries in conda to the latest version. Finally, install the versioned GDAL again.
conda install gdal==3.0.2
Installation successful! I'm not sure why updating the library can also install GDAL, but let's do it.
It was imported firmly! It may not be a fundamental solution, but one case is settled ~ Using this library, we will load Geotiff + image processing while referring to the following articles.
https://qiita.com/HidKamiya/items/d5e69fda61703abe1a58 "Importing and exporting GeoTiff images with Python"
If you find it helpful, please ** LGTM **!
Recommended Posts