Gretchen Peterson, Author at Boundless
by Gretchen Peterson
As mentioned in my previous post about visualization , QGIS is easy-to-install , integrates with OpenGeo Suite , and has reliable support offerings , making it a viable alternative to proprietary desktop GIS software such as Esri ArcGIS for Desktop. I’ve written a couple of books on designing cartographic products so it is something I’m passionate about and it is definitely an important component of desktop GIS. So how does QGIS perform when it comes to cartographic design?
In making the examples for this blog post series, I was impressed by the capabilities of QGIS and found it was easy and straightforward to create maps like the Halloween map below.
Strength: Text and Image Elements
Placing text and images is as easy as finding the Add new label and Add image buttons on the left-hand side of the print composer (a). Once you add a text box or any other element, the Item properties tab on the right-hand side of the print composer gives you most of the complex options that you’d find in any layout or commercial GIS software such as alignment, display, and rotation (b). You can also align these elements by using the Align selected items button in the main button bar (c).
Strength: Advanced Techniques
Advanced labeling functionality is included in the main QGIS interface, including SQL-based labeling, font choice, and placement protocols. Exporting a layout to SVG for editing in Inkscape or other design software is easy. Another advanced technique is the creation of atlases, or map books, that replicate a layout for each part of an indexed main map. QGIS provides an atlas composer as part of the core functionality within the Print Composer, a very powerful feature.
Strength: Color Blending
An exciting feature is the addition of color blending modes, typically found only in design software, that can add special effects to the look and feel of the map by adding texture or special brightening effects, for example. The following modes are available: lighten, screen, dodge, addition, darken, multiply, burn, overlay, soft light, hard light, difference, and subtract. Color blending can be applied to a single layer in the layer properties dialog (a) or it can be applied to an entire map in the Print Composer (b).
Mixed Results: Map Elements
Adding the map to the layout is a little more difficult if you are used to commercial GIS software. You have to use the Add new map button (the wording of which I found to be confusing since it somehow implies a new map rather than the existing map in your project), which adds the map from the main QGIS project to the layout. Another potential area of confusion is the fact that once the map element is added to the project, it doesn’t dynamically update if the main map is changed. In fact, to update it there are actually two buttons in the map element’s Item properties: one to update the preview and the other to set the map extent. The former updates the map if a new map layer has been added or the symbology has changed but only the latter updates the map if it has been panned or zoomed. These, however, are minor quibbles.
Mixed Results: Sizing and Graticules
The Print Composer does have a few shortcomings that I suspect will be cleaned up in later releases. It isn’t possible to change the size of multiple images all at once. For example, enlarging the pumpkin images in the right-hand information panel of the example map has to be done for each pumpkin separately since selecting them all and changing the properties isn’t possible. Also, there is no graticule functionality in the Print Composer. Instead, the user would need to find or create a graticule line dataset to add as a layer in the map if a graphic-like grid was desired. Another minor quibble is that the size dialog for images has the wrong tab order (if you try to tab between the input boxes the tabbing skips boxes instead of sequentially moving the cursor to the next input box).
Hidden Gem: Gradient Fills
Gradient fills, also known as vignette effects, are also possible, in a new plugin called Shapeburst . You can use it to achieve subtle shading along land-water boundaries but also to do some unexpected things like banding the edges of administrative boundaries in different colors or to reverse-fade the edges of a map. This latter effect takes advantage of QGIS’s built-in inverted polygons tool, which simplifies what used to be a task that would take several steps to achieve.
The cartographic capabilities of QGIS are sufficient to produce almost all the common map layout components with an adequate amount of advanced capabilities and even some options, like the color blending modes, that aren’t typically found elsewhere. Cartography is where many people think that QGIS falls short. However, in making the examples for this blog post series, including the Halloween map, I was blown away by its capabilities. See also the QGIS Map Gallery for more map examples. Overall, my experience with QGIS has been that the visualization and cartography functions of QGIS have matured to the point where GIS professionals of all types can’t afford not to strongly consider adopting it.
by Gretchen Peterson
Any GIS professional who’s been paying attention to the professional chatter in recent years will be wondering about QGIS and whether or not it might meet some or all of their needs. QGIS is open source, similar to proprietary GIS software, runs on a variety of operating systems, and has been steadily improving since its debut in 2002. With easy-to-install packages , OpenGeo Suite integration , and reliable support offerings , we obviously see QGIS as a viable alternative to proprietary desktop GIS software such as Esri’s ArcGIS for Desktop .
But will it work for you? The short answer is: most likely yes for visualization of most formats of spatial data, probably for analysis of raster and vector data, probably for geographic data editing, and probably for cartographic publishing. Those are all very subjective assertions based on my personal experience using QGIS for the past seven months but I have been using proprietary GIS for over fourteen years as an analyst and cartographer and have written a couple of books on the subject.
By all means give QGIS a try: download and install it, drag-and-drop some data into it, and give it a spin. This is definitely a good time to evaluate it and consider adopting it across your organization.
Visualizing spatial data in QGIS
In this first post, I’m going to focus on visualizing spatial data in QGIS. These basic functions are straightforward and easy to do in QGIS:
creating graduated color schemes
Strength: Versatile and efficient format support
In fact, QGIS is an effective means of viewing and exploring spatial data of almost any type. If you have complex data, you might be interested to hear that the newest release of QGIS boasts very fast, multi-threaded, rendering of spatial data that may even make it faster than leading competitors. When I began creating the map shown above, I accidentally added all of the Natural Earth 1:10m Cultural Vectors in triplicate to the project, causing some minor heart-palpitations as I realized it was going to try to render close to 100 vector layers all at once. However, my fears were unfounded as it took only a few seconds for them to render once they were all added. In the realm of visualization, it does most of the other tasks that a GIS professional would expect as well, including support for custom symbol sets (in SVG format). Adding GeoJSON data is simple, just drag a geojson file onto the Layers list. Here, we show a portion of James Fee’s GeoJSON repository of baseball stadiums :
Mixed results: Raster visualization
That said, raster visualization can yield unexpected results depending on what is desired. Some raster datasets have tables that associate bands with RGB values such that specific cell-types are rendered certain colors. Often, landcover datasets will have this kind of structure so that, for example, the raster is rendered with blue for water, green for grass, white for ice, and so on. Unfortunately, QGIS doesn’t yet support rendering based on associated table files for rasters. Another slight irritation is the continuing use of binary ARC/INFO GRID formats by some agencies who distribute raster data to the public. If you have one of these datasets, QGIS can open it but you must point to the w001001.adf file using the raster data import button.
Mixed results: On-the-fly reprojection
One of the most important ways to make GIS user-friendly is to support on-the-fly projection. I still remember when projecting on-the-fly became a part of the software that I used to use. It was the end of 1999, and life was so much easier when multiple datasets from multiple agencies in multiple projections could all be jammed together into a single project, producing a map where all the data layers were in the correct projected space. This was because reprojecting not only added extra steps requiring you to reproject everything into a common coordinate system even if all you wanted to do was visualize the data, it also meant maintaining multiple copies of the same dataset, which contributed to folder clutter and using up of valuable disk space. QGIS supports reprojection on-the-fly but it is an option that must be set in the project properties dialog. Some glitches with projections still seem to occur from time to time. Zooming in, for example, sometimes causes the map to zoom to a different place than expected. However, this unexpected behavior is inconsistent, not a showstopper, and may be fixed soon.
Hidden gem: Context
The other important aspect of visualizing data is having enough underlying context for the data. Country boundaries, city labels, roads, oceans, and other standard map data are crucial. Proprietary GIS software generally contains basemap layers that can easily be turned on and off to support visualization in this manner. QGIS also has this capability, in the form of the OpenLayers plugin, which serves up Google, OpenStreetMap, Bing, and Yahoo basemaps at the click of a button. The OpenLayers plugin is free and installs just like any other QGIS plugin—you search for it in the Plugins menu, press “install,” and make your basemap choice in the Web menu.
While QGIS may need a small amount of improvement when it comes to raster visualization and on-the-fly projection, these aren’t hindrances to a typical visualization workflow and are only mentioned here out of respect for a fair and balanced assessment. By and large, my testing has convinced me that the robust visualization capabilities that QGIS offers provide more than enough impetus for many organizations to make the switch to QGIS. In later posts, I’ll discuss how QGIS performs with respect to analysis, editing, and cartography.
by Gretchen Peterson
The State of the Map US 2014 conference, a two-day conference covering all things OpenStreetMap, was held this past weekend in Washington DC. It was nice to attend as part of the Boundless contingent and meet — in person — tons of people whom I had only heretofore known via the internets.
Aside from the inspiration provided by the gorgeous weather and the cherry blossoms , there was also inspiration in abundance at the conference for cartographers. Every cartographer should become familiar with OpenStreetMap data if they aren’t already. It’s a bit of a bear to work with because it is in a different structure than we are normally used to (nodes and ways mean anything to you?) but you’ll see the benefits if you download a state-wide or city-wide extract from one of several sites (such as geofabrik or Metro Extracts ) and start using it in your map-making medium of choice. The dataset provides a comprehensive collection of roads, buildings and building types, points of interest, and so on. And it’s free!
There were many talks I didn’t get to see because there were two concurrent tracks, but the ones that I attended focused heavily on tools that for using OpenStreetMap data, including GeoGit , TileMill , Esri , QGIS , and PostGIS . However, there were still some cartographic takeaways.
Kate Watkins, Seth Fitzsimmons and Alan McConchie told us that a great way to build a stylistically cohesive basemap is to focus on three main hues, along with variations on those hues.
In that same talk we saw some great examples of labels that break all the rules: the leading and kerning (that’s line spacing and character spacing, basically) are decreased to negative values and the halos are very large and black. Of course this is the opposite of what most texts will recommend but it just proves that breaking the rules once in a while can make for some neat cartographic effects.
Eric Theise showed us that applying some of the devices of experimental film to maps, such as perception distortion, can be a creative way to get people thinking. Eric and I were discussing this later on in the day when he mentioned that he thought it would be interesting to have a map that taunted you if you tried to click on a feature to find out more about it. Something like, “You’d like to know what this building is, wouldn’t you?!”
Kevin Bullock told a great story about a map of India that was produced in the 1800s with crude tools, took 70 years to complete, and astonishingly accurate despite these and other limitations. And you thought your map products took a long time to produce!
Our own Jeff Johnson rounded out the weekend with a more technical talk that examined the ways in which GeoGit could lead to a more distributed and decentralized architecture for OSM.
There was a lot more material covered, of course, and these points focused just on the cartography aspect of OpenStreetMap use. All the talks are now posted on the schedule part of the conference website so definitely take the time to watch them!
If you’re still curious about State of the Map, I recommend this great recap from Peter Batty which provides more details about the event and reviews other issues in the OpenStreetMap community including vector tiles, licensing, passive crowdsourcing, geocoding and more.
by Gretchen Peterson
The San Francisco Bay Area Bike Share Open Data Challenge is now underway, with entries due April 25, 2014. The idea is to use their open data on bike stations, bicycle traffic patterns, and weather to create an interesting visualization, map, or other product that adds value to the program.
Using open source mapping tools is a great way to explore the data and create winning entries for the contest. For those who are new to making maps out of open data, we’re here to help you get started. In this tutorial we’ll show you how to use QGIS , a popular mapping software product, to create a simple map out of the data. Build on this foundation to create your own contest entries and learn about data and geospatial technology along the way.
To get started, download all four data files from the contest website here . After you unzip the data you’ll see that it’s in CSV format. This is a comma delimited text file format that’s useful for spreadsheets and geospatial tables.
First, download and install QGIS . Then install the OpenLayers plugin, which simplifies adding some of the most common base layers, such as Google Maps or OSM, and makes it easier to visualize the bike station locations. You can install it by opening the Plugin Manager, selecting the Get more section and then searching for OpenLayers.
Now in the Plugins menu you should have a new entry where you can select the layers to add.
Adding bike share data
Add whichever basemap you like. In the following screenshots, you will see that we’ve added the Bing Road layer, which is less saturated than some of the others. A less saturated basemap helps to highlight the data that will be overlaid. You can zoom into San Francisco now or wait until the bike share data is added. To create the bike share data overlay, use the Add Delimited Text Layer button.
Add the station data file using the browse button. Use the x and y drop down selectors under Geometry definition to tell QGIS which fields have the latitude coordinates and which have the longitude coordinates. Latitude is y and longitude is x.
Your input should look like the screenshot above. Press OK. In the Coordinate Reference System Selector, type in “4326” in the Filter box and select WGS 84 in the box directly beneath it. Many — but not all — datasets in open data formats are in the WGS 84, or EPSG 4326, coordinate system.
The QGIS map should now look similar to the screenshot below. If it isn’t zoomed in properly, you can right-click the station_data layer in the Layers list and choose Zoom to Layer Extent.
Joining and analyzing bike share data
There is a lot of data in the other three tables to explore but they need to be joined to the station data first since the station data contains the geometry for displaying the data on the map, while the other tables are related to the station data geometry via its station_id field. Fields that can be used for joining are often described in files that come with the data. The README.txt file that came with this data follows this convention.
In this tutorial we’ll use the trip_data table to perform an analysis and display the results on the map. First the trip_data table needs to be added to QGIS. Click Add Delimited Text Layer again, browse to the trip_data table, and choose “No geometry” next to Geometry layer definition. Press ok. The table is added to the Layers list in QGIS. Right-click the table name in the Layers list and click Open Attribute Table. You can see the data has loaded correctly. Notice that the station_id is used in the Start Terminal and End Terminal fields.
The average duration of a trip from each station is a good first analysis. To get the average duration we have to total up the durations of each trip by Start Terminal. This could be done in a spreadsheet program, exported as a CSV file, and then added into QGIS using the steps described above for loading non-spatial tables. Alternatively, we are providing avg.py , a script created that will do the calculation within QGIS.
In the Processing menu under Options and configuration, expand Scripts and view the folder path. This is the folder path in which to save the Python script. Once the script is saved to that path, restart QGIS.
Open the Processing Toolbox by clicking Processing > Toolbox. It will appear on the right-hand side of the QGIS window. Expand Scripts, Boundless, and double-click “avg.” Fill out the dialog with the following, making sure to save the table as a CSV file in the path of your choosing.
Now you can join the output table with the station data layer in order to visualize the average duration (in seconds) of trips from each station. Double-click the station_data layer in the Layers list to bring up the Properties window. Choose Joins and click the green plus sign near the bottom of the window. Pick the table from the list that contains the average data and the field that has the station ID number. If you used the QGIS script, these will be “output_table” and “class.” The Target field is “station_id.”
Now you can look at the attribute table for the station_data to make sure the join worked properly. If it did, the fields from station_data are now in the table. (If the fields are added to the table but the cells are populated with NULL values, the wrong id field was used in the join process.)
To visualize the duration field, double click the station_data in the Layers list to open the Layer Properties and choose Style. Choose Graduated, output_table_avg for the column to style, and change the color in the color ramp as per your preference. Change the mode to Natural Breaks and press ok. (Choosing a mode that makes sense for the data and for the map is an important part of the analytical process. Here is more information on modes ).
Zoom in to the denser section to see that data more clearly. Enlarge the circles by double clicking station_data, Style, click the change symbol button and change the size to 3. Click OK twice.
The trips in San Francisco appear to be shorter than the trips in Redwood City. Hopefully this tutorial on using QGIS with the Bay Area Bike Share open data provides a springboard for contest entrants. Good luck!
Interested in QGIS? Learn more at the first QGIS user group meetup in the United States on Friday, April 11!