GIS Programming: languages breakdown

Yesterday i found this post on geoawesomeness, with the intriguing headline “Learning GIS programming: An overview”. After reading it I felt a bit disappointed though. It was basically a breakdown of different programming languages and their usages in the GIS field. While this in itself is a good thing, I think it left a great deal out and confused some. Then I thought “well, instead of complaining, do it better yourself!”.

So here we go, my breakdown of some selected programming languages, their usages in the GIS field, along with notable examples and libraries. I’m ordering the languages roughly by age. Bear in mind that I was born in the 80ies, so your favourite language from before 2000 might not make it to the list if it’s not around anymore.

Fortran
This may be the exception to the previous statement, but Fortran is still around, I’ve even programmed in Fortran.

Fortran is an imperative language, the first compiled language, dated back to 1957. It’s still used today in numerical computations, but in the GIS field it’s largely legacy code that still is in Fortran. The only example I can think of is a set of geodesic functions we used at the university: Holsen’s småprogrammer.

Unless you know Fortran by heart and like working with legacy code you can safely ignore this language.

C/C++
C and C++ is actually two different languages, or: C++ is a superset of C with object oriented capabilities, while C is an imperative language. They date from 1970/1980, and since I don’t really know these languages I’ll treat them like the same. My impression is that they are rather “down to the metal”, you have pointers, memory management and stuff like that.

Unlike Fortran, C/C++ is still in widespread use, in the GIS-field it’s being used for several desktop applications of some age, as well as in what I’ll call the “first wave” of open source libraries and utilities. Notable mentions are PostGIS, OGR/GDAL, PROJ.4 and Mapserver.

While you may now know C/C++ and never really write a line of code in it, you will be using some tools written in it, either as a database, through the command line or through language bindings.

Java
Java is an object-oriented, multi-purpose language from 1995. It was originally developed by SUN. It’s become known for it’s rather “enterprisy” libraries, with several layers of abstractions and other strange things. Despite this, the language has gained widespread use, although it’s prime time may be past, although Java is the programming language for Android apps.

Java libraries was the “second wave” of open source GIS, and brought us libraries and tools like GeoServer, GeoTools, JTS and GeoWebCache.

Just because of GeoServer I think you should know some Java to get along as a GIS-developer. GeoServer has support for plugins, written in Java. This means that mastering Java you will be able to extend GeoServer to your needs. Java is not all that difficult in itself, but Java-code tends to be bogged down in layers of abstraction as mentioned earlier.

C#
C# is, in a way, Microsofts version of Java. It’s object oriented at it’s core, and a multi purpose language. Released in 2000 it’s gained a large following in “Microsoft shops”, and it’s way better than anything Microsoft has previously made. The language itself is rather nice, but suffers from some of the same enterprisyness as Java, and the tooling is completely tied to Microsoft (Visual Studio and the like) if you stick with the .NET-platform (as most do).

This may be the reason why the open source community hasn’t embraced C#, but there are some ok-ish libraries, mainly NetTopologySuite and some ports of Proj.4. At least in Norway you’ll have to be a good navigator to avoid C# and .NET, it seems to be the preferred language and platform for several consultancies, software houses and governmental bodies.

Python
Python is a multi-paradigm, dynamically typed language focused on readability. It’s not the fastest language around, but can use C/C++ bindings to speed up things.

Python has been adopted by ESRI as the scripting language of choice for their ArcGIS-platform, as well as by QGIS, where you have access to a python REPL and can write plugins using Python. There are also other GIS-libraries for Python, mainly Shapely, Fiona and Rasterio, as well as several other tools. On the applications side there is the tile server MapProxy and several other utilities.

Python is a really great programming language in itself, easy to grasp, enforces clean, readable code, and with the usage both in ESRI and QGIS it’s a language that you most definably should know it you work with GIS.

JavaScript
JavaScript was once known as the programming language for web browsers, and was regarded as clumsy, difficult and a toy language. That’s changed a bit the last years, with better tooling and some improvements to the language itself, but it still is a dynamic language with both parts object orientation and functional programming sides to it. The rise of Node.js also made JavaScript a general-purpose language, and this constitutes the “third wave” of open source GIS-libraries if you ask me.

From the advent of Google Maps and OpenLayers, JavaScript found it’s place in the GIS-domain as the language to write web map clients in (that is, after people realized that Flash and Sliverlight where blind alleys). Now there is a large ecosystem of browser-libraries, such as OpenLayers 2 & 3, Leaflet, mapbox-gl-js, proj4js and several more.

As for Node.js, this has been adopted by the “geohipster”-company Mapbox, which uses JavaScript for several parts of their server-stack, resulting in open source libraries such as Turf.js.

Again, JavaScript is really a language to focus on if you plan on doing any web-related GIS-work at all. Just don’t think you know JavaScript because the syntax is close to that of Java/C#, and do take your time to dig in to the functional sides of the language. And stay clear of Angular.js, unless you really like enterprisy code! JavaScript still has it’s quirks, and there are released several new frameworks, tools and libraries each day, so you may find this language a bit confusing.

These are mainly the languages that are used today as far as I know, but there are some other languages that might be worth looking into, namely:

Swift/Objective-C: Used for app development on the Apple platform, I really don’t know anything about this, but there gotta be some libraries, as there are maps both on iPhones and iPads.

Go Is a relatively new language from Google, perhaps described as C for the new century? I’ve never used it, but I wan’t to use it as I know several people who really seem to like it. As for GIS-libraries I’m not sure, but I believe there are wrappers for OGR/GDAL and Proj.4 available.

Clojure Is a Lisp-implementation using the JVM. It’s really functional programming, a style which I’ve been attracted to the last year or so, although I haven’t used Clojure at all, and I do not know if there are any GIS-libraries available, but hopefully?

There are probably a dozen more languages that could be included in this list, like Scala, Groovy, Ruby or PHP, but I really don’t know them at any depth, and I’m not sure about how they stack up when it comes to GIS. If you do know, drop me a comment!

3 thoughts on “GIS Programming: languages breakdown

  1. Steffen

    “And stay clear of Angular.js” ? Why is that? I have used angularjs in several projects with GIS-components with success. It takes some time get to know the framework, but you can do so much with so little code when you do. Angular 2.0 will be different entirely though and that needs to be considered in long-term projects. Which MV* framework do you prefer when developing GIS-apps?

  2. Atle Post author

    Steffen: This post is a bit, let’s say, opinionated, and if you read the parts on Java and C# you’ll know that I’m no big fan of “enterprise code”.

    While I haven’t used Angular for more than a couple of small projects and experiments, my impressions is that Angular is:
    - Extremely “enterprisy” (i.e: JavaScript for people who write Java or C#)
    - Locks you into the Angular way on all things
    - Very far from the functional part of JavaScript that I’ve grown to like.

    And, since Angular 2.0 is going to be something completely different, I don’t see any point in investing time in understanding the “angular way” now.

    That said, I know there are many programmers that has made great webapps using angular, so it can’t be all bad, and there is always the (odd?) chance that I’m wrong.

    For alternatives: I’ve been using Backbone.js for several years, it is in no way as opinionated as Angular (for good or worse), and it has far less “batteries included”, but this framework suits my style I guess.

    I’ve also started to use React.js for some projects as of lately, and I’ve really come to like their way of doing things (althogh I don’t agree with everything there either).

    I think the bottom line is that one has to know JavaScript itself before jumping on the framework-bandwagon.

  3. Steffen

    Your impressions of Angular is true, and I agree that learning the “angular way” should be done using Angular 2.0. However, I can see benefits using Angular in an enterprise enviroment and larger teams. Angular is a framework to keep an eye on. It is backed by Google and Microsoft and is very popular in the community!

    I have just played around with backbonejs, but I would love to see how it works in a larger application. Reactjs is very exciting. The concept of the “virtual DOM”, and integration with native platforms in particular. Do you know any good projects using GIS with Reactjs?

    Vanilla JavaScript is without doubt the most important to know for every web developer. And to know well.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>