I'm using Python console in QGIS to manipulate geospatial data using GeoPandas. I want to load the output (GeoDataFrame) to the canvas as vector layer directly without exporting it to a file first. Is there any way to do that?

enter image description here

  • 1
    You mean temporary (memory) vector layer, right? May 26, 2020 at 7:49
  • Right. But it solved by @ThomasG77 comment below. Thanks for the response.
    – Suhendra
    May 26, 2020 at 9:00

1 Answer 1


You can use the following

import geopandas

countries_gdf = geopandas.read_file("ne_10m_admin_0_countries.shp")

vl = QgsVectorLayer(countries_gdf.to_json(),"mygeojson","ogr")
  • It works. Thank you so much :-)
    – Suhendra
    May 26, 2020 at 8:58

Not the answer you're looking for? Browse other questions tagged or ask your own question.