Thursday 18 July 2019

installing GEOS, PROJ, GDAL/OGR into a python virtualenv on Mac OS X


I am trying to setup an isolated python virtualenv to work on GIS projects on my Mac OS X. Sounds like I will need to install the GEOS, PROJ, GDAL/OGR from the kyngchaos site here http://www.kyngchaos.com/software/frameworks and not easy_install it into my virtualenv. Is that accurate?


The downloads available on kyngchaos are pkg installers and not just an egg or bdist of python modules. So, I am not very sure as to what else the installer is doing to the environment other than just copying files to /Library/Framework/geos.framework folder.


How would I go about installing a specific version of GEOS, PROJ, GDAL/OGR into my new python virtualenv? I would appreciate your help/suggestions on this issue.



Answer



If each Framework of Kyngchaos is in the PATH, it is easy. Every framework has a Unix folder, with the libraries for compiling things like pyproj or geos python wherever you want, even in a private Python environment (I've never had a problem)


The only problem is that Gdal python is in the Gdal Framework. But in site-packages there a file gdal.pth


gdal.pth file:


import sys; sys.path.insert(0,'/Library/Frameworks/GDAL.framework/Versions/1.7/Python/site-packages')


if you do not want to compile it yourself, copy this file in your isolated python virtualenv


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...