GIS Programming: Languages breakdown

4

A while back, I wrote a post on Learning GIS Programming, giving an overview of the different programming languages being used in GIS. A follow-up post with more detailed information on the different programming languages has languished at the bottom of my To-Do list for a while now.

Luckily for me, I found the following post from Atle on his personal website that covers pretty much everything that I wished to write about in the first place. I contacted Atle and he graciously let us re-post his original article on Geoawesomeness. Thank you Atle 🙂

progLanguages

Info: The following post was written by Atle Frenvik Sveen on his personal website and has been re-posted under Creative Commons. You can follow Atle on Twitter and here’s the link to his personal website and his Github.

GIS Programming: languages breakdown by Atle Frenvik Sveen

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 languege, 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 iperative 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 beeing used for several desptop 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 Andoid 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 beed 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 souce 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.

(Here’s the link to my posts on overview of JavaScript For Geospatial Application and the Getting Started guide) – Muthu

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, altough 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!

Here’s the link to Atle’s original post.

I am one of those passionate "Geo-geeks" and "Geo-people" who is just too excited about everything Geo and Management. Location information and spatial technologies are just too big to take a back seat and watch them revolutionize the world. Always curious and looking for ways to innovate, I guess that it comes naturally by the gene pool I inherited from an engineer Mom and a researcher Dad.
  • Pingback: GIS Programming: Languages breakdown - Slashgeo.org()

  • Barry Rowlingson

    What about R? Although thought of as a “stats package”, the language has geo-addons galore – including spatial vector and raster data structures, the usual GIS overlay/intersect/union operators, connections to base maps from OSM and google, wrappers for Javascript web mapping like leaflet and OpenLayers.

    • Tina Cormier

      Took the words out of my mouth! If you are in the scientific community (as I am), R is where it’s often where it’s at! Also, postgreSQL/postGIS – pretty much anything can be done in the database!!!

  • In the world of MapInfo Pro the scripting language is called MapBasic