GEOG 583
Geospatial System Analysis and Design

Overview of Programming Languages for GIS

Overview of Programming Languages for GIS

An essential element in designing many geospatial systems is the choice of what programming language (or languages) to use. Most of the exciting projects we can envision will involve at least some programming to customize existing tools or to develop completely new ones.

There is an astounding variety of programming languages that are useful for geospatial professionals today. Wikipedia lists over 600 languages, which excludes the byzantine variety of dialects of BASIC past and present.

Characterizing Programming Languages

One important means of characterizing programming languages is according to their type systems, that is, the rules by which one can assign meaning to variables or objects. One fundamental divide is between static and dynamic typing. Statically typed languages such as C, C++, C#, and Java evaluate type information at compilation time, and reject code that is not well-formed. The advantage of this is that many errors can be caught at compilation time instead of run-time, and errors can be caught/fixed earlier in the process. The disadvantage of static typing is that it makes the code more verbose, and you can sometimes spend a lot of time "making the compiler happy." Dynamically typed languages such as Python, JavaScript, PHP, and Ruby delay type checking until run-time. Therefore, you often don't have to specify the type of a variable before you use it. The advantage of dynamic typing is in the ease of programming; the disadvantage is that some errors will slip through until you run the program, and these errors can then be difficult to pin down in your code.

Common Programming Languages used with GIS

There is a large number of programming languages in use today, and there is no “best” option, really. We focus here on those that are the most relevant to contemporary geospatial systems. The table below compiles several recent lists of languages from 2019 and 2018. The first 3 columns are based on surveys of use/users, and the basis of ordering for the last 3 columns was not explicit. Only one of the lists (from GoGeomatics), is specific to GIS, and that one represents the opinion of a single developer. The most important takeaways from this table are that: (1) there are many popular languages and diverse opinions on their relative merits, and (2) Python, Java, and JavaScript are in the top 5 on every list, with C++ and C# on 5 of 6 lists, PHP on 4 of 6, and C, R, Ruby, Rust, Shell, SQL, and TypeScript trailing the others with 2 lists each. For those interested in trends over time in programming language popularity, check out the 2002-present TIOBE Programming Community Index timeline.

Common Programming Languages in the Geospatial Industry

Rank Business Insider - ranking based on GitHub IEEE Survey of members (2018) Stack Overflow Developer Survey (2019) GoGeomatices: Top Languages in the GIS World Full Stack Academy (9 best to learn) Women Who Code
1 JavaScript Python JavaScript Python JavaScript Python
2 Java C++ HTML/CSS JavaScript Swift Java
3 Python Java SQL R Java JavaScript
4 PHP C# Python SQL C/C++ Rust
5 C++ R Java Java Python Kotlin
6 C# PHP Bash/Shell C/C++ PHP _
7 TypeScript JavaScript C# C# Ruby _
8 Shell Go PHP - C# -
9 C Assembly C++ - Rust -
10 Ruby Matlab TypeScript - - -

Below, we provide a brief description of the programming languages that show up on two or more of the lists. The first group (in alphabetical order) are those showing up on 5 or more lists, thus the ones that are generally most popular across the range of developers. Then (also in alphabetical order) we outline key features of those showing up on fewer (but at least 2) lists. These descriptions are followed by a perspective on making application-specific choices of languages that are well suited to particular GIS (and other geospatial) development tasks.

If you see any languages you feel are relevant for GIS but are missing here, or you have good examples of an effective geospatial application that leverages any of the languages, please sing out by making a comment in the Canvas General Questions Discussion Forum!

Popular Programming Languages

  1. Python — Python is very popular today, and is the primary scripting language in use in both ArcGIS and QGIS. Python is frequently considered to be a good "glue" language, and it is generally easy to work with. It has many extensions, such as SciPython and Numerical Python. 
  2. JavaScript — JavaScript is a current leader for User Interfaces in web applications. Google Maps is a heavy user of JavaScript, Esri’s ArcGIS API for JavaScript supports web map development, and leading open source web map clients (OpenLayers, Mapbox GL JS) are also based on JavaScript. D3 is a very popular web visualization library that underpins quite a lot of interactive web maps you see today.
  3. C# — C# was Microsoft's answer to Java (see below), and is the flagship programming language for .NET. So, if you were starting to write a new add-on to ArcGIS using the .NET SDK, you'd be working in C#.
  4. C++ — C++ is a general-purpose programming language (derived from C), with both procedural and object-oriented features, that is often used in embedded systems. Developed in 1985, its popularity has been in general decline since about 2004 (probably due to a steep learning curve and general complexity), but it has held on to a significant share of projects all the same. Many software applications you use every day were written in C++ or use C++ for at least part of the implementation (ArcGIS, Windows OS, Firefox, MS Office, etc., etc.), so it isn't going away anytime soon.
  5. Java — Java remains a popular choice, although its popularity is declining by most measures year-over-year. Java is used in the GeoServer and Java Topology Suite (JTS) projects, for example.

Other Important Programming Languages

  1. C — C is the elder of the family. When you need top performance, you use C, as it is "close to the metal." This is great if you need to code a device driver, but not so great if you need to create a web app. Many open source GIS projects are written in C. For example, the GDAL (Geospatial Data Abstraction Library) is written in a combination of C and C++.
  2. PHP — PHP is one of the best ways to whip up an interactive website and, thus, it is quite popular.
  3. R and S — R and S are scripting statistical languages with a lot of very sophisticated spatial statistics that can use some of the output from ArcGIS. Plus, on its own, there are many spatial extensions to R that support a wide range of geospatial capabilities (e.g., see: CRAN Task View: Analysis of Spatial DataSpatial Data Science with R, and r-spatial.
  4. Ruby — Ruby is an older language that has become more popular recently. Ruby got major traction due to Ruby on Rails, which made it easy to set up a database-backed application. This has been extended to web maps by GeoCommons. Some other interesting neogeography sites such as OpenStreetMap and WeoGeo utilize Ruby.
  5. Rust — Rust is an open source language supported by developers with the Mozilla Foundation. It is conceptually related to C++, but designed to be safer in relation to security threats. Women who Code say Rust has “loads of promise for game engines, VR simulation engines, VR controllers,” thus as more GIS-based VR develops, Rust may become more popular in our community.
  6. Shell — Shell is a scripting language for use in Unix (and Linux and Mac OS) environments. It allows a user to chain Unix commands together, having the system execute them as an event. For one example of using Shell with GIS, see this guide for Shell scripting with the GRASS GIS.
  7. SQL — SQL is used as a database access and control language. SQL is at the heart of many GIS operations. SQL is a great example of a language that has survived for a long time. It has survived so long because it is declarative instead of procedural. That is, SQL statements tell what you want to happen, not how you want it to happen. Therefore, implementation details are hidden and can change over time. This means SQL is set to remain relevant in a world of cloud computing, which we will discuss in this week's tech trend.
  8. TypeScript — TypeScript is an object-oriented programming language that is a superset of JavaScript. It has been described as “JavaScript that scales”. As with JavaScript, support exists for using TypeScript with the ArcGIS for JavaScript API and the and the Google Maps JavaScript API. There is also support for TypeScript with the Bing Maps SDK and for using Leaflet in TypeScript, among others.

Making Application-Dependent Choices

Many GIS projects leverage more than one of the languages detailed above. This is because different tasks in GIS are better supported by some of the languages than others. While different developers have varying opinions on the best match of languages to tasks, one Task-Language list worth a look (specific to GIS-related work) is produced in 2016 by Florin-Daniel Cioloboc.

  • GIS Scripting and applications (Python, R)
  • Data processing, analysis, and modeling (Python, R)
  • Web Mapping (JavaScript, Python)
  • Geospatial databases (SQL)
  • MapServers (Java, C# .NET, C++)
  • GIS heavy-weight development (Java, C/C++, C#)
  • Mobile development (Android, iOS, JavaScript)
  • Geospatial libraries (JavaScript, Python, Java, R, C/C++)