Using the GDAL/OGR API, I need to be able to convert various types of GDAL datasources into GeoJSON. However, I do not want to write the GeoJSON to a file, but rather I need to just return the text string within the application.
For example, if I have a set of shapefiles, I want to be able to extract the data from one of these shapefiles as a GeoJSON text string.
I want to avoid the slow I/O penalty of writing it to a file and then reading the file and then deleting the file. Such I/O would likely slow things down too much, as I would be running such tasks very frequently (if I can ever get it to work).
Is there some way to get GDAL data as GeoJSON text without writing it to a file first?
Note that I'm using the C API for GDAL/OGR within an application. So a C or C++ solution would be preferred. However, I'm also open to other suggestions which may give me other ideas.
PS . This is on iOS.