I have the following problem: I have two vector layers, foobar and clipLayer. About the python console I call the following command:
processing.runalg ('qgis:clip', 'foobar', 'clipLayer', None)
As a result, I get the temporary path to a Shp-file. That is so far correct. But I need the result not as a Shp-file but in a GeoJSON format.
How can I convert the shapefile to the GeoJSON format? There is a convert function within the GDAL tools.
processing.runalg('gdalogr:convertformat', input_layer, format, options, output_layer)
As a result, I get the path to a file .shp.geojson. but I want to get a GeoJSON string as a result.
Why do I need this? Within a plugin the clip function is used. The result must be further processed as a Qgsfeature. In this case I can not use a shp file.