Hi Bo, iface.activeLayer().source() should give you what you want.
On Thu, Apr 29, 2021 at 2:21 PM Bo Victor Thomsen < [email protected]> wrote: > Hi list - > > I have a (probably totally obvious, stupid) Pyhton question: > > I need the datasource URI string of a maplayer chosen by the user. > > I have found the QgsMapLayer chosen by the user. And the QgsVectorLayer > associated with the Maplayer. > > How do I find the datasource string associated with the QgsVectorLayer? > > There is oodles of QGIS information about generating a vector layer from > a specific datasource. I need the opposite to generate a virtual layer > in Python using a join between the chosen layer with a another > predefined layer (which I have the datasource string for). > > -- > > Med venlig hilsen / Kind regards > > Bo Victor Thomsen > > _______________________________________________ > QGIS-Developer mailing list > [email protected] > List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer > Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer > -- Alessandro Pasotti QCooperative: www.qcooperative.net ItOpen: www.itopen.it
_______________________________________________ QGIS-Developer mailing list [email protected] List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
