-
Notifications
You must be signed in to change notification settings - Fork 8
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
Add more Geography subclasses #26
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #26 +/- ##
==========================================
- Coverage 56.07% 49.88% -6.20%
==========================================
Files 5 7 +2
Lines 214 425 +211
Branches 95 189 +94
==========================================
+ Hits 120 212 +92
- Misses 7 61 +54
- Partials 87 152 +65
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report in Codecov by Sentry. |
Maybe something to also discuss more generally: do we want / need all those subclasses? |
Do you mean that alternatively we could expose only one I see two advantages of having subclasses:
One argument against subclasses is that it is a bit more code to maintain (maybe some duplicate logic here and there), but that's not much in my opinion. |
Another alternative would be to expose a unique class for
|
- seem to be also the case in Shapely - remove last vertex if it is equal to the 1st one - still raise error in other duplicate vertices cases
@jorisvandenbossche I'm moving forward with the implementation of the Geography subclasses here but this shouldn't prevent us from discussing how best to expose these (maybe in a separate issue?). I wouldn't mind refactoring things if needed. |
Also added a ``spherelt::Geography::clone()`` method, which makes easier creating collections from copies of input objects (needed by the ``s2geography::GeographyCollection`` which owns its features). TODO: implement clone for LinearRing and GeographyCollection.
I haven't checked if shapely copies the input geometries when creating a collection... Here that's a requirement if we want to reuse I added a There are a few other things that we would need to port into the s2geography classes (also address #27) before we can get rid of spherely's wrapper classes (which I'd be very happy to see!). I'll wait a bit more before opening an issue in the s2geography repository with a clear and detailed proposal. |
Unfortunately, the repr fails for a GeographyCollection that includes a LinearRing, since the latter is not supported in s2geography WKT writer. A workaround could be to have our own version of GeographyCollection WKT writer here but it doesn't make much sense to re-implement the whole thing.
Refactor clone: - won't need spherely::Geography::clone - instead use a template function spherely::clone_s2geography with SFINAE Not complete and still needs some clean-up
Closing. Superseded by #51. |
LinearRing
S2LaxClosedPolylineShape
(+S2Region
implementation copied fromS2Polyline
). I added here some code that we might consider moving to s2geography later if it's worth it.Polygon
MultiPoint
MultiLineString
MultiPolygon
GeometryCollection
Also:
Let's save the following for later: