-
Notifications
You must be signed in to change notification settings - Fork 353
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose clustering functions to C API #823
Comments
Any thoughts on an API that would work well for shapely? |
Generally, arrays of ints representing cluster IDs would probably work best. Shapely is now array-oriented via the NumPy C-API. I'm guessing the user would first collect their input geometry array: input = GEOSGeom_createCollection(GEOS_GEOMETRYCOLLECTION, geoms, n); perhaps an alternative non-owning variant of GeometryCollection, e.g. input = GEOSGeometryArray_create(geoms, n); After input geometries are collected, then use a new function that could be re-used by a few different clustering methods with optional extern int GEOS_DLL *GEOSClusterFinder_create(
const GEOSGeometry* input,
const int method, /* e.g. DBSCAN, ClusterWithin, or other method enumerated by `enum GEOSClusterMethods` */
const double distance, /* if needed by method, otherwise ignore */
int* clusterIds); where @caspervdw and @jorisvandenbossche might have thoughts on the best approach too. |
+1 for this. The propose mechanism of providing input geometries and returning cluster information sounds in the right direction. I'd suggest just having different functions for each clustering method, using the same calling pattern. This allows different parameter(s) for clustering methods, if required. Also makes documentation more straightforward. |
Just to be clear, there is currently no such structure as
I've been working on functions that operate on Simple Polygonal Coverages, and this kind of structure would be useful to define a C API for them as well. |
This is a enhancement reminder request to expose clustering functions from #688 to the C API.
Following the previous discussion, there are several strategies to implement this, whether it is via some form of GeometryCollection or array(s) of geometries and/or cluster IDs, etc.
The text was updated successfully, but these errors were encountered: