Bug report #16189

QgsMapLayerRegistry not defined in current master?

Added by Richard Duivenvoorde over 7 years ago. Updated over 7 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Python plugins
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:invalid
Crashes QGIS or corrupts data:No Copied to github as #:24099

Description

I wrote a small python script to load a bunch of WMTS layers:

http://www.qgis.nl/2017/02/01/topotijdreis-kaartlagen-in-qgis/

This is working in 2.x but in 3.x it fails with:

QgsMapLayerRegistry.instance()
Traceback (most recent call last):
File "C:\\OSGEO4~1\\apps\\Python36\\lib\\code.py", line 91, in runcode
exec(code, self.locals)
File "<input>", line 1, in <module>
NameError: name 'QgsMapLayerRegistry' is not defined

But it should still be there isn't it?

https://qgis.org/api/classQgsMapLayerRegistry.html

History

#1 Updated by Jürgen Fischer over 7 years ago

  • Resolution set to invalid
  • Status changed from Open to Closed

No, not anymore (that page was a leftover from when QgsMapLayerRegistry still existed - pages were only replaced, not removed on qgis.org).

QgsMapLayerRegistry was integrated in QgsProject

Also available in: Atom PDF