From 0a5d59829a8a1d2a4175cc6606915246fc2381de Mon Sep 17 00:00:00 2001 From: Danzig Date: Wed, 18 Mar 2020 13:35:31 +0100 Subject: [PATCH] Fix CSV loading --- covid19-load-qgis.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/covid19-load-qgis.py b/covid19-load-qgis.py index 9fed44a..6ba848e 100644 --- a/covid19-load-qgis.py +++ b/covid19-load-qgis.py @@ -34,12 +34,12 @@ # Load Confirmed Cases CSV to QGIS cases_latest = next(csv.reader(open(cases)))[-1].replace("/","-") -cases_local = "file://{uri}?delimiter={delimiter}&crs=epsg:4326&xField={x}&yField={y}".format(uri=cases, delimiter=",", x="Long", y="Lat") +cases_local = "file:///{uri}?type=csv&detectTypes=yes&subsetIndex=no&watchFile=no&delimiter={delimiter}&crs=epsg:4326&xField={x}&yField={y}".format(uri=cases, delimiter=",", x="Long", y="Lat") cases_layer = QgsVectorLayer(cases_local, "covid19-cases-as-of-{latest}".format(latest=cases_latest), "delimitedtext") QgsProject.instance().addMapLayer(cases_layer) #Load Deaths CSV to QGIS deaths_latest = next(csv.reader(open(deaths)))[-1].replace("/","-") -deaths_local = "file://{uri}?delimiter={delimiter}&crs=epsg:4326&xField={x}&yField={y}".format(uri=deaths, delimiter=",", x="Long", y="Lat") +deaths_local = "file:///{uri}?type=csv&detectTypes=yes&subsetIndex=no&watchFile=no&delimiter={delimiter}&crs=epsg:4326&xField={x}&yField={y}".format(uri=deaths, delimiter=",", x="Long", y="Lat") deaths_layer = QgsVectorLayer(deaths_local, "covid19-deaths-as-of-{latest}".format(latest=deaths_latest), "delimitedtext") QgsProject.instance().addMapLayer(deaths_layer)