Geographical visualisations in Mendix
At my job at Valcon, I have built many applications over the past 10 years. For a lot of our clients, the geographical aspect of their business is an important part of the day-to-day work. Think for example of infrastructure companies owning assets, construction companies doing projects at a variety of places and utility companies using resources. Most of the Mendix projects we do therefore have a geographical component. In this type of project, it is important to connect the day-to-day business to geographical visualisations.
One of the first steps in connecting the day-to-day business to geographical visualisations is to decide which platform to use. Two main players commonly used for these visualisations are Google (Maps) and Esri (ArcGIS). In my previous blog, I shared my learnings on how I built a generic but fully customisable Google Maps widget. Today, I want to share my learnings on building another great – and freely available – ArcGIS widget.
ArcGIS vs. Google Maps
Let’s start with a quick comparison between ArcGIS and Google Maps. When it comes to more advanced GIS needs, ArcGIS is a richer platform in terms of out-of-the-box functionality. ArcGIS is built to support business operations in their day-to-day work by extending various out-of-the-box GIS features. When building a (Mendix) widget, one needs an API to integrate both platforms.
The ArcGIS API is a complete API with heaps of functions catering for all kinds of geographical needs. With just a few lines of code, the ArcGIS can help you to group your locations in layers, create a legend for your layers or enable the users to toggle visibility in layers. In Google Maps, on the other hand, you need to build such options by yourself. Next to that, the ArcGIS comes with its own geospatial database, which removes the need to store the locations yourself. One downside though, is that there is no full React-based ArcGIS API available just yet, whereas Google Maps, has multiple.
Upgrading ArcGIS widget
For some time already Mendix is in the process of moving its complete front end from Dojo to React. Around five years ago, I built an ArcGIS widget using Dojo which has been successfully used by many clients with close to 1000 downloads.
1. No full React-based version
The first challenge was the fact that there is no full React-based version of the ArcGIS API. For Google Maps, there are multiple. I guess the main reason is that the ArcGIS API is very extensive, hence creating and maintaining a React-based version of it is a huge effort. In the end, I wrote the full widget with an onload event using the useEffect hook and some React Refs to make sure I could always access the right version of the data throughout each rerender React deems necessary.
2. The ArcGIS API is huge!