I'd really appreciate some guidance with this. I need to create some map illustrated tiles to use in leaflet.js for a small web-app I'm building. So far though I've lost about five days to installing and trying to configure the GDAL package to work for me.
The things I have tried so far (all on mac OS 10.15.4):
- download and installed GDAL2.4 package from http://www.kyngchaos.com/software/frameworks/
- Once that was done, I scratched my head a lot, as I couldn't really find any documentation as to how exactly I'm supposed to use the package - sure it's installed, but what does that give me exactly?
- After much searching and guessing, I found the script I wanted to run - gdal2tiles.py in my
/Library/Frameworks/GDAL.Framework/Versions/2.4/Programsdirectory and from there was able to try running:
$ python gdal2tiles.py [args]but it returned an error:
File "gdal2tiles.py", line 52, in from osgeo import gdal ModuleNotFoundError: No module named 'osgeo'
- from there, I went down multiple rabbit holes
- checking python versions (apparently I need to run 3.6 and I now am)
- uninstalling/reinstalling all the things
But nothing fixes the problem.
Eventually I came across this post which suggests you can install GDAL2 via homebrew, which to me seems like it should be easy.. but no - whilst the process outlined was easy to follow, it left me with the same issue - I have GDAL installed, but no idea how to run the
gdal2tiles.py script -I can still run the steps I outlined above and I get the same result. I'm guessing now I probably have multiple versions of GDAL installed which will bite me some other way.
Can anyone please help me with this? Essentially an idiots guide to installing and using GDAL would be perfect - all the info I can find during days of internet trawling seems to assume that I should know the answers already, but I'm not a Python dev, and have never run python packages before.
The main problems I would love solved would be:
- The first issue - how do I install or make the osgeo module available to my gdal2tiles script?
- If that's going to be too difficult, how can I access and use the
gdal2tiles.pyscript through my homebrew installed version of GDAL2.
Some extra info
$ gdalinfo --version
GDAL 2.4.2, released 2019/06/28
If I open a python 3.6.5 shell, and try
import gdal I get
ModuleNotFoundError (someone suggested that this would test if gdal was "available" to my python install).
I've added a bunch of stuff to my .bash_profile as I've tried out different things and I have no idea what is helping or hindering anymore, so my .bash_profile now includes:
export PATH=/usr/local/bin:/usr/local/sbin:~/bin:$PATH export PATH=/Library/Frameworks/GDAL.framework/Programs:$PATH export PATH=/Library/Frameworks/GDAL.framework/Versions/2.4/Programs:$PATH export PATH=/Users/smallmighty/Library/Python/3.7/bin:$PATH export PATH=/Library/Frameworks/GDAL.framework/Programs:/Library/Framework/PROJ.framework/Programs:/Library/Frameworks/SQLite3.framework/Programs:/Library/Frameworks/UnixImageIO.framework/Programs:$PATH export PYTHONPATH="/Library/Frameworks/GDAL.framework/Programs/" export PYTHONPATH="/Library/Frameworks/GDAL.framework/Versions/2.4/Programs"