Building and using web maps is different from working with a desktop GIS for a variety of reasons:
- In a web map, any information you see has to be sent “across the wire” from the server to your browser, introducing latency.
- In a web map, you may be pulling in information from several different servers. Your map performance is therefore limited by the availability and speed of all the servers you're using.
- In a web map, performance may be affected by other people using the server at the same time.
- In a web map, you are limited to the display technologies supported by the client application, which may be a basic web browser.
These considerations can sometimes take people by surprise. For example, if you've only used ArcMap or QGIS in the past, you may not be accustomed to thinking about broadband speeds or sharing the machine with other people.
By far, the biggest challenge for new web mappers is understanding the amount of data that is displayed in their maps and how to get all that information drawn on the screen of a web user in sub-second speeds. Many people who have worked with desktop GIS packages are accustomed to adding dozens (or even hundreds) of layers to the map and switching them on and off as needed. Your powerful desktop machine may be able to handle the drawing of this kind of map; however, performance will be unacceptably slow if you try to move the map directly to the web. The server requires precious time to iterate through all those layers, retrieve the data, draw it, and send the image back to the client.
To address this problem, most web maps break apart the layers into groups that are handled very differently. Layers whose sole purpose are to provide geographic context are grouped together and brought into the map as a single tiled basemap. In contrast, thematic layers (the layers that are the focus of the map) are brought in as one or more separate web services and placed on top of the basemap. You might additionally decide to include a set of interactive elements such as popups, charts, analysis tools, and so forth.
Let's take a closer look at these three things--basemaps, thematic layers, and interactive elements--to understand how each is created and displayed.
A basemap provides geographic context for your map. In other words, it is usually not the main reason people look at your map, but your map would be difficult to interpret without it. The most common basemaps you've used online are vector road maps and remotely sensed imagery.
Although a basemap may consist of many sublayers (such as roads, lakes, buildings, and so forth), these are often fused together into a rasterized set of tiled images and treated as a single layer in your web map. These tiled maps consist of often thousands or millions of predrawn images that are saved on the server and passed out to web browsers as people pan around the map. Lesson 5 will explain tiled maps in greater depth and give you a chance to make your own.
In the past couple of years, it has become fashionable in some applications for the server to send the basemap as chunks of vector coordinates, sometimes known as "vector tiles." Displaying the basemap as vectors instead of a rasterized map allows for more flexibility in visualization, such as being able to rotate the map while the labels stay right-side-up. You can see a vector basemap in action if you look at the Google Maps app on a smartphone.
Sometimes two tiled layers will work together to form a basemap. For example, you may have a tiled layer with aerial imagery and a second tiled layer with a vector road overlay that has been designed to go on top of the imagery. (In Google Maps, this appears when you check the Labels item). Keeping these two tilesets separate takes less disk space and makes it easier to update the imagery.
Thematic layers (also known as business or operational layers) go on top of the basemap. They're the reason people are coming to visit your map. If placed on the basemap, they might not be of interest to everybody, but when placed on your focused web map, they are the main layer of interest. If your map is titled “Farmers markets in Philadelphia,” then farmers markets are your thematic layer. If your map is titled “Migration patterns of North American birds,” then the migration patterns are your thematic layer.
Like basemaps, thematic layers are sometimes displayed with tiles; however, this may not always be possible due to the rapidly changing nature of some data. For example, if you need to display the real time positions of police vans, you cannot rely on predrawn tiles and must use some other way to draw the data. There are various web services such as WMS (which you will learn about in Lesson 4) that are designed to draw maps on the fly in this way. You can use these for your thematic layers. Another option is to query the server for all the data and use the browser to draw it. This approach lends itself well to interactive elements such as popups and is described in Lesson 6.
Thematic layers work together with basemap layers to form an effective web map. Interestingly, the thematic layer is not always the top one. In a 2009 blog post (no longer online), Esri cartographer Charlie Frye described a “map sandwich” approach, wherein a thematic layer (which could be tiled or not) is placed in between two tiled basemap layers that give geographic context. The bottom layer has physiographic features and the top layer has labels and boundaries. This is the “bread.” The thematic layer in the middle is the “meat.” The Esri "Light Gray Canvas" basemap in ArcMap and ArcGIS Online uses this technique. FOSS technology definitely allows this approach as well.
Your map may include several thematic layers that you allow users to toggle on and off. To accomplish this, you can use a single web service with multiple sublayers, or multiple web services that each contain a single layer. However, to keep your app usable and relatively fast-performing, you should avoid including many thematic layers in your web map.
- Open your browser's web developer tools you used during the previous lesson and open the Network tab; then visit Bing maps on your computer's web browser.
- Pan around and switch between the basemaps (drop-down menu at the top right), and note the different web request URLs displayed in the table. These will appear quickly as you interact with the website.
- Click a row representing a request, and then click the Response tab to see what came back from the request. If you see an image, it means the request sent back a tiled map image as a response. Other times you may see JSON and/or other text.
- Now turn on the thematic layer for Traffic.
How is Bing displaying these layers? Why are they taking this approach? At the end of this class, you will have a good understanding of the different options that exist and their advantages and disadvantages. Feel free to go ahead and compare Bing's approach to that at the site HERE WeGo (layers can be accessed at the bottom right). Do you notice any differences in their approach?
Web maps are often equipped with interactive elements that can help you learn more about the layers in the map. These can be informational popups that appear when you click a feature, charts and graphs that are drawn in a separate part of the page, slider bars that adjust the time slice of data displayed in the map, and so forth. Some web maps allow you to edit GIS data in real time, or submit a geoprocessing job to the server and see the response drawn on the screen. Others allow you to type a series of stops and view driving directions between each.
These elements make the map come alive. The key to making an effective web map is to include the interactive elements that are most useful to your audience, without overwhelming them with options or making the tasks too complicated. Even a little bit of housekeeping, such as including user-friendly field aliases in your popups, can go a long way toward making your map approachable and useful.
Later in this lesson, you'll examine some web maps and discuss the interactive elements they provide. You'll also revisit this subject in Lesson 6 as you begin using the web mapping APIs to put all your layers together into a web map.
Getting some practice with identifying web map elements
Let's get some practice identifying these elements. I will walk you through two simple web maps and point out the basemap, the thematic layers, and the interactive elements. Then, in this week's assignment, you'll get the chance to try it yourself using two web maps of your choosing.
GDACS Disaster Alerts
The first map we'll look at is www.gdacs.org/, published by the Global Disaster Alert and Coordination System (GDACS), a cooperation framework between the United Nations, the European Commission, and others to share disaster information and alerts. The web map on the main page showing alerts for the last four days is relatively simple in terms of interactive elements, focusing on displaying disaster related information and providing links to more detailed reports. This map has been created with OpenLayers. It is similar in scope to what you will be creating in this course. Take a minute to open this map and examine it.
- The map offers three different terrain-based basemap options serving as unintrusive backdrops for displaying the thematic layers. However, when you zoom in, you will see that at a certain zoom level the basemap changes to a typical road map version, similar to what you are familiar with from Google Maps, Bing, or OpenStreetMap. By inspecting the network traffic in the browser's network log while panning around and zooming, we can see that all these basemaps options are loaded as image tiles using URLs like this one:
https://europa.eu/webtools/maps/tiles/osm-ec/11/1139/1066.pngThe "osm" in the name here provides some clue that the tiles for the road map basemap have been created from OpenStreetMap data.
- The map has a larger number of thematic layers, most of them for displaying disasters of different types (fire, drought, flood, etc.) as icons/symbols on the map. When you zoom in, you will see that in addition to the icons there are actually vector features like polygons representing the events (including detailed past and predicted trajectories for cyclones). In addition, there are raster layers for rain and clouds. These two thematic layers are relatively easy to find in the browser's network log because they are also brought in as image tiles, in this case from a local ArcGIS Server installation using URLs like this one:
https://www.gdacs.org/arcgis/rest/services/GDACS/daily_rain/MapServer/export?F=image&FORMAT=PNG32&TRANSPARENT=true&SIZE=256%2C256&BBOX=-180%2C-90%2C-90%2C0&BBOXSR=4326&IMAGESR=4326&DPI=90In contrast, to the previous URL for the basemap tiles, which used nested folders for zoom level, x and y coordinates of the tiles, we here find bounding box coordinates and other information encoded as arguments following the '?' which are then decoded by the server and used to produce the requested tile image. How about the other thematic layers? It turns out these do not come as images but fortunately they can still be identified relatively easily in the network log because the URLs for the requests contain abbreviations for the event types, like this:
https://www.gdacs.org/gdacsapi/api/events/geteventlist/MAP?eventtypes=EQThese requests are sent out immediately when the map is loaded and the response from the GDACS server always is a GeoJSON file with a text specification of the vector features and their geometries. These vector features are then drawn by the web browser. You will learn more about client-side rendering of data from GeoJSON files in Lesson 7.
- The interactive elements of the map are a couple of buttons for zooming (top left), for accessing the layer switch control and legend for the Rain layer (top right), and for displaying some general information and attribution (bottom right) confirming that OpenStreetMap data has been used to create the map. Clicking on a symbol from one of the thematic layers will open a popup with information on the event and a link to the full report. When you add interactive elements to your web maps, you will often add code that "listens" for particular events, such as clicking, tapping, or hovering over a feature.
NYC Crime Map
- The basemap is tiled and the tiles are loaded from a CartoDB cloud server using URLs of the following form:
https://cartodb-basemaps-c.global.ssl.fastly.net/light_nolabels/10/302/384.pngThe tiles use a light non-intrusive design without labels. The labels you see are brought in as a separate tile set that only contains the labels.
- There are three types of thematic layers that you can switch between under "Map Type" at the top right. The polygon based , choropleth-style "Precinct map" layer and the point based "Crime Location Map" layer are brought in as tiles as well, using URLs such as
https://cartocdn-gusc.global.ssl.fastly.net/nycmap/api/v1/map/602523e471f3cd0e4b575fce24d1467a:0/0/11/601/771.pngIn contrast, the "Heat Map" layer results in requests that are responded to with a .json.torque file, so text files rather than bitmap graphics. Torque tiles are a special format that Carto uses for multidimensional spatial data. Finally, we can observe request of the form
https://cartocdn-gusc.global.ssl.fastly.net/nycmap/...15/3079.grid.json?callback=gridthat are responded to with another type of JSON text file that contains the information that is displays when you click on one of the thematic features. Since this information cannot be stored in the thematic map tile images, it is clear that this information needs to be brought in separately.
- In addition to the standard map controls and the controls for choosing the "map type", the interactive elements of the web map allow for filtering the data presented in the thematic layers based on crime type and a date range. In addition, there are elements that allow for summarizing and comparing statistics, downloading the data and searching for a particular location in NYC. Clicking on the map will display a popup with crime statistics depending on the map type and the thematic feature(s) located at this position. Double-clicking can be used to zoom in on a particular location.
Here are a few other maps you can look at if you want to keep practicing. Although some of these maps have very nice elements, I am recommending them for their variety, not for their excellence in any particular realm.
- TriMet Trip Ride Planner
- Downtown Alliance Interactive Map New York (click on Open Map View at the bottom right)
- NIU Campus Webmap
From this brief exercise, you can begin to see the various approaches that can be used to put together a web map. Hopefully, you can look at a web map and immediately begin to see how the layers were broken up into basemap layers and thematic layers. Whenever you see a web map, you should also think about the interactive elements that are present and decide whether they are usable and applicable.