question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ENH: expose all shapely functions as GeoSeries/GeometryArray methods

See original GitHub issue

pygeos now contains some functions which could be exposed as methods on GeoSeries/GeometryArray levels. Some of them have shapely (1.7) versions, most do not.

I would not mind supporting them only if pygeos is installed and mark them as experimental until shapely 2.0 is out. The implementation of these should be relatively easy and straightforward then.

Probably incomplete list of candidates:

Measurement:

  • frechet_distance
  • hausdorff_distance
  • minimum_bounding_radius
  • minimum_clearance

Predicates:

  • contains_properly
  • is_ccw
  • is_closed
  • is_prepared
  • is_valid_reason

Set operations:

  • coverage_union
  • coverage_union_all
  • intersection_all
  • symmetric_difference_all

Constructive:

  • build_area
  • clip_by_rect (#1928)
  • delaunay_triangles
  • extract_unique_points
  • make_valid (#2539)
  • minimum_bounding_circle (#2621)
  • minimum_rotated_rectangle (#2541)
  • normalize
  • offset_curve
  • polygonize
  • polygonize_full
  • reverse
  • segmentize
  • snap
  • voronoi_polygons

Linestring operations:

  • line_interpolate_point
  • line_locate_point
  • line_merge
  • shared_paths
  • shortest_line

Coordinate ops:

  • count_coordinates
  • get_coordinates

Geometry properties:

  • force_2d
  • force_3d

And potentially also creation ops. We now expose points via points_from_xy.

  • box
  • destroy_prepared
  • ~empty~
  • ~geometrycollections~
  • ~linearrings~
  • ~linestrings~
  • ~multilinestrings~
  • ~multipoints~
  • ~multipolygons~
  • points
  • ~polygons~
  • prepare

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:13 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
martinfleiscommented, Dec 12, 2022

Do you still think this estimate is accurate?

No, given the number and variety of shapely functions not exposed, it will be significantly longer with proper tests and documentation. Some are easy but a lot is not and we’ll need to figure out how to seamlessly implement them here.

We’re usually doing GSoC under the NumFOCUS umbrella so there’s a bit more time for us.

1reaction
EwoutHcommented, Dec 12, 2022

Probably not, the small-size GSoC project is 175 hours. Implementing all listed above will be a matter of <10 hours.

Do you still think this estimate is accurate?

It would be very nice to have all those functions exposed, and if this could be a potential GSoC project, the time to start thinking about that is around now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

geopandas.GeoSeries
A Series object designed to store shapely geometry objects. Parameters. dataarray-like, dict, scalar value. The geometries to store in the GeoSeries.
Read more >
Version 2.x — Shapely 2.0.0 documentation - Read the Docs
Shapely 2.0 exposes GEOS operations as vectorized functions that operate on arrays of geometries using a familiar NumPy interface.
Read more >
Geopandas Distance
We can check the distance of each geometry of GeoSeries to a singlegeometry: >>> point=Point(-1,0)>>> s. ... All classes and function exposed in...
Read more >
Geopandas Distance - Accademia e sartoria le filatrici
Geopandas DistanceGeoPandas (and shapely for theindividual objects) provides a whole lot of basic methods to analyse the geospatial datan (distance,length ...
Read more >
How to use the geopandas.array.from_shapely function ... - Snyk
How to use the geopandas.array.from_shapely function in geopandas ... If input is a (Geo)Series, output is a GeoSeries, otherwise output is GeometryArray.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found