2

I want to a load shapefile on QGIS start-up but when I add it I'm asked to save before I can add it.

I used following code for this:

      c=''
      b=os.path.dirname(os.path.abspath
      (inspect.getfile(inspect.currentframe())))
      c=os.path.abspath(os.path.join(b, os.pardir))
      c=c+"/C_final.shp"          
      layer=self.iface.addVectorLayer(c,"Country_map","ogr") 

If I create macro then I am unable to find the path for shapefile. I want to make it path independent. If I add this shapefile and select the option project on launch and make it default project then it become path dependent.

How could I make it a path independent and open it on QGIS start-up?

  • Sorry but I don't understand the file path logic you are trying to implement. Could you clarify that? – underdark Sep 11 '15 at 19:20
  • I just want to get path of shape file in qgis macro and add this shapefile to qgis at startup, this logic is work with python plugin but not in qgis macro it never get the path of shapefile in macro – ashish Sep 14 '15 at 11:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.