<div dir="ltr"><div><div><div><div>Dear QGIS-Users, <br><br></div>I try to add non-geographic table data from a CSV file using the python console (QGIS 2.14). The idea is to load this data from a URL. The following lines work and the table is added as a layer:<br><br>lyrData = QgsVectorLayer('<a href="http://intranet/637D573E40113572-export.csv">http://intranet/637D573E40113572-export.csv</a>', 'einwohner_dt', 'ogr')<br>lyrData.dataProvider().setEncoding(u'latin1')<br>QgsMapLayerRegistry.instance().addMapLayer(lyrData)<br><br></div>When the table is added all fields are imported/converted as strings. Now it seems that one way to overcome this issue is using the 'delimitedtext' provider instead of 'ogr'. However I couldn't get this provider to work with a URL. On the ogr csv-driver page I read that ogr version >= 2 should accept an open option "AUTODETECT_TYPE=YES', that should do something similar. But I couldn't find a way how to pass this option to the data provider. I tried adding it to the datasource URI like this:<br><br>lyrData = QgsVectorLayer('<a href="http://mapbender/637D573E40113572-export.csv|AUTODETECT_TYPE=YES">http://mapbender/637D573E40113572-export.csv|AUTODETECT_TYPE=YES</a>', 'einwohner_dt', 'ogr')<br><br></div>but to no avail. Is that possible somehow?<br><br></div>Thanks, Michael<br clear="all"><div><div><div><div><div><div><div><br>-- <br><div class="gmail_signature"><div dir="ltr">-----------------------------------------------------------<br>Michael Schulz<br><br><div><br></div></div></div>
</div></div></div></div></div></div></div></div>