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

Fix get_dimensions() #87

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Fix get_dimensions() #87

wants to merge 1 commit into from

Conversation

benbovy
Copy link
Owner

@benbovy benbovy commented Dec 10, 2024

Closes #57.

Return values that are consistent with shapely for collections.

Return values that are consistent with shapely for collections.
@benbovy
Copy link
Owner Author

benbovy commented Dec 10, 2024

Note: the Geography.dimensions property still returns the results from the underlying s2geography::Geography::dimension() so it is inconsistent with spherely.get_dimensions().

I wonder if we shouldn't remove the Geography dimensions and nshape altogether...

@benbovy benbovy added this to the 0.1.0 milestone Dec 10, 2024
@paleolimbot
Copy link

I wonder if we shouldn't remove the Geography dimensions and nshape altogether...

(It was probably a bad name in s2geography...it's useful to know if everything is a single dimension, but easy to get confused with s2_dimension().)

@benbovy
Copy link
Owner Author

benbovy commented Dec 10, 2024

Sorry it wasn't clear, I meant remove those properties from the Python public API.

(And maybe expose another function to besides get_dimensions() to expose both behaviors?)

@jorisvandenbossche
Copy link
Collaborator

I think it would indeed be good to remove that attribute for now, because it probably will only be confusing (and we can always add it later again if we want to do so)

FWIW, I think the name of this function should actually be get_dimension, i.e. without the last s (not plural). It's how this is in shapely (and so there is an argument for consistency with shapely), but it seems a misnomer there, because all other similar functions use a singular term (get_type_id, get_coordinate_dimension, etc)

@benbovy
Copy link
Owner Author

benbovy commented Dec 13, 2024

I think the name of this function should actually be get_dimension, i.e. without the last s (not plural).

Agreed. non-plural form makes more sense and is used in R's s2 and bigquery.

Maybe we could have a temporary alias here for compatibility with Shapely? And at the same time try to suggest changing the name of the function in shapely (with some deprecation cycle)?

@jorisvandenbossche
Copy link
Collaborator

And at the same time try to suggest changing the name of the function in shapely (with some deprecation cycle)?

Yeah, I was also thinking that and would be supportive of at least adding such an alias in shapely (we can still see if we actually deprecate the other long term).

If we would add an alias on the shapely side, not sure if it's needed to have both aliases here, though (on the short term, I don't think anyone is going to write code where they expect they can exactly swap shapely. with spherely. and have working code)

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

Successfully merging this pull request may close these issues.

Dimension property: returned value for geography collections
3 participants