Monday, 13 February 2017

qgis - Import CSV from online resource


With QGIS it´s easy to load non-spatial CSV Data (and use it for joins).



enter image description here


This works fine as long the CSV resides on the local file system as this answer suggests. Is there some way to import a CSV from an online resource like https://example.com/myfile.csv without first downloading it? (Maybe by use of some plugin or Python snippet?)



Answer



Yes, you can do that in QGIS.


QGIS is able to open remote resources using GDAL Virtual File Systems /vsicurl/


Add layer


Use Add Vector Layer, and write the remote URL of the CSV file with the prefix /vsicurl/. The complete filename should be something like: /vsicurl/http://localhost/~jgr/sinaletica.csv


Using your example, it should be: /vsicurl/https://example.com/myfile.csv


add remote file using vsicurl


Convert table to layer



If you just need the table for joins, you don't need this additional step.


If the table has some kind of X and Y columns, you can convert the table to a layer with geometries.


Use Create points layer from table to create a layer from the table.


use create points layer from table algorithm


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...