[Qgis-developer] QGIS pointslayerfromtable on MS Access table

crigis chosmos78 at hotmail.com
Mon Apr 18 05:42:58 PDT 2016


Hi all, as a pyton dummy user, i'm trying to create a shp layer from an ms
access table through command line in QGIS. Target is to insert the following
code in macro 

section of a QGIS project file in order to create at any project opening the
shp file avoiding to recreate manually it in case of mdb updates. Here the
code where i 

replace sensitive information with opoortune tag:


/import processing 

def openProject(): 
       
pts=processing.runalg("qgis:pointslayerfromtable","ODBC:<UserDSNname>|layername=<tablename>|subset="and"fieldX"and"=
'ValueX'","X","Y","EPSG:32633", None) 
        processing.load(pts['OUTPUT'])/

Obviously it doesn't work :-(. I tried to manually compile the code above
(excluding "def openProject():") in pyton console in order to understand
which is the 

problem. Following the output:


/Console Python 
Usa iface per accedere all'interfaccia API QGIS oppure digita help(iface)
per le informazioni 
import processing 
pts=processing.runalg("qgis:pointslayerfromtable","ODBC:<UserDSNname>|layername=<tablename>|subset="and"fieldX"and"=
'ValueX'","X","Y","EPSG:32633", None) 
Error: Wrong parameter value: = 'ValueX'/

excluding the fieldX filter condition, the result doen't change:

/pts=processing.runalg("qgis:pointslayerfromtable","ODBC:<UserDSNname>|layername=<tablename>","X","Y","EPSG:32633",
None) 
Error: Wrong parameter value: ODBC:<UserDSNname>|layername=<tablename>/

The same error appears if i change the USERDSNname with mdb pathfile:

/Console Python 
Usa iface per accedere all'interfaccia API QGIS oppure digita help(iface)
per le informazioni 
import processing 
pts=processing.runalg("qgis:pointslayerfromtable","<pathfolder>\<DBname>.mdb|layername=<tablename>|subset="and"fieldX"and"=
'ValueX'","X","Y","EPSG:32633", None) 
Error: Wrong parameter value: = 'ValueX' 
pts=processing.runalg("qgis:pointslayerfromtable","<pathfolder>\<DBname>.mdb|layername=<tablename>","X","Y","EPSG:32633",
None) 
Error: Wrong parameter value:
<pathfolder>\<DBname>.mdb|layername=<tablename>/

I understand that ODBC connection or db access pathfile doesn't work
properly...Someone can help me?
In the web i don't find any information that can help me.
As said i am a pyton dummy user and therfore hope that there is a simple
correction to apply in the code above to make it work .
Another observation: applying the command with a csv file instead of mdb
file, all works well.



--
View this message in context: http://osgeo-org.1560.x6.nabble.com/QGIS-pointslayerfromtable-on-MS-Access-table-tp5261703.html
Sent from the Quantum GIS - Developer mailing list archive at Nabble.com.


More information about the Qgis-developer mailing list