WebFaction
Community site: login faq

I am using GeoDjango, and everything is working fine! Except performing distance queries on points. These queries take me straight out of the shell with this text:

python2.7: GeometryComponentFilter.cpp:35: virtual void geos::geom::GeometryComponentFilter::filter_ro(const geos::geom::Geometry*): Assertion '0' failed.

I see a bug report on GEOS's trac, #511, that describes steps that reproduce the problem in my Webfaction account. The bug was closed as a compiler error.

I'm using Django==1.5.1, Postgres + PostGIS, but I'm not sure that any of this matters since it seems to be a compiler error within GEOS.

Is anyone else seeing this? Is there any chance Webfaction can fix the common GEOS library? Or are there any workarounds?

asked 01 Apr '13, 20:34

ebrelsford
313
accept rate: 0%

edited 01 Apr '13, 20:35

What type of server are you on: a CentOS5 server (< web300), or a CentOS6 server ( >=web300)?

(02 Apr '13, 18:08) seanf

CentOS6: web389

(02 Apr '13, 19:05) ebrelsford

Ok, I've reproduced this myself, so I'm ticketing it for our sysadmins to fix it. I can't provide an ETA for when it will be resolved, but hopefully it will be soon.

If you need a workaround, you can build GEOS and swig in your home directory, like this....

mkdir -p ~/bin ~/lib/python2.7 ~/src ~/tmp   
export PATH=$HOME/bin:$PATH
export TMPDIR=~/tmp    
export PYTHON=/usr/local/bin/python2.7    
cd ~/src
wget http://prdownloads.sourceforge.net/swig/swig-2.0.9.tar.gz
tar zxf swig-2.0.9.tar.gz
cd swig-2.0.9
./configure --prefix=$HOME --with-python=/usr/local/bin/python2.7    
make
make install
cd ~/src
wget http://download.osgeo.org/geos/geos-3.3.8.tar.bz2
tar jxf geos-3.3.8.tar.bz2
cd geos-3.3.8
CFLAGS="-m64" CPPFLAGS="-m64" CXXFLAGS="-m64" LDFLAGS="-m64" FFLAGS="-m64" LDFLAGS="-L/usr/lib64/" ./configure --enable-python --prefix=$HOME
make
make install

This will install a new geos library in your ~/lib directory.

To use it, set your LD_LIBRARY_PATH environment variable, e.g.:

export LD_LIBRARY_PATH=$HOME/lib

Then, it should work, e.g.:

[xxxxx@web389 ~]$ python2.7
Python 2.7.3 (default, May 18 2012, 14:51:16)
[GCC 4.4.6 20110731 (Red Hat 4.4.6-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from django.contrib.gis.geos import Point
>>> ul = Point( -122.3664859009467, 47.73815095398494, None, 4326 )
>>> lr = Point( -122.2239295843569, 47.60646046610466, None, 4326 )
>>> lr.distance( ul )
0.19407392405421137

If you need to use this with an installed Django app, then be sure to add /home/you/lib to the LD_LIBRARY_PATH environment variable in your app's apache2/bin/start script. You also might need to adjust your Python search path (in httpd.conf or in your WSGI handler) to include /home/you/lib/python2.7/site-packages so that it will pick up the geos library from there.

Hope that helps!

permanent link

answered 03 Apr '13, 18:17

seanf
12.2k41836
accept rate: 37%

edited 03 Apr '13, 19:31

Thanks, seanf, I appreciate it! I will likely give this a shot.

Is there an easy way for you to add me to the ticket so that I'll know when it's fixed? Or is there another way to be notified?

(03 Apr '13, 19:43) ebrelsford

I'll drop a comment here when the bug is fixed - if you use the "subscribe me" link near the top of this page, you'll receive an email when the comment is posted.

(03 Apr '13, 20:01) seanf

I just tried your instructions, seanf, and they worked great! Thanks again.

To anyone else having this problem I'd definitely recommend doing the above.

(05 Apr '13, 08:59) ebrelsford

You're very welcome! Since this worked for you, please click the icon above to mark my answer as an accepted solution. Thanks :)

(05 Apr '13, 10:20) seanf

This issue has now been fixed globally on your server.

(05 Apr '13, 19:14) seanf
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×909
×8
×2

question asked: 01 Apr '13, 20:34

question was seen: 3,330 times

last updated: 05 Apr '13, 19:14

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM