Accessing CSV data directly from website

The documentation says "SrcLayer is optional". But without it I couldn't add the CSV file as vector layer to QGIS.

I've added <SrcLayer>conposcovidloc</SrcLayer> and changed vsicurl to vsicurl_streaming, then it worked.

<OGRVRTDataSource>
    <OGRVRTLayer name="COVID Cases">
        <SrcDataSource relativeToVRT="0">/vsicurl_streaming/https://data.ontario.ca/dataset/f4112442-bdc8-45d2-be3c-12efae72fb27/resource/455fd63b-603d-4608-8216-7d8647f43350/download/conposcovidloc.csv</SrcDataSource>
        <SrcLayer>conposcovidloc</SrcLayer>
        <GeometryType>wkbPoint</GeometryType>
        <LayerSRS>WGS84</LayerSRS>
        <GeometryField encoding="PointFromColumns" x="Reporting_PHU_Longitude" y="Reporting_PHU_Latitude"/>
    </OGRVRTLayer>
</OGRVRTDataSource>

enter image description here


At least I managed to read data with ogrinfo with a little modified VRT file.

<OGRVRTDataSource>
<OGRVRTLayer name="conposcovidloc">
    <SrcDataSource relativeToVRT="0">/vsicurl_streaming/https://data.ontario.ca/dataset/f4112442-bdc8-45d2-be3c-12efae72fb27/resource/455fd63b-603d-4608-8216-7d8647f43350/download/conposcovidloc.csv</SrcDataSource>
    <GeometryType>wkbPoint</GeometryType>
    <LayerSRS>WGS84</LayerSRS>
    <GeometryField encoding="PointFromColumns" x="Reporting_PHU_Longitude" y="Reporting_PHU_Latitude"/>
</OGRVRTLayer></OGRVRTDataSource>

Test with

ogrinfo test.vrt -al
...
OGRFeature(conposcovidloc):1
  Row_ID (String) = 1
  Accurate_Episode_Date (String) = 2020-01-22
  Case_Reported_Date (String) = 2020-01-23
  Test_Reported_Date (String) =
  Specimen_Date (String) = 2020-01-25
  Age_Group (String) = 50s
  Client_Gender (String) = FEMALE
  Case_AcquisitionInfo (String) = TRAVEL
  Outcome1 (String) = Resolved
  Outbreak_Related (String) =
  Reporting_PHU_ID (String) = 3895
  Reporting_PHU (String) = Toronto Public Health
  Reporting_PHU_Address (String) = 277 Victoria Street, 5th Floor
  Reporting_PHU_City (String) = Toronto
  Reporting_PHU_Postal_Code (String) = M5B 1W2
  Reporting_PHU_Website (String) = www.toronto.ca/community-people/health-wellness-care/
  Reporting_PHU_Latitude (String) = 43.65659125
  Reporting_PHU_Longitude (String) = -79.37935801
  POINT (-79.37935801 43.65659125)

Tags:

Csv

Qgis

Vrt