Is it possible to convert an
ogr datasource into a
geopandas GeoDataFrame without writing the datasource first as a physical file and reading it back? I am referring to something like
import ogr, geopandas drv = ogr.GetDriverByName('MEMORY') source = drv.CreateDataSource('test') gdf = geopandas.GeoDataFrame(source)
The above throws an error:
Traceback (most recent call last): File "", line 1, in File "C:\ProgramData\Anaconda2\envs\wps_env36\lib\site-packages\geopandas\geodataframe.py", line 47, in init super(GeoDataFrame, self).init(*args, **kwargs) File "C:\ProgramData\Anaconda2\envs\wps_env36\lib\site-packages\pandas\core\frame.py", line 422, in init raise ValueError('DataFrame constructor not properly called!') ValueError: DataFrame constructor not properly called!
Which I get, no problem. However I find it hard to believe that you can't transfer data objects from
geopandas and back without writing to physical files. What if you don't want to write a file because it is some part of an intermediate process you are trying to run?
Short of recreating the datasource feature by feature, geometry by geometry, field by field and, worst of all, transferring all the spatial reference data by writing custom wrapper functions, is there a way for
geopandas to communicate?