4

QGIS is running on my Windows PC.

I have a CSV file on my PC that is remotely updated with values of a raspberry pi's GPS position and some wifi-status readings.

Is it possible to create a vector layer to map out the raspberry pi's position automatically along with the wifi-status readings?

  • 1
    What have you tried? You can use Python to construct a vector point layer from the CSV, with a loop to check for updates after a period of time elapses, then refresh the display. So to answer your question, yes. – Richard Law Jan 10 '16 at 7:48
  • 1
    Did you want to see the vector as a point or line? – SaultDon Jan 10 '16 at 7:48
8

The easiest way to see these updates as changes are made to the csv is to use the "Add Delimited Text Layer" button and choose "watch file" as one of the options.

I noticed with the spatial index feature enabled, it doesn't update the layer extent (so the zoom to layer button doesn't do what it's supposed to) or the index as new features are added, so maybe try it without a spatial index. But regardless, every time the canvas is refreshed (from a pan or zoom for example) the new features are displayed immediately.

watch a csv for changes in qgis

You'll find QGIS to be flexible with it's styling and I'd be curious if you could get, or it'd be helpful if the most recent point or feature was styled with an animation like how Nathan Woodrow describes in his blog: http://nathanw.net/2014/10/29/animated-qgis-map-canvas-item/ or even colour coded based on the wifi-status as described by underdark in the answer: https://gis.stackexchange.com/a/42402/1297

4

You can use org2ogr to convert CSV file to GIS format, e.g. Shape file. Shape files are not the best solution if you would like to write and read the same file, they will block each other. You had better to use PostGIS database.

AFAIK the best solution would be:

  1. from your Raspberry send the actual coordinates to a web server where a PHP/Python/whatever script will process it
  2. the PHP/Python/whatever script uploads the coordinates and attributes to the PostGIS database
  3. Meanwhile clients can connect/read the database and display positions, e.g. in QGIS
  4. You can build a WMS/WFS service on the PostGIS database, so any standard WMS/WFS client can be used on the client side (e.g. OpenLayers, QGIS, etc.). This solution is more secure then the direct database connection from GIS clients, database port is not opened to the world.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.