Maps in Apps (with mapbox)
I have a client in the energy industry. And I have learned that in the energy industry maps are king. Energy industry types seem to need to see everything in a map. I have used maps in web applications before. Thanks to my work with this client I now have become somewhat of a ninja in web app / map integration. I want to share some of my experiences for the benefit of others.
When developers are told to integrate maps into a web application, they often first think about Google Maps. When developers are told to integrate really intense GIS (Geographic Information System) features into a system, they often find Esri’s products. And there is nothing terribly wrong with those approaches. But for my client those solutions just did not fit well. And this led me to discover mapbox. And my experience with their products have been nothing less than astounding.
First, I would like to talk about some of the reasons I looked beyond the “go to” solutions. Google maps are fine for plotting some points on a map. And you can draw some polygons on your map. But my client needed to draw a lot of complex polygons. Doing so through the Google API was incredibly slow. And my client anticipates the possibility of having many users with lots of hits. With Google’s pricing scheme all is free until it’s not (when you become “Commercial Use”), at which time you need to speak with an authorized Google third party that will charge you $10,000 per year and want to have conference calls to discuss your needs. And they will try to write your application for you (the big up-sell).
And then there is Esri. Esri is THE dominant player in the GIS market. They seem to have a tool for everything and a plethora of confusing licensing possibilities for each offering. In fact, some of their tools seem to overlap and it’s hard to tell which to use. Read the docs they tell you, but every time I do I’m more confused. Dealing with Esri feels like dealing with a software company of the 90’s. The people are all very nice and the products are powerful. But not much can be done (or even understood) by a developer without engaging significant sales and support types. They eventually pointed me to engage their professional services division. But this seems like a pretty steep cost for simply understanding their product offerings.
But our problems with Esri weren’t just their confusing and expensive tools and licensing. There were two other significant problems. On the web side, they are heavily dependent on Dojo. Dojo is a super awesome JavaScript “toolkit”. Well, it was super awesome at one time (2005). But it seems like the entire world (except for Esri and a few IT shops) has moved on to better things long ago. But Esri is stubbornly tied to Dojo. And I found that Dojo does not play well with Angular 2+. The second big problem for us is that Esri licensing is designed to service enterprises and named enterprise users. And I don’t blame them, the enterprise market is their bread and butter business. But my client is a smallish consulting business developing more of a SAAS type offering. Doing this with Esri’s licensing policies seemed difficult and expensive if not impossible.
And so I discovered mapbox. Mapbox wants to be the “go to” choice for integration of maps into apps. So we were their core audience. Their JavaScript API is a pleasure to deal with. Their entire business is developer focused. They have good docs with plenty of clear examples. They use modern JavaScript without tons of dependencies. You can have a simple map in your website literally in a matter of minutes by following their examples.
What really blew us away was how we could easily integrate our many complex polygons into their tilesets. We have the entire process scheduled on Azure and refreshing our tilesets via AWS regularly. A map with over 40,000 complex polygons is delivered to the user in seconds. A user can click on the polygon and, via their JavaScript API, we can easily gather enough information to call our own backend to retrieve our more “secure” information. It took a while to get the hang of their web studio for designing maps (I am not a GIS pro, so the map domain language was a bit of a struggle for me). But I’m now pretty darn good at it. Licensing starts out as “pay as you go”. And we still have not yet exceeded the free plan.
What about more advanced GIS features? They seem to have plenty. Here at the things that I have directly used:
- Heat Maps.
- Depicting polygons and points.
- Changing circle circumference based on data values (i.e. “bubble maps”).
- Fly to a point.
- Setting max bounds of the user.
- Add / remove mapbox controls from map.
- Filter layers based on selections.
- Change polygon colors based on data values.
- Change layer visibility based on zoom level.
- Dynamically add feature layers (consisting of polygons and/or points) based on data returned from our own API (aka “query layers”).
- Allow the user to change “base map” style.
- Integrate your own custom (svg) markers.
And there is much more available that I have not has a purpose for…yet.
Yes, there is always some downside. They don’t seem to have any user’s forum. But I have found that the community surrounding mapbox, which grew out of OpenStreetMap, is very friendly and helpful. I have found answers to some tough questions by posting them on the GIS Stack Exchange site.
And one other downside. They have a strict limit of fifteen data sources per map (a.k.a. style). My client has a lot of data. I have done some data / geojson jujitsu to combine certain sets of data / features into single data sources, but this seems like (is) a kluge. But maybe we need to think about more than one map style anyway. Our “monolithic” map seems to be becoming overcrowded with options.
I have been working with this client for a year now. When we started we decades of valuable data but nothing on the public web. Thanks in large part to mapbox, we now have more available on the web map than even seemed possible a year ago.
Great article, very informative
Good information.