[geos-devel] Geos Python bindings

G. Allegri giohappy at gmail.com
Tue Feb 21 03:17:58 EST 2012


GEOS is written in C++,  but it's API is also exposed as C. Truth is that
only the C-API should be used, because it's meant to be a stable "proxy" to
the underlying C++ code.
Shapely, like GeoDjango, uses ctypes with the C-API. Being MinimuDiameter
not exposed through it, it isn't available to them (nor to OGR, I suppose).

Impleneting it in Python should be easy, but performance can fall order og
magnitudes for complex geoms. Maybe you could obtain the convex hull from
GEOS and the do the rest in Python.

giovanni

2012/2/21 Alessandro Candini <candini at meeo.it>

> On 02/20/2012 05:58 PM, Sandro Santilli wrote:
>
>> On Mon, Feb 20, 2012 at 05:05:23PM +0100, Alessandro Candini wrote:
>>
>>> Hi.
>>> I have compiled geos-3.3.2 with python bindings enabled.
>>> So I get the following python files:
>>>
>>> geos.py
>>> tests/runtests.py
>>> tests/example.py
>>> tests/test_geometry.py
>>>
>>> But in them I cannot find the MinimumDiameter object and its methods.
>>> Is it missing? If I would use it through python, have I to implement
>>> it from scratch?
>>>
>> Did you read the README.txt ? It tells you that the GEOS python
>> bindings  are unsupported and suggests you to become a maintainer
>> or to use Shapely. I think the majority of people did switch to Shapely.
>>
>> Still, the MinimumDiameter is missing from the C-API, although present
>> at the C++ level, so first step would be to expose it there.
>>
>> --strk;
>> ______________________________**_________________
>> geos-devel mailing list
>> geos-devel at lists.osgeo.org
>> http://lists.osgeo.org/**mailman/listinfo/geos-devel<http://lists.osgeo.org/mailman/listinfo/geos-devel>
>>
>
> Sorry I didn't read the readme file, my fault.
> I use this API: https://docs.djangoproject.**com/en/dev/ref/contrib/gis/**
> geos/ <https://docs.djangoproject.com/en/dev/ref/contrib/gis/geos/> ,
> created using ctypes starting from file /usr/lib/libgeos_c.so.1.
> But as you say there is not a MinimumDiameter binding.
> With nm tool (I'm on Ubuntu Linux) I've searched for an entry point into
> the shared library file, but it is missing.
> It seems to miss in Shapely too (http://toblerity.github.com/**
> shapely/manual.html <http://toblerity.github.com/shapely/manual.html>).
> What do you mean to expose MinimumDIameter at C-API level?
> Is not easier for my specific case to reimplement MinimumDiameter in
> Python using GeoDjango and Shapely functions?
>
>
> ______________________________**_________________
> geos-devel mailing list
> geos-devel at lists.osgeo.org
> http://lists.osgeo.org/**mailman/listinfo/geos-devel<http://lists.osgeo.org/mailman/listinfo/geos-devel>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/geos-devel/attachments/20120221/d48e74c3/attachment.html


More information about the geos-devel mailing list