Skip to content
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

Functions to implement from GEOS #1570

Open
5 of 37 tasks
jorisvandenbossche opened this issue Oct 17, 2022 · 6 comments
Open
5 of 37 tasks

Functions to implement from GEOS #1570

jorisvandenbossche opened this issue Oct 17, 2022 · 6 comments
Labels

Comments

@jorisvandenbossche
Copy link
Member

jorisvandenbossche commented Oct 17, 2022

Opening a similar issue here as we had at pygeos/pygeos#126.
GEOS changelog at https://github.com/libgeos/geos/blob/master/NEWS.md

This issue lists GEOS functions that could be exposed in Shapely as new public functions as well.

GEOS <= 3.8:

  • GEOSOrientationIndex
  • GEOSNode -> ENH: Add node function #1431
  • GEOSisValidDetail
  • GEOSGeomGetEndPoint
  • GEOSGeomGetStartPoint
  • GEOSMinimumClearanceLine
  • GEOSMinimumWidth
  • GEOSRelateBoundaryNodeRule (GEOSRelatePatternMatch)
  • GEOSDistanceIndexed
  • GEOSSegmentIntersection
  • GEOSPolygonize_valid

GEOS 3.9:

GEOS 3.10:

GEOS 3.11:

GEOS 3.12:


If other functions with the same signature are already exposed, adding a new GEOS function to Shapely can be quite straightforward, see #1431 as an example

@akadouri
Copy link
Contributor

akadouri commented Nov 4, 2022

It looks like GEOSGeomGetEndPoint and GEOSGeomGetStartPoint are wrappers around similar methods in the geos LineString class. Does it make sense to add similar methods to the shapely LineString class as well as add those functions?

@jorisvandenbossche
Copy link
Member Author

That makes me also realize we already expose get_point (the getPointN that is used the code you link to), so you can already get the start and end point of a line similarly with shapely.get_point(line, 0) and shapely.get_point(line, -1).
So that makes it maybe less needed to directly expose GEOSGeomGetEndPoint and GEOSGeomGetStartPoint? (we could still add start_point and end_point attributes to the LineString class if we would want that)

@akadouri
Copy link
Contributor

akadouri commented Nov 4, 2022

Oh I didn't know that existed. I have.coords[0] and .coords[-1] littered all over scripts, these new methods would be more explicit and prevent typos (like using [1] instead of [-1]) but don't seem like high priority adds if there are two other ways to do the same thing.

@chourmo
Copy link

chourmo commented Feb 11, 2023

Cluster functions would be super handy.
https://github.com/libgeos/geos/tree/6ea4e94e9c3a8d14ee9950f7e12eef273c74047c/include/geos/operation/cluster

@jorisvandenbossche
Copy link
Member Author

@chourmo I don't think those have been exposed through their C API, so that would an enhancement that first need to be brought up with GEOS

@mwtoews
Copy link
Member

mwtoews commented Feb 13, 2023

See libgeos/geos#823 to hopefully implement a C API for clustering. This is not trivial, some discussion may be needed to refine the best strategy for the implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants