This lesson marks a shift in the course where we will move away from talking about ArcGIS Server running on Amazon EC2 infrastructure and begin discussing various online software as a service (SaaS) options that enable GIS in the cloud. We'll begin by exploring services offered by the company Mapbox. You'll have a chance to restyle some online basemaps and see how these new styles can take effect immediately using vector tiles. You'll also learn how to create and load data into Mapbox for thematic mapping.
Before you begin this lesson, please make sure that all your Cloud Builder sites and all your Amazon EC2 instances are stopped. You wouldn't want to leave them running and accruing charges during the next few weeks while we are working with other technology.
At the successful completion of this lesson you should be able to:
In Lesson 1, you learned about the software as a service (SaaS) model of cloud computing. With SaaS, the end user doesn’t have to install, configure, or code anything: the software is accessed directly from the cloud, usually through a web browser. The cloud hardware itself is maintained or leased by the service provider, with all the details of the back end architecture hidden from the end user. In Lesson 1, you used Google Fusion Tables as an example of SaaS. Others include all Google Docs, Gmail, and the ArcGIS.com map viewer that you used in the previous lessons.
Although you may be accustomed to using free SaaS such as online email, there is also much SaaS that is sold through upfront or metered fees. In fact, the free SaaS that you encounter is usually a gateway to more services that are available on a subscription basis. For example, you’ve already seen a little bit about how the ArcGIS.com map viewer is free to use, but you’ve also seen that Esri has a for-purchase credit system used for other services (which you’ll learn about in a later lesson). In a similar fashion, Mapbox offers a free tier of services but requires a subscription for certain volumes or usages.
SaaS is gaining popularity in the GIS industry because it saves people the hassle of installing and administering complex software. This is a boon for industries that want to use maps and spatial processing, but may not have the hardware or personnel to fully deploy a GIS onsite. It also allows them to give GIS a trial or pilot run for a relatively low cost and setup effort.
Because SaaS runs in a web page and needs to be accessible on many devices, its design is also usually streamlined compared to more complex desktop GIS software interfaces. SaaS generally lowers the bar for getting started with GIS. It is an excellent way for beginners to learn GIS, mapping, and design techniques, although it should be kept in mind that the features offered by SaaS may be limited compared to locally installed software.
SaaS is also an attractive way to do GIS because certain elements of functionality can be purchased on an as-needed basis. For example, companies who need to host just one or two spatial datasets as web services can do so without having to spend lots of money upfront on their own GIS server. Organizations that use GIS SaaS should assess the cost of services on a periodic basis. If a company needs to host many datasets and perform constant data processing or geocomputation operations, the cost of SaaS may actually exceed the cost for an in-house GIS server. In other words, although SaaS is convenient, it may not always be the most economical option.
This lesson begins a series on SaaS GIS offerings. We’ll first learn about Mapbox and its services for web map design and delivery. Then we’ll look at services from Carto, which are focused primarily on thematic mapping and analysis. Finally, we’ll spend two lessons looking at ArcGIS Online, covering its web map assembly tools in more depth and exploring its geoprocessing services.
Headquartered in Washington, DC, Mapbox is a company that provides location and mapping services such as online basemap hosting, geocoding, routing, image processing, and web mapping APIs. Mapbox is a young company, but it has made waves in the geospatial software industry by offering a unique blend of cloud technologies, map delivery and styling innovations, and open source utilities.
Mapbox markets itself as “a mapping platform for developers [1]”. It does not offer desktop-based GIS software; rather, its services seem to be aimed at journalists, full time web and mobile app developers, and organizations looking for an alternative to other cloud-based GIS products. Some of these might not have the equipment, funding, personnel, or business need to implement a full onsite GIS.
The vector data in Mapbox maps comes largely from OpenStreetMap [2], a free geographic database open to editing by anyone on the Internet. Mapbox did not invent OpenStreetMap, but it is one of the first companies to aggressively build a business model around the project. Using OpenStreetMap lowers the price point for Mapbox maps and increases the flexibility of the map (because you theoretically have some control over OpenStreetMap quality and content in your area of interest.) Because unintentional errors and vandalism do occur in OpenStreetMap, Mapbox uses employees and software tools to monitor incoming OpenStreetMap edits and improve the map. This investment offers benefits to both Mapbox and OpenStreetMap, although its effect on the community dynamics of the OpenStreetMap project is still beginning to be understood.
Mapbox mapping services rely heavily on a vector tile approach wherein packets of vector coordinates are sent to client devices to be drawn. The tiles use a pyramid motif similar to what you saw with the rasterized tiles you created with ArcGIS Server, but they contain vector coordinate information rather than images. An advantage of this approach is that vector tiles can be restyled quickly without having to re-make all the tiles, since the data is decoupled from the drawing rules. Vectors also facilitate visual effects for map rotation and zooming.
One disadvantage of vector tiles is that more computing logic is needed to display vector tiles than rasterized ones (since displaying an image is one of the most basic tasks a computer can do). Also, the symbol set and visual effects available with vector tiles may be more limited compared to what can be drawn with rasterized tiles. Finally, although it seems obvious, vector tiles can only display vectors; satellite imagery, shaded relief, and some field-based phenomena must still be drawn with rasterized tiles.
Mapbox has offered several cartographic products for designing map styles and making tiles. Their legacy TileMill tool created rasterized tiles with the aim of hosting them on Mapbox servers, although utilities existed for unpacking the tiles and hosting them on your own website (see in Geog 585: Open Web Mapping [3]). Their current tools are aimed toward creating vector tiles to be hosted on Mapbox servers.
Unlike ArcGIS Online, Mapbox does not offer web services for performing vector spatial operations such as buffering, intersections, etc.; instead, Mapbox created a free and open source JavaScript library called turf.js [4] that developers can use to perform these operations on the client side. As with many of Mapbox’s services, using turf.js requires some programming ability; but it comes with the benefit of not having to pay for a cloud service to perform these operations. Some kinds of batch operations, complex calculations, multi-step models, or large datasets may still be better suited for sending to a server.
Mapbox offers a light amount of usage for free, allowing us to experiment with their services. On the Mapbox [5] website, click Pricing and look over the plans. Then go ahead and sign up for a user name and move on to the next section of the lesson.
As you saw with ArcGIS Server, online base maps can have dozens of layers, with all kinds of rules about what zoom levels they are hidden and displayed; therefore, we’re not going to start from scratch. Instead, we’ll start with existing Mapbox basemaps (which are pretty well designed to begin with) and make small modifications to fit our taste.
First, please download the data for Lesson 5 exercises [6]. After you download the data, unzip it.
We’ll start out simple by infusing some of our own data into one of the Mapbox basemaps. We’ll then view our creation in ArcMap, where you already know how to add more layers on top.
Suppose you’re examining nighttime safety in the Washington DC area. You want to understand where activities are occurring at night relative to existing street lighting. The “Dark” basemap offered by Mapbox looks appealing for your purposes, but you want to integrate a layer showing areas that are illuminated. You plan on eventually doing some visualization of street vendor activity, pedestrian patterns, crimes, and other happenings in relation to the street lighting.
For the best user experience, you should complete the following steps on a desktop computer (not a tablet or phone):
To recap, you took an existing Mapbox-designed basemap and fused in some of your own data. You then brought this into ArcGIS Pro so you could work with it as a basemap. The next walkthrough will go beyond this, showing you how to modify the Mapbox design, create your own thematic data, and view your creations on the web.
Now that you’ve gotten a feel for the Mapbox environment, let’s try something a little more complex that involves modifying the Mapbox style, creating thematic data from scratch, and viewing the result in a web browser environment rather than ArcMap.
Suppose you’re in charge of making a website to show the five best restaurants in your town (with you and only you as the judge). You want to make a map quickly that you can embed in a website, but since you’re somewhat of a picky cartographer, you want to have full control over the map style. Let’s do this with Mapbox, first designing a basemap, then adding data to represent the five restaurants of interest.
You’re done editing your basemap for now. You don’t have to save your work; Mapbox Studio has been doing this as you go along. Now let’s get the restaurants entered.
Next, you’ll apply your own style to the icons and add some labels. You’ll then preview your map in a web browser.
There are several ways you could symbolize these restaurant points. One way might be with a little icon in the form of a scalable vector graphics (SVG) file. Mapbox provides a nice set of these SVG icons called Maki.
Another way is to just use a basic marker like a circle. We’ll take this approach, but we’ll also add a label from some of the information we entered in the restaurant fields. The restaurant points and the labels will be treated as separate layers in the map. Follow these steps:
Mapbox is really geared toward developers, people who write code to embed maps in websites and apps. Websites are typically written in JavaScript, with the maps being embedded through special programming libraries (APIs) that offer functions for working with tiles, markers, etc. One of the more popular of these APIs is Leaflet. Follow the instructions below to make a real simple web page that embeds your Mapbox map via Leaflet.
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Leaflet + Mapbox test</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.0.3/leaflet.css" type="text/css" crossorigin=""> <script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.0.3/leaflet.js" crossorigin=""></script> <style> #mapid { width: 512px; height: 512px; border: 1px solid #ccc; } .leaflet-container { background: #fff; } </style> <script type="text/javascript"> function init() { // create map and set center and zoom level var map = new L.map('mapid'); map.setView([47.000,-120.554],13); var mapboxTileUrl = 'PASTE YOUR URL INSIDE THESE SINGLE QUOTES'; L.tileLayer(mapboxTileUrl, { attribution: 'Background map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors' }).addTo(map); } </script> </head> <body onload="init()"> <h1 id="title">Favorite restaurants</h1> <div id="mapid"></div> </body> </html>
This is a pretty basic example, but hopefully it helps you see how a map like this could be embedded anywhere in a web page by an able JavaScript developer. This could be a useful supplement to a blog, news article, corporate web page, etc.
For your assignment this week, you’ll practice the things you did in the above walkthroughs, this time using your own data.
Security is one of the biggest concerns for organizations considering using cloud computing. I have mixed feelings about this. On the one hand, giving up physical control is a big step. On the other hand, data is not 100% secure on-site either, and leading cloud providers have security teams that are second to none.
First, read the AWS Security Center website [9] and some of its subsidiary pages, especially this overview of Security Processes [10]. In the optional textbook, you can read The Cloud at Your Service chapter 4, Security and the Private Cloud.
Links
[1] https://www.mapbox.com/about/
[2] http://www.openstreetmap.org
[3] https://www.e-education.psu.edu/geog585/node/705
[4] http://turfjs.org/
[5] http://www.mapbox.com
[6] https://www.e-education.psu.edu/geog865/sites/www.e-education.psu.edu.geog865/files/data/mapbox_lesson_data.zip
[7] https://www.mapbox.com/
[8] http://opendata.dc.gov
[9] http://aws.amazon.com/security/
[10] https://docs.aws.amazon.com/whitepapers/latest/introduction-aws-security/introduction-aws-security.pdf