The top six programming languages for Data Science, according to the first links returned to me from google are:
When I searched for the top five programming languages for GIS, the top results returned this list:
- SQL (the most undervalued skill in Geospatial today)
Pretty hard to argue with the results here. I saw no mention of Julia or Scala in the top five search results for GIS programming languages.
I will use this series of posts to investigate the Julia language and its use for Geospatial Programming. In part 2 I will investigate the speed vs Python and in part 3 I will look at reading and writing Satellite data.
Why not just stick with Python?
If you are new to Geospatial programming, choose Python (or R or SQL or a mixture) – it is well supported for Geospatial development.
Julia is fast.
The benchmark tests seem to back this up, with speeds comparable to C.
The most common complaint I have heard about Python is that it is slow. For me, I’ve never really felt the pain of the slowness, it’s always done what I have wanted it to do. There is plenty of discussion about nested loops in Python and Julia, here for example. However we are in a data deluge today, and making code run faster without investing more into hardware is worth a look, I think.
This is all brand new to me, so I’ll step through what I did.
Download and install Julia from here:
At the time of writing I am installing the current stable release (v1.1.0). I found the installation of Julia pretty straightforward. There are several options for running Julia described in the link above. I am just going to run from the command line on my machine to start with. If installed correctly, when you run for the first time you should get a screen similar to this:
I found on my computer that opening Julia via Run as administrator worked best for me. At the moment that is what I would recommend you doing.
We are up and running now. Below I did a few tests on the command line:
We are going to need some packages to do the Geospatial work. In no particular order run these commands and install:
using Pkg Pkg.add("GDAL") Pkg.build("GDAL") Pkg.add("ArchGDAL") Pkg.add("ImageView") Pkg.add("Images") Pkg.add("ImageMagick") Pkg.add("Colors") Pkg.add("BenchmarkTools")
I found from testing these were the packages I needed initially. BenchmarkTools is for working out how long code took to run. The majority of the work I will show in these posts will utilise the ArchGDAL package. You can read more about it here.
Finally, let’s install the IJulia package so we can run our code in Jupyter Notebooks and, frankly, make life super easy for ourselves.
using Pkg Pkg.add("IJulia")
After this has installed, type:
using IJulia notebook(dir="D:/Julia_work/")
This will open the Jupyter Notebooks in D:/Julia_work (change to fit your drive and folder)
I can see a Python 3 and a Julia 1.1.0 kernel. I have even found that I can shut everything down and open Anaconda run:
and it allows access both my Python 3 anaconda environment and Julia environment. Meaning that I can move between languages – should I need to. This would be great for presentations. I imagine that is true for R kernels as well.
I have put together a very brief notebook on some of the basic intro ‘things’ I have been using in Julia so far. You can access it here.
If you want to go deeper I think this looks like a great place to start with Julia.
In this introductory post we have looked at the common data science languages and the common GIS languages. We have:
- Learnt how to install and get set up.
- Learnt how Julia can sit in your programming environment alongside Python.
- Plus, I’ve shared a brief notebook on some basic functions of the Julia language.
In part two I’ll show you how to load an image into an array and compare the speed with Python. In part three I’ll show you how to read and write raster data using Julia.
I am a freelancer able to help you with your projects. I offer consultancy, training and writing. I’d be delighted to hear from you.
I have grouped all my previous blogs (technical stuff / tutorials / opinions / ideas) at http://gis.acgeospatial.co.uk.
Feel free to connect or follow me; I am always keen to talk about Earth Observation.