@@ -111,19 +111,20 @@ def loadtxt(self, **kwargs):
111
111
def tempfile_from_geojson (geojson ):
112
112
"""
113
113
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.
115
116
116
117
Parameters
117
118
----------
118
119
geojson : geopandas.GeoDataFrame
119
120
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.
121
122
122
123
Yields
123
124
------
124
125
tmpfilename : str
125
126
A temporary OGR_GMT format file holding the geographical data.
126
- E.g. 'track-1a2b3c4.tsv '.
127
+ E.g. '1a2b3c4d5e6.gmt '.
127
128
"""
128
129
with GMTTempFile (suffix = ".gmt" ) as tmpfile :
129
130
os .remove (tmpfile .name ) # ensure file is deleted first
@@ -146,13 +147,4 @@ def tempfile_from_geojson(geojson):
146
147
geoseries = gpd .GeoSeries .from_file (filename = memfile )
147
148
geoseries .to_file (** ogrgmt_kwargs )
148
149
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
-
158
150
yield tmpfile .name
0 commit comments