TransWikia.com

PyQGIS error: proj_create_from_database: Cannot find proj.db

Geographic Information Systems Asked on December 26, 2020

I have problem with QGIS. When I run my code in QGIS Python console it works but when I try in console I’m getting an error. Code:

import sys
 
from qgis.core import QgsApplication, QgsProcessingFeedback
from qgis.analysis import QgsNativeAlgorithms
 
QgsApplication.setPrefixPath(r'C:/PROGRA~1/QGIS3~1.16/apps/qgis', True)
qgs = QgsApplication([], True)
qgs.initQgis()
 
# Add the path to processing so we can import it next
sys.path.append(r'C:/PROGRA~1/QGIS3~1.16/apps/qgis/python/plugins')

import processing
from processing.core.Processing import Processing
 
Processing.initialize()
QgsApplication.processingRegistry().addProvider(QgsNativeAlgorithms())
feedback = QgsProcessingFeedback()

processing.run("native:joinattributesbylocation", {'INPUT':'C:/Users/ja/Inne/Desktop/bdot10k_bubd_a/bdot10k_bubd_a.gpkg','JOIN':'C:UsersjaInneDesktopPOLSKAPRG_PunktyAdresowe_POLSKA.shp','PREDICATE':[1,5],'JOIN_FIELDS':['PNA','SIMC_id','SIMC_nazwa','ULIC_nazwa','Numer'],'METHOD':1,'DISCARD_NONMATCHING':True,'PREFIX':'','OUTPUT':'C:/Users/ja/Inne/Desktop/projekt2.gpkg'})

What is the problem?

Error: >>>
... from qgis.core import QgsApplication, QgsProcessingFeedback
>>> from qgis.analysis import QgsNativeAlgorithms
>>>
... QgsApplication.setPrefixPath(r'C:/PROGRA~1/QGIS3~1.16/apps/qgis', True)
>>> qgs = QgsApplication([], True)
>>> qgs.initQgis()
>>>
... # Add the path to processing so we can import it next
... sys.path.append(r'C:/PROGRA~1/QGIS3~1.16/apps/qgis/python/plugins')
>>>
>>> import processing
>>> from processing.core.Processing import Processing
>>>
... Processing.initialize()
>>> QgsApplication.processingRegistry().addProvider(QgsNativeAlgorithms())
proj_create_from_database: Cannot find proj.db
True
>>> feedback = QgsProcessingFeedback()
>>>
>>> processing.run("native:joinattributesbylocation", {'INPUT':'C:/Users/ja/Inne/Desktop/bdot10k_bubd_a/bdot10k_bubd_a.gpkg','JOIN':'C:UsersjaInneDesktopPOLSKAPRG_PunktyAdresowe_POLSKA.shp','PREDICATE':[1,5],'JOIN_FIELDS':['PNA','SIMC_id','SIMC_nazwa','ULIC_nazwa','Numer'],'METHOD':1,'DISCARD_NONMATCHING':True,'PREFIX':'','OUTPUT':'C:/Users/ja/Inne/Desktop/projekt2.gpkg'})
proj_create_from_wkt: Cannot find proj.db
proj_create_from_database: Cannot find proj.db
ERROR 1: PROJ: proj_identify: Cannot find proj.db
proj_create_from_wkt: Cannot find proj.db
proj_identify: Cannot find proj.db
proj_get_authorities_from_database: Cannot find proj.db
ERROR 1: PROJ: proj_identify: Cannot find proj.db

One Answer

Solution:

I have changed interpreter and it works.

Interpreter: C:Program FilesQGIS 3.16binpython-qgis.bat

Correct answer by datasciencebegginer on December 26, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP