[Qgis-developer] loading relative paths with python

Felix Schmidt felix.schmidt at uni-weimar.de
Sun Jun 29 13:20:31 PDT 2014


Hello everybody,
I try to load Natural Earth Data from a relative path inside my Plugin, 
but failed.
Pictures are no Problem with an resource-file, but shp-files which need 
also other files from the same directory don't
load with the same way:

self.admin0_layer = 
QgsVectorLayer(":ned/ne_10m_admin_0_boundary_lines_land.shp", "admin0", 
"ogr")

It works for absolute paths, but not for this with a ressource file.

I also try to load a sqlite-db from natural earth data and load this 
one, but when I include it in the resource file, the file grows up to 
1,7GB, and this is to big for a plugin.

What is the best way, to provide the vectordata with the plugin and load 
it in any OSs with relative path?

Felix Schmidt
Bauhaus-University Weimar


More information about the Qgis-developer mailing list