Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm trying to use the GEOS library from Python, specifically via Django (django.contrib.gis.geos).

Looking at the GEOS documentation, there are two methods on LineString I want to call that aren't available from Python: project and closestPoint.

Is there any reason why they're not available? Can they be added to the Python bindings?

As far as I can tell, they're in /usr/lib/libgeos_c.so.1.6.0, is there a way to call them directly if they can't be added to the library?

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

From the looks of it, these methods are part of LineSegment, not LineString which isn't directly available in the GEOS bindings as is. Geodjango uses ctypes to interface with GEOS, the prototypes can be pulled from http://code.djangoproject.com/svn/django/trunk/django/contrib/gis/geos/prototypes.

You should be able to extend the code to support them there, but it may be non-trivial as its not an existing geometry type.

share|improve this answer
    
You're right, I didn't pick up on that. Guess LineString and LineSegment were similar enough when I was scanning through for me to not notice. Thanks. –  Tom Mar 4 '11 at 4:22
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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