Dear QGIS-Users, 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:
lyrData = QgsVectorLayer('http://intranet/637D573E40113572-export.csv', 'einwohner_dt', 'ogr') lyrData.dataProvider().setEncoding(u'latin1') QgsMapLayerRegistry.instance().addMapLayer(lyrData) 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: lyrData = QgsVectorLayer(' http://mapbender/637D573E40113572-export.csv|AUTODETECT_TYPE=YES', 'einwohner_dt', 'ogr') but to no avail. Is that possible somehow? Thanks, Michael -- ----------------------------------------------------------- Michael Schulz
_______________________________________________ Qgis-user mailing list Qgis-user@lists.osgeo.org List info: https://lists.osgeo.org/mailman/listinfo/qgis-user Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user