QGIS and Raspberry Pi Zero
Andrew Cutts
Consultant | Freelancer in Earth Observation | Geospatial | Python | GIS | Data Analytics
The barriers to entry have never been lower
I was gifted a Raspberry Pi Zero. It cost £4. Combine this with a 32gb MicroSD card, a phone charger for a smart phone (Android OS in my case), a micro USB to USB cable and an old laptop - its amazing what you can do.
I connected the Pi to my laptop through the USB. I used the instructions detailed here; I have expanded on this below. NB I found that I need the full version of Raspberian Jessie (not the lite version).
- Download Raspberian Jessie with Pixel
- Unzip this file (getting an .img file)
- Get yourself a copy of Win32 Disk Imager
- Flash the .img file onto your MicroSD card (you will need to be able to access the MicroSD card from your computer)
- Open up the newly created boot folder and edit the config.txt file, adding dtoverlay=dwc2 to the bottom of this file and save
- Open up cmdline.txt and replace everything in this file with below
dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait modules-load=dwc2,g_ether quiet init=/usr/lib/raspi-config/init_resize.sh
7. Create a new file in the boot directory (same place as the above 2 files). Right click to open up windows notepad and save a blank file called 'ssh'; save it with no extension. Unsure about this? read here.
8. Put this MicroSD card into your Raspberry Pi Zero. Power it up with your phone charger (the micro usb port nearest the corner of the board) - allow 90 seconds. Once done connect to computer/laptop.
9. Install PuTTy
10. Open PuTTY and all being well connect to raspberrypi.local on port 22.
default user name and password (pi - raspberry)
Beautiful; you are in! Next stop, access the GUI.
- Two downloads are needed. Firstly, the compatible version of VNCviewer for your computer that you are accessing the pi through (register an account at the same time as well). Secondly, you need to set up a vncserver on your pi. You can do this from the link above as well if you like. I chose to get it from GitHub.
2. Download a copy of WinSCP (if you don't already have it). This is ace and it allows you to send your VNC-Server-5.3.1-raspi-alpha.deb file to your pi. How? Right click on the file and send.
The user name and password are as before. Accept defaults and go.
3. On the raspberry pi terminal, type 'ls' to confirm the file is there - highlighted below
4. At the command prompt, type "sudo dpkg -i VNC-Server-5.3.1-raspi-alpha.deb" unless the .deb file has changed, then obviously you need to change this. This 'should' install the vncserver.
5. Check that you are good: type "vncserver" and you should get a prompt saying you are up and running. The last line will be an IP address. Make a note of this. If you are not getting the server running, stop and look back over the instructions above.
6. Install VNC viewer on your computer. Once installed connect to the IP address you wrote down above. And hopefully you are now at the GUI!
If you missed any of the steps and want a visual recap then this video was pretty helpful to me.
Recap - USB connected Raspberry Pi Zero through the cmd prompt and now the GUI. Hopefully it's working for you.
Getting QGIS on your Raspberry Pi Zero
Really this boils down to 2 steps. Firstly, you are going to need to get an internet connection to your pi and, secondly, use that connection to get QGIS. Fortunately both of these things are very achievable!
Internet connection to Raspberry Pi Zero (Windows 10)
- Turn off (temporarily) windows defender
- Open up your network connections and share your connection with your Raspberry Pi Zero. I am doing mine over my wireless network. And my device (pi) is Ethernet 2.
3. Turn windows defender back on.
4. You will probably have to reboot your pi. Then you will need to restart the vncserver on the pi and then you will need to run vncviewer in from desktop. If you are not sure it has worked ping www.google.com from your pi. 'sudo ping www.google.com'
5. Hopefully it has worked for you and through the GUI you will see some evidence of a connection
Great. A few commands now and we will be done.
Back to the Pi command prompt and run these commands in order:
'sudo apt-get update'
'sudo apt-get upgrade'
'sudo apt-get dist-upgrade'
'sudo apt-get install gdal-bin qgis'
instructions from here
You should now have a freshly installed version of QGIS 2.4. Check out your GUI. You can install plugins as well (I've tested!) everything seems to run as normal.
It will not be fast, you will be limited on storage on your MicroSD card, but it is astonishing that you can run a GIS system on this little computer. Yes, it was fun getting there and no, I probably will not use the pi for doing GIS type work (never say never). But I am amazed that this can be done. When I did my MSc it was command line ArcInfo on workstations. In my first job I was given the most powerful computer in the organisation to run 'GIS'.
Today I can do all these things on a £4 computer (with a few bit 'n' pieces). The barriers to entry into this technical world now are astonishingly low. Its wonderful!
Read all my blogs at gis.acgeospatial.co.uk, feel free to connect or follow me.
--
7 年sir it's available in India country
Chief Technology Officer @ AlmavivA Digitaltec - Chief Technology Officer @ Datajam
7 年To try ....
Paramedic & Firefighter | GISP | IAM | Army Veteran | Geospatial & Analytics Professional
7 年Someone needs to pool together a handful of these things and try to run ArcGIS Server on them!
Manager - Geospatial Data and Research (KPMG Future Analytics)
7 年Excellent, Thanks Andrew - now I have a good reason to use my (so far untouched) Raspberry Pi.