Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[WIP] ENH: add preliminary support for using spherely as geometry engine#3520

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
jorisvandenbossche wants to merge1 commit intogeopandas:main
base:main
Choose a base branch
Loading
fromjorisvandenbossche:spherely-support

Conversation

@jorisvandenbossche
Copy link
Member

@jorisvandenbosschejorisvandenbossche commentedFeb 26, 2025
edited
Loading

Very much work-in-progress POC of using spherely in geopandas as another geometry engine.

While there are many things to do or improve (implementing some basic things like astype and to_crs, but also just making the NotImplementedErrors more informative with a clear message, or changing them to a TypeError if we think it will never be implemented for spherical geometries; move common parts to a base class, etc), the current PR already does allow some basic things. Seehttps://gist.github.com/jorisvandenbossche/2e8ecee0d109b77e03c45fca7bac385a for an overview.

The approach currently taken here is: have a separate ExtensionArray class (currently calledGeographyArray), while keeping the singleGeometryDtype class but parametrizing it with anengine parameter (currently with values "planar" (default) and "spherical"; one question with this approach is if we want to describe the type of the engine (planar vs spherical) vs the package being used (shapely vs spherely). I like the type more, but at some point we might also have more than one engine for planar geometries).
This means you can do something like to convert an existing geometry column to use the spherical support:

geoseries.astype(geopandas.GeometryDtype(engine="spherical")# or the shorter string alias if we want to enable thisgeoseries.astype("geometry[spherical]")

Of course, we could also add a dedicated method for this conversion (as_spherical orto_spherical or something like that) if that might be easier to use vs the generic type casting.

While I took the approach of the parametrized dtype here (instead of different subclasses), I think I am now rather leaning towards going for subclasses .. (moving to that model is a relatively small code change)

xref#2769

Copy link
Member

@martinfleismartinfleis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

more later...


"""
# TODO raise for unsupported keyword (and pass through spherely-speficic kwargs)
return GeographyArray(shapely.from_wkb(data), crs=crs)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Suggested change
returnGeographyArray(shapely.from_wkb(data),crs=crs)
returnGeographyArray(spherely.from_wkb(data),crs=crs)

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@martinfleismartinfleismartinfleis left review comments

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@jorisvandenbossche@martinfleis

[8]ページ先頭

©2009-2025 Movatter.jp