Tuesday 13 January 2015

Python shapely

I have to admit that I haven't scripted anything using "shapely" yet so I thought I should give it a try. Well there's a long way round to installing it and a short way round.
The long way:

Read the instructions:

GEOS >=3.3 (Shapely 1.2.x requires only GEOS 3.1 but YMMV)

Try to install GEOS and find that it requires SWIG for the Python bindings.
Try to install SWIG on Mavericks only to find it requires PCRE to install.
Install PCRE, install SWIG, then try GEOS

    make: *** [check] Error 2

There's a ticket on this from 5 years ago. Great!

The short way:
I then recall that GEOS is included in the KyngChaos installer for GDAL and sure enough there is GEOS and shapely, but shapely is only installed for the system Python. I am using Anaconda. Put a .pth file into the site-packages folder under Anaconda and we are up and running.
Sometimes it is very easy to make life difficult.

No comments:

Post a Comment