I think you were doing things just fine, I'm wondering if it's just the dataset. I'm thinking you were trying to open the Cycleways dataset, yes (based on your variable name of cylpaths
)? I first tried the "Car Parks" dataset on that site, and it worked with your code:
>>> from geopandas import GeoDataFrame
>>> df = GeoDataFrame.from_file("CARPARKS.mid")
>>> df
<class 'geopandas.geodataframe.GeoDataFrame'>
Int64Index: 81 entries, 0 to 80
Data columns (total 9 columns):
CARPARKNAME 81 non-null values
CODE 81 non-null values
FEATURECODE 81 non-null values
MI_PRINX 81 non-null values
MI_STYLE 81 non-null values
ORIGIN_X 81 non-null values
ORIGIN_Y 81 non-null values
UPRN 81 non-null values
geometry 81 non-null values
dtypes: float64(5), object(4)
I then tried the "Cycleways" dataset, and got the same thing as you, nothing:
>>> cyc = GeoDataFrame.from_file("CYCLEWAYS.mid")
>>> cyc
Empty GeoDataFrame
Columns: [geometry]
Index: []
>>> cyc["geometry"]
Series([], dtype: float64)
Finally, I tried to open the "Existing Shopping Areas" dataset, and it worked fine as well:
>>> shops = GeoDataFrame.from_file("EXISTINGSHOPPINGAREA.mid")
>>> shops
<class 'geopandas.geodataframe.GeoDataFrame'>
Int64Index: 6 entries, 0 to 5
Data columns (total 23 columns):
ADDRESS 6 non-null values
CODE 6 non-null values
...
TAG 6 non-null values
UNIQUE_ID 6 non-null values
UPRN 6 non-null values
geometry 6 non-null values
dtypes: float64(2), object(21)
>>> shops["geometry"]
0 POLYGON ((391004.768 343418.116, 391043.64 343...
1 POLYGON ((388249.762 347724.09, 388246.163 347...
2 POLYGON ((387592.015 345241.407, 387621.012 34...
3 POLYGON ((386842.681 349747.805, 386825.301 34...
4 POLYGON ((386823.752 349815.999, 386822.978 34...
5 POLYGON ((385983.258 351384.922, 385981.446 35...
Name: geometry, dtype: object
>>>
So, maybe it's just the original Mapinfo files perhaps?
The GDAL memory driver is written for GDAL and obviously exactly for improving the performance https://www.gdal.org/drv_memory.html as you wrote. The documentation seems to suggest that other processes can't open a memory datastore.
Memory This driver implements read and write access layers of features
contained entirely in memory. This is primarily useful as a high
performance, and highly malleable working data store. All update
options, geometry types, and field types are supported.
There is no way to open an existing Memory datastore. It must be
created with CreateDataSource() and populated and used from that
handle. When the datastore is closed all contents are freed and
destroyed.
GDAL memory rasters https://www.gdal.org/frmt_mem.html can be opened. The difference is probably that for memory raster it is possible to define the offset where the data begins in the memory:
It is possible to open an existing array in memory. To do so,
construct a dataset name with the following format:
MEM:::option=value[,option=value...]
For example:
MEM:::DATAPOINTER=342343408,PIXELS=100,LINES=100,BANDS=3,DATATYPE=Byte,
PIXELOFFSET=3,LINEOFFSET=300,BANDOFFSET=1
or
MEM:::DATAPOINTER=0x1467BEF0,PIXELS=100,LINES=100,BANDS=3,DATATYPE=Byte,
PIXELOFFSET=3,LINEOFFSET=300,BANDOFFSET=1
DATAPOINTER: address of the first pixel of the first band. The address can be represented as a hexadecimal or decimal value.
Hexadecimal values must be prefixed with '0x'. Some implementations
(notably Windows) doesn't print hexadecimal pointer values with a
leading '0x', so the prefix must be added. You can use CPLPrintPointer
to create a string with format suitable for use as a DATAPOINTER.
Best Answer
Geopandas derives the schema from the geodataframe if you don't specify it. And since your geodataframe is empty, geopandas can't derive a schema.
If you want to save an empty shapefile, you need to pass a fiona schema dict that defines the geometry type and at least one column (that's a shapefile restriction, not applicable to all output formats):
More details on schemas:
fiona.collection.Collection.schema