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

ENH: add to_wkb / from_wkb #68

Merged
merged 8 commits into from
Nov 22, 2024

Conversation

jorisvandenbossche
Copy link
Collaborator

@jorisvandenbossche jorisvandenbossche commented Nov 10, 2024

Depends on paleolimbot/s2geography#42

Closes #38

@benbovy benbovy added this to the 0.1.0 milestone Nov 14, 2024
@jorisvandenbossche
Copy link
Collaborator Author

The upstream change is merged in s2georaphy, so this should be ready now

Copy link
Owner

@benbovy benbovy left a comment

Choose a reason for hiding this comment

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

Thanks @jorisvandenbossche! Two minor comments below.

docs/api.rst Outdated Show resolved Hide resolved
}

private:
std::shared_ptr<s2geog::WKBReader> m_reader;
Copy link
Owner

Choose a reason for hiding this comment

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

Use unique_ptr instead of shared_ptr? (Also in ToWKB) Unless I'm missing something?

Copy link
Collaborator Author

@jorisvandenbossche jorisvandenbossche Nov 17, 2024

Choose a reason for hiding this comment

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

It might be that pybind11 requires this class to be copyable? (if you pass it as argument to vectorize)
And that then gives the typical "use of deleted function" compilation errors if using unique_ptr instead of shared_ptr

Copy link
Owner

Choose a reason for hiding this comment

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

It might be that pybind11 requires this class to be copyable? (if you pass it as argument to vectorize)

Ah yes I see. Another option may be to add a FromWKB copy constructor (since this is what is passed to py::vectorize) although using a shared pointer is certainly fine.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I would personally leave it as is with a shared pointer then, to not make the small class more complicated (I don't think instantiation of the vectorized function is performance sensitive?)

Co-authored-by: Benoit Bovy <benbovy@gmail.com>
@jorisvandenbossche jorisvandenbossche merged commit acf3641 into benbovy:main Nov 22, 2024
15 checks passed
@jorisvandenbossche jorisvandenbossche deleted the io-wkb branch November 22, 2024 21:25
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.

Add IO functions to read and write WKT and WKB
2 participants