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

POC: Handle __geo_interface__ objects using pyogrio instead of fiona #3237

Closed
wants to merge 2 commits into from

Conversation

weiji14
Copy link
Member

@weiji14 weiji14 commented May 9, 2024

Description of proposed changes

Save objects that implement __geo_interface__ (e.g. shapely geometries) to a temporary OGR_GMT file via pyogrio and geopandas instead of fiona.

Note that this would mean that users must have geopandas installed, and cannot just install fiona.

Fixes error seen at #3180 (comment), Addresses #3231

Reminders

  • Run make format and make check to make sure the code follows the style guide.
  • Add tests for new features or tests that would have caught the bug that you're fixing.
  • Add new public functions/methods/classes to doc/api/index.rst.
  • Write detailed docstrings for all functions/methods.
  • If wrapping a new module, open a 'Wrap new GMT module' issue and submit reasonably-sized PRs.
  • If adding new functionality, add an example to docstrings or tutorials.
  • Use underscores (not hyphens) in names of Python files and directories.

Slash Commands

You can write slash commands (/command) in the first line of a comment to perform
specific operations. Supported slash command is:

  • /format: automatically format and lint the code

Save objects that implement __geo_interface__ (e.g. shapely geometries) to a temporary OGR_GMT file via pyogrio and geopandas instead of fiona.
@weiji14 weiji14 added the bug Something isn't working label May 9, 2024
@weiji14 weiji14 added this to the 0.13.0 milestone May 9, 2024
@weiji14 weiji14 self-assigned this May 9, 2024
@@ -154,14 +154,12 @@ def tempfile_from_geojson(geojson):
# Other 'geo' formats which implement __geo_interface__
Copy link
Member

Choose a reason for hiding this comment

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

The pyogrio package doesn't support the schema parameter. With geopandas 1.0 released, pyogrio will be the default engine, and then the code at lines 136-150 will break.

We need to find a way to support both geopandas 0.x and 1.x.

@seisman
Copy link
Member

seisman commented May 13, 2024

After PR #3247, changes in this PR are no longer needed, but we still need to address the following errors with geopandas 1.x:

        if schema is not None:
>           raise ValueError(
                "The 'schema' argument is not supported with the 'pyogrio' engine."
            )
E           ValueError: The 'schema' argument is not supported with the 'pyogrio' engine.

I guess we need to check the geopandas version, and pass schema or not depending on if it's geopandas 0.x and 1.x. Not sure if pyogrio has the issue with int64 numbers.

@seisman seisman deleted the output_geo_interface_via_pyogrio branch May 20, 2024 04:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants