Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ jobs:
numpy-version: '1.26'
pandas-version: ''
xarray-version: ''
optional-packages: ' contextily geopandas ipython pyarrow rioxarray sphinx-gallery'
optional-packages: ' contextily geopandas ipython pyarrow pyogrio rioxarray sphinx-gallery'

timeout-minutes: 30
defaults:
Expand Down
14 changes: 6 additions & 8 deletions pygmt/helpers/tempfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.

import json

import fiona

with fiona.Env():
jsontext = json.dumps(geojson.__geo_interface__)
# Do Input/Output via Fiona virtual memory
with fiona.io.MemoryFile(file_or_bytes=jsontext.encode()) as memfile:
geoseries = gpd.GeoSeries.from_file(filename=memfile)
geoseries.to_file(**ogrgmt_kwargs)
import pyogrio

jsontext = json.dumps(geojson.__geo_interface__)
# Do Input/Output via Pyogrio (GDAL) virtual memory
geodataframe = pyogrio.read_dataframe(jsontext)
geodataframe.to_file(**ogrgmt_kwargs)

yield tmpfile.name

Expand Down