0

I have a project in 3.10.11 (ltr) loading a layer from a Geoscience Australia WFS. https://services.ga.gov.au/site_1/services/Geomorphology_Scale_Guide_WM/MapServer/WFSServer?request=GetCapabilities&service=WFS

In the python plugin console this layer is valid and has correct extents.

Image showing the python console testing is valid on WFS layer from Geoscience Australia

When reading this project into a standalone python script the layer is no longer valid and the extent has changed, which appears to be an error in interpreting the geometry.

command console showing python script testing layer for is valid and extents

from qgis.core import *
from qgis.gui import *
from gdal import *
from osgeo import *
import qgis.utils
import os
os.environ["PROJ_LIB"]='C:\\Program Files\\QGIS 3.10\\share\\proj;C:\\Program Files\\QGIS 3.10\\apps\\Python37\\lib\\site-packages\\pyproj\\proj_dir\\share\\proj'
QgsApplication.setPrefixPath("C:\\Program Files\\QGIS 3.10\\apps", True)
qgs = QgsApplication([], True)
qgs.initQgis()
project = QgsProject.instance()
project.read('D:\\temp\\Test.qgz')
layer = project.mapLayersByName('Guide 500K')[0]
layer.isValid()
layer.extent()
4
  • It looks like this might be a bug github.com/qgis/QGIS/issues/35354 – skirkness Nov 1 '20 at 21:56
  • Reported bug is for WMS not WFS, so may not be the same issue. Also the issue reported seems to be about an invalid layer, but the service here doesn't seem to be invalid. – nmtoken Nov 12 '20 at 11:26
  • what if instead of 'Guide 500K you use the full name of the featuretype Geomorphology_Scale_Guide_WM:Guide_500K – nmtoken Nov 12 '20 at 11:29
  • Hi @nmtoken thank you for pointing that out. This could possibly a separate bug to be reported. I tried your suggestion with the full name of the feature in both the typename and the layer name, which returned the same result. – skirkness Nov 18 '20 at 5:37

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.