On Thu, 7 Dec 2023 at 13:13, noshin prachi via QGIS-User <
qgis-user@lists.osgeo.org> wrote:

> Thank you Adam for your response. I have imported iface from from
> qgis.utils import iface. I am working in qgis environment.   It is my
> first work with qgis and I am finding it difficult to understand. Can you
> please share where I am going wrong? Is there any other way to activate a
> layer from multiple layers and create a map?  I have google street map ,
> shape file and dfsu file in these layers which are required to be added in
> the map.
>

iface is ONLY available when you're running the QGIS desktop application.
It contains methods for interacting with the parts of the desktop
application, which have no meaning when run from elsewhere (such as in a
notebook). In this situation you should avoid iface and use only the
classes from qgis.core instead.

Hope that helps!
Nyall



>
> On Wed, 6 Dec 2023 at 18:10, Adam Nielsen via QGIS-User <
> qgis-user@lists.osgeo.org> wrote:
>
>> > While trying to activate with iface.setactivelayer I am facing an error.
>>
>> The error is complaining that iface is None.  Your code doesn't show
>> what value you assigned to this variable - where did you set iface and
>> what value did you set it to?  I think you forgot to set it and that is
>> why you are getting this error.
>>
>> Cheers,
>> Adam.
>> _______________________________________________
>> QGIS-User mailing list
>> QGIS-User@lists.osgeo.org
>> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
>> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
>>
> _______________________________________________
> QGIS-User mailing list
> QGIS-User@lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
>
_______________________________________________
QGIS-User mailing list
QGIS-User@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

Reply via email to