3

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?

Tom
  • 283
  • 1
  • 2
  • 6

1 Answers1

2

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.

scw
  • 16,391
  • 6
  • 64
  • 101
  • 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 04 '11 at 04:22