Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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/, is there a way to call them directly if they can't be added to the library?

share|improve this question
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

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

Your Answer


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.