Skip to content

Commit 34de789

Browse files
weiji14michaelgrund
andcommitted
Tweak tempfile_from_geojson docstring and remove unused fiona code
Co-Authored-By: Michael Grund <michaelgrund@users.noreply.github.com>
1 parent bd94abc commit 34de789

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

pygmt/helpers/tempfile.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -111,19 +111,20 @@ def loadtxt(self, **kwargs):
111111
def tempfile_from_geojson(geojson):
112112
"""
113113
Saves any geo-like Python object which implements ``__geo_interface__``
114-
(e.g. a geopandas GeoDataFrame) to a temporary OGR_GMT text file.
114+
(e.g. a geopandas.GeoDataFrame or shapely.geometry) to a temporary OGR_GMT
115+
text file.
115116
116117
Parameters
117118
----------
118119
geojson : geopandas.GeoDataFrame
119120
A geopandas GeoDataFrame, or any geo-like Python object which
120-
implements __geo_interface__, i.e. a GeoJSON
121+
implements __geo_interface__, i.e. a GeoJSON.
121122
122123
Yields
123124
------
124125
tmpfilename : str
125126
A temporary OGR_GMT format file holding the geographical data.
126-
E.g. 'track-1a2b3c4.tsv'.
127+
E.g. '1a2b3c4d5e6.gmt'.
127128
"""
128129
with GMTTempFile(suffix=".gmt") as tmpfile:
129130
os.remove(tmpfile.name) # ensure file is deleted first
@@ -146,13 +147,4 @@ def tempfile_from_geojson(geojson):
146147
geoseries = gpd.GeoSeries.from_file(filename=memfile)
147148
geoseries.to_file(**ogrgmt_kwargs)
148149

149-
# with memfile.open(driver="GeoJSON") as collection:
150-
# # Get schema from GeoJSON
151-
# schema = collection.schema
152-
# # Write to temporary OGR_GMT format file
153-
# with fiona.open(
154-
# fp=tmpfile.name, mode="w", driver="OGR_GMT", schema=schema
155-
# ) as ogrgmtfile:
156-
# ogrgmtfile.write(geojson.__geo_interface__)
157-
158150
yield tmpfile.name

0 commit comments

Comments
 (0)