[QGIS-Developer] Issue reading world_map.gpkg

afernandez afernandez at odyhpc.com
Sun Jan 29 09:37:55 PST 2023


Hello,
I'm trying to automate changes in the projection used by the map canvas. If 
I open the python console and use the following command sequence:
novus_CRS = '+proj=lcc +lat_1=63.0 +lat_2=75.0 +lat_0=70.0 +lon_0=-97.0 
+datum=WGS84 +no_defs'
crs = QgsCoordinateReferenceSystem.fromProj4(novus_CRS)
qgsProject = QgsProject.instance() 
qgsProject.setCrs(crs) 
This works fine. However, and when I try to incorporate it programmatically 
(e.g. in a plugin), I keep getting the error:
Failed to open /usr/local/share/qgis/resources/data/world_map.gpkg
However, this file seems to be in the right subdirectory:
$ cd /usr/local/share/qgis/resources/data
ubuntu at ip-172-31-23-167:/usr/local/share/qgis/resources/data$ ls -l
total 12744
-rw-r--r-- 1 root root 2542 Jun 8 2022 README_world_map.md
-rw-r--r-- 1 root root 27743 Jun 8 2022 contributors.json
-rw-r--r-- 1 root root 17711 Jun 8 2022 contributors.qml
-rw-r--r-- 1 root root 8355 Jun 8 2022 qgis-hackfests.json
-rw-r--r-- 1 root root 18507 Jun 8 2022 qgis-hackfests.qml
-rw-r--r-- 1 root root 4412 Jun 8 2022 user_groups.qml
-rw-r--r-- 1 root root 8897 Jun 8 2022 user_groups_data.json
-rw-r--r-- 1 root root 12914688 Jun 8 2022 world_map.gpkg
-rw-r--r-- 1 root root 25158 Jun 8 2022 world_map_generalize.model3
Not sure why of this behavior discrepancy console vs. programmatically. 
Thanks.
AF
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20230129/361f54a2/attachment.htm>


More information about the QGIS-Developer mailing list