1

I installed GDAL from here (https://pypi.python.org/pypi/GDAL/1.9.1)

Before attempting the python GDAL I installed the prerequisite gdal libraries using Kyngchaos's description some time ago (http://www.kyngchaos.com/software/frameworks). I have verified that gdal is running on at least the minimum required version:

gdalinfo --version
GDAL 1.11.1, released 2014/09/24

However, when I attempt to start python and access the gdal libraries I get errors on simple operations:

from osgeo import ogr
point = """{"type":"Point","coordinates":[-90.02001032734194,35.127405562848075]}"""
geom = ogr.CreateGeometryFromJson(point)
geom.Centroid()
ERROR 6: GEOS support not enabled.
<osgeo.ogr.Geometry; proxy of <Swig Object of type 'OGRGeometryShadow *' at 0x10344d9f0> >

I have googled this error and looked at how it has been mentioned on this site but no solutions seem to pertain to my situation. The Kyngchaos GDAL/OGR installs are built with GEOS libraries, so I'm very confused as to why python GDAL/OGR is saying GEOS is not enabled.

Any ideas on how I can fix or go about debugging this (running on Mac OSX)?

Edit 1:

I have verified that gdal 1.11.1 is being loaded with osgeo by forcing this specific version to top of path.

import sys
oldpaths = sys.path
sys.path = ['/Library/Frameworks/GDAL.framework/Versions/1.11/Python']
sys.path.extend(oldpaths)

from osgeo import gdal
print gdal.__version__
1.11.1

however I still get ERROR 6: GEOS support not enabled. on trying to take the centroid of a geom

  • 1
    wondering if there are competing installs? the first link above shows gdal 1.9 from pip, while the gdalinfo version shows 1.11.. i've been using anaconda, and after a hiccup with gdal 2.0 - it seems to work better. what do you get when you use from osgeo import gdal and print(gdal.__version__) – fluidmotion Dec 4 '15 at 13:23
1

I was able to successfully solve my problem by ensuring that the correct path to GDAL/GEOS was given. If GDAL/goes was installed via KyngChaos's method, you can add the correctly configured gdal to the path manually:

import sys
oldpaths = sys.path
sys.path = ['/Library/Frameworks/GDAL.framework/Versions/1.11/Python/2.7/site-packages']
sys.path.extend(oldpaths)

from osgeo import ogr
point = """{"type":"Point","coordinates":[-90.02001032734194,35.127405562848075]}"""
geom = ogr.CreateGeometryFromJson(point)
print geom.Centroid()
POINT (-90.020010327341936 35.127405562848075)

With the correct GDAL version path, I no longer get the error.

0

I had the same issue in CentOS 7. I fixed the problem installing the package gdal-python.

The command is:

yum install gdal-python

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.