My Account     Contact Us     Cart

Mapping Class: Efficient Labeling using attribute expression builder with Steve Spindler

Welcome back to this month’s edition of Mapping Class. The Mapping Class tutorial series curates video tutorials and workflows created by experienced cartographers and Avenza software users. Joining us once again is Steve Spindler, a longtime MAPublisher user, and expert cartographer. Steve is here to show you a quick tip for using the attribute expression builder within MAPublisher to quickly perform batch edits of labels. 

Steve has produced a short video to demonstrate how he uses the expression builder to quickly edit street names. The Avenza team has produced video notes (below) to help you follow along.

***

Label efficiently using Attribute Expression Builder
by Steve Spindler (video notes by the Avenza team)

With MAPublisher, labeling your maps is a breeze. With powerful tools such as LabelPro, labeling is only a matter of selecting the data you want to label, and configuring a robust set of rules that control how each label is placed and styled. But before you can start labeling, you must have high-quality, accurate attribute information for your map data. Since labels are typically generated by displaying text values contained in an attribute column, it is important that attributes are not only accurate but are also formatted in a way that is optimized for display on a map. In many cases, cartographers need to spend time reformatting or editing attribute information before they can generate labels, a process that can become quite time-consuming. Nowhere else is this problem more common than when dealing with street names and road network data.

This image has an empty alt attribute; its file name is Tools.jpg

When labeling streets, cartographers often spend time correcting, or even generating brand new attribute information that can be used to create more concise, effective street labels. This typically involves changing street prefixes and suffixes to a condensed short form (i.e “North Cherry Boulevard” becomes “N Cherry Blvd”). For smaller projects, this can be done by manually editing the individual attribute values directly within the MAP Attribute panel. For large projects, especially those dealing with hundreds or even thousands of map features, manual editing would be very time-consuming.

For a more efficient approach, Steve shows how you can use the Expression Builder to easily modify large selections of attribute values. The first step is to open the MAP attribute table, which displays all the attribute information contained within a specific map layer. Steve identifies the attribute column that contains the text street names and will use this to build out a new attribute column to create his labels.

This image has an empty alt attribute; its file name is Buiiklder-1024x691.jpg

Next, Steve opens the Edit Schema window of the attribute table. Here, you can access column information such as the data type, default value, field visibility, and most importantly; the expression builder.

The expression builder may seem intimidating at first, but with a little bit of effort, it can be an incredibly powerful tool for calculating attribute values and performing batch-edits on your data. The tool uses built-in operators and items in the objects list (attribute names and values, constants, functions) to calculate custom attribute information based on a specified set of expressions. In this case, Steve first creates an expression set that modifies the suffix values in the Street name field (i.e “Boulevard”) and substitutes them with the appropriate short form (“Blvd”). The expression is used to populate a new attribute column called “Road_suffix”. The end result means attribute values such as “East Utica Street” will be passed to a new attribute value of “East Utica St”.

This image has an empty alt attribute; its file name is inputs.jpg
IF_CASE(name,
ENDSWITH(name, “ Street“),SUBSTITUTE( name , “Street”, “St”),
ENDSWITH(name, “ Drive“),SUBSTITUTE( name , “Drive”, “Dr”),
ENDSWITH(name, “ Road“),SUBSTITUTE( name , “Road”, “Rd”),
ENDSWITH(name, “ Court“),SUBSTITUTE( name , “Court”, “Ct”),
ENDSWITH(name, “ Way“),SUBSTITUTE( name , “Way”, “Wy”),
ENDSWITH(name, “ Lane“),SUBSTITUTE( name , “Lane”, “La”),
ENDSWITH(name, “ Route“),SUBSTITUTE( name , “Route”, “Rt”),
ENDSWITH(name, “ Boulevard“),SUBSTITUTE( name , “Boulevard”, “Blvd”),
ENDSWITH(name, “ Turnpike“),SUBSTITUTE( name , “Turnpike”, “Tpke”),
ENDSWITH(name, “ Avenue“),SUBSTITUTE( name , “Avenue”, “Ave”),
ENDSWITH(name, “ Place“),SUBSTITUTE( name , “Place”, “Pl”),
ENDSWITH(name, “ Circle“),SUBSTITUTE( name , “Court”, “Cr”),
ENDSWITH(name, “ Highway“),SUBSTITUTE( name , “Highway”, “Hwy”),
ENDSWITH(name, “ Expressway“),SUBSTITUTE( name , “Expressway”, “Exp”)
)


Next, Steve creates a second set of expressions that will further adjust his Road_suffix attribute column to substitute any street name prefixes (North, East, South, West) with their corresponding short-form (N, E, S, W). This second expression (see code block below) is used to populate another new attribute column called “Label”, which will ultimately be used to generate the final formatted label layer. 

((IF_CASE( Road_suffix ,
STARTSWITH(Road_suffix, “West “), SUBSTITUTE( Road_suffix, “West “, “W “),
STARTSWITH(Road_suffix, “South “), SUBSTITUTE( Road_suffix, South “, “S “),
STARTSWITH(Road_suffix, “North “), SUBSTITUTE( Road_suffix, “North “, “N “),
STARTSWITH(Road_suffix, “East “), SUBSTITUTE( Road_suffix, “East “, “E “)
))

This image has an empty alt attribute; its file name is ExpressionAttributes.jpg

Note that these expressions are specific to the dataset and map area Steve is using for his project. When using expression builders for your own maps, pay careful attention to the attribute values specific to your area of interest. The best part about expression sets is that they are highly flexible, meaning you can build upon and modify existing expressions, save them to your library, and even use them across multiple different mapping projects!

With his newly created “Label” attribute column, it’s simply a matter of configuring the LabelPro tool to display these formatted label values. With a bit of configuration, the end result is a clean, uncluttered, collision-free label layer. The labels now use all the correct prefixes and suffixes Steve required. By saving his expression sets to his library folder, Steve can now quickly and easily repeat the exact same batch-editing process for new maps with only a few clicks! 

This image has an empty alt attribute; its file name is ExpressionBuilder-1024x249.jpg

***

About the Author

Steve Spindler has been designing compelling cartographic pieces for over 20 years. His company, Steve Spindler Cartography, has developed map products for governments, city planning organizations, and non-profits from across the country. He also manages wikimapping.com, a public engagement tool that allows city planners to connect and receive input from their community using maps. To learn more about Steve Spindler’s spectacular cartography work, visit his personal website. To view Steve’s other mapping demonstrations, visit cartographyclass.com

Labelling Made Easy with MAPublisher Label Tools and the MAPublisher LabelPro Add-on

Maps are a fusion of art and science, presenting complex geographical data in a way that is both visually appealing and informative. Cartographers use maps to convey a story, drawing attention to important information using carefully crafted design choices and curated map elements that engage the viewer. Although cartographers employ a variety of specialised techniques to present this meaningful information on a map, one of the simplest, yet most effective methods is through map labels.

Quite simply, map labels are symbols or texts strategically placed at specific locations on a map to identify important geographical features, locations, or areas of interest. To a map viewer, labels are a quick and easy way to know exactly what is shown on a map. To a map maker, however, the task of creating labels is not often quick and generally isn’t easy. This is especially true when there are a large number of labels that need to be placed, or when labels need to follow complex paths such as roadways, rivers, or trails. Map-makers must also consider the issue of label crowding and collisions, ensuring labels are not overlapping each other, covering or distracting from other important features of the map. Combined, these challenges can be a significant time-sink in the map-making process, requiring both time and effort on the part of the cartographer.

Labelling doesn’t have to be difficult though, and in this blog, we will show you how built-in MAPublisher label tools and the MAPublisher LabelPro add-on can make labelling simple.

Let’s start with our unlabelled map. We have taken a collection of openly available geo-data depicting the small mountain town of Ouray, Colorado (home of National Geographic Cartographer and last month’s Avenza Cartographer Chronicles feature, Mike Boruta). We have stylized the data to show rivers, parks, streets and trails all throughout the town, but we feel labels would help a user to better understand the information being shown. We are going to approach the labelling process in a few different ways.

Manual Label Placement with the MAP Tagger Tool

For small labelling tasks, where a map maker might need to place only a handful of precisely located labels, the MAP Tagger tool is perfect for the job. MAP Tagger allows us to configure a basic set of options that control the character style of our label as well as general label placement rules. From there, we can simply click on a map feature and have the tool automatically detect and apply a label from attribute information contained in the selected layer. As we have direct control over the placement of every individual label, we can be extremely precise in choosing label placements that work for our map. Best of all, the tool automatically detects and applies text pathing for line features, meaning text labels can follow the form of any road, river, trail in your map!

When working with a small number of map features, the MAP Tagger tool is often just what you need to add well-placed labels to your map. For larger labelling tasks, such as our Ouray map, where there are many layers and several different features to be labelled, a manual approach such as this would be very time-consuming. Instead, we need to implement a more automated, batch labelling technique to speed-up the map-making process.

Batch label placement with the Label Features Tool

When you are working with several map layers, or have a large number of geographic features that each need to be labelled, it can be more efficient to create your labels all at once. The Label Features tool comes built-in with MAPublisher, and can handle batch labelling of map features with only a few clicks. The tool is designed similarly to MAP tagger, and automatically populates the map with precise, path-aligned labels, while offering the flexibility to define unique character styles for each map layer.

Taking a look at the tool, we were able to quickly generate over a hundred labels, for every road, trail, river, and park layer in our Ouray map. By nature, the tool will present you with a large number of labels for each feature, allowing us to examine and choose the labels we wish to retain and remove those that we don’t. With a little bit of clean-up to remove those extra or unwanted labels (see the animation below), we can already see our labelled map is coming together!

The Label Features tool is great for getting a head start on large labelling projects, but you might notice that the output of the labelling tool still requires some manual intervention to clean-up the output. For example, notice how “4th Street” and “5th Street” labels are repeated several times over the length of the street, with some labels colliding with others to create an overlap. This is a common problem in many labelling tasks and is due to the way our input data is structured. The dataset we obtained presents each road in the town as a line, but rather than present each road as a single continuous feature, it breaks up each street into several linked segments. Although this can be corrected with manual editing, it can still be time-consuming when working with a high number of labelled features. To avoid this, we need a method of achieving smarter batch label placement that can detect and reduce instances of label collision or redundancy. 

Fortunately, we have one last trick up our sleeves that makes even the most complex labelling tasks a breeze. We can use MAPublisher LabelPro for collision-free, rules-based label placement.

Better Labelling with MAPublisher LabelPro

The MAPublisher LabelPro add-on allows the user to customize a wide variety of enhanced labelling options that result in smarter, more efficient label placement. LabelPro comes with a powerful purpose-built labelling engine that handles not only label placement, styling, and pathing, but also optimizes the grouping, fitting, and collision avoidance of labels to reduce crowding, avoid label overlap, and eliminate label redundancies. 

Remember those overlapping labels we ran into with the Ouray map? With LabelPro we can set rules that treat street segments as contiguous features in a single line, meaning the labelling engine will efficiently place labels that are representative of the entire street, rather than just for each segment. The intelligent collision and fitting rules mean we can also prevent labels from overlapping each other or crowding the map, saving us time and effort by letting the tool handle precise label placement with minimal clean-up. By setting layer priorities designating certain layers as obstacles we can make sure our important labels are unobstructed, and other labels do not cross other features in a way that would confuse the map viewer. 

With LabelPro, we can also create expressions to apply conditional character styles and rules based on attribute values in the data. In our map, we created label filters for “Residential Roads”, “Service Roads”, and “Alleyways”, allowing us to label (or not label) certain road types differently, even though they are all contained in the same “secondary roads” map layer. These are only a few examples of the robust collection of configurable rules and smart labelling options available to tackle even the most complex labelling tasks.

With our rules set up and all character styles defined, in very short order we could automatically generate labels for all rivers, roads, highways, parks and trails in our Ouray map. The smart placement with LabelPro means we spend less time manually correcting label placement and allows us to produce maps more efficiently and easily. If you want to read a more in-depth, tutorial style article that shows you the exact steps we used to easily create our simple map of Ouray, check out this great workflow article produced by our support team – Here!

 

Data sources: All datasets were obtained from OpenStreetMap and the Ouray County Open Data portal.

People, Parks, and the Pandemic: Designing Infographics with Avenza MAPublisher

Here at Avenza, we love finding interesting data and using it to create engaging maps. In this blog, we show you how we used the powerful spatial data manipulation and cartographic styling tools found in MAPublisher for Adobe Illustrator to create an infographic exploring how park visitor patterns changed in the United States in 2020 using a truly interesting openly available dataset.

Recently, Google made its COVID-19 Community Mobility Reports public. These reports use aggregated anonymous mobile GPS data to explore how global human activity patterns in specific location categories (parks, retail, transit, residential, workplaces, and grocery) changed as a result of the ongoing pandemic. The U.S. dataset is massive, containing estimates of daily visitor activity for each location category in every county. Each data point provides an estimate of that day’s percentage increase or decrease in visitors relative to a pre-pandemic baseline period, meaning the data reflects how pandemic restrictions on that day may have impacted park space usage in that specific location.  Below shows a sample of the raw dataset, listing five data points covering Feb 15-19th activity patterns in a single Colorado county.

We downloaded the complete dataset (February to November 2020) from Google’s mobility reports data portal. The dataset contains nearly 900,000 records of all 3,143 counties in the U.S.  We wanted our infographic to focus on the parks category, which includes every national, state, and local park, as well as public forests, campgrounds, beaches, marinas, dog parks, and gardens. Using the open-source statistical programming language R, we were able to aggregate the dataset into a more manageable size. Below, you can see how some basic filtering of these “cleaned” datasets already shows evidence of some interesting patterns, but we felt that mapping the dataset would be much more engaging.

Maps are powerful story-telling tools, and we felt this data would be more interesting if you could see how park visitor patterns changed not only with time but also with geography. To make working with map data in Adobe Illustrator easier, we used the MAPublisher Import tool to load in a shapefile of U.S. state boundaries. The tool allows us to treat our dataset as a fully functional graphic element in Illustrator while still retaining all geographic properties integral to spatial data (attributes, topology, and coordinate systems). 

To visualize the data as a map, we needed a way to associate each record in our tabular dataset to a specific location (in this case, a State). To do this, we used the Join tool, which takes our “cleaned” tabular parks dataset (stored as a CSV file), and links it to our mapped states shapefile using the shared State names column. 

We started to think about how to design the layout of the infographic (this is where having a mapping environment in Illustrator really shines). We wanted it to consist of three main parts: a large labelled map showing the average change in park visits over the entire year; a vertical series of maps showing how park visits varied month to month; and a handful of pop-out maps with insets highlighting specific points in the year and specific regions of the country.

We chose to stylize the data into thematic maps, which use colour to represent specific values in the data at different locations. Instead of tediously configuring individual colour fills, we used MAP Themes to establish a rules-based stylesheet that applies a colour automatically to each State based on the monthly park visitor columns stored in the map layer’s attribute table. We chose a “thematic map” colour group from the included ColorBrewer 2 swatch library to best show positive and negative changes in park usage. 

Next, we populated our main map with labels showing the percentage change in park use for each state. As many cartographers know, placing and configuring labels can be a significant time sink. Fortunately, we could use the MAPublisher LabelPro add-on to provide collision-free, rules-based label placement. We could configure the label rules to automatically handle collisions, alignment, and placement of labels for each state. Using the leader lines option in the LabelPro Rules panel, we were even able to create offset labels that prevent crowding the map.

Finally, we decided that to create some insets to highlight specific parts of the country.  From a “master” map,  we used the Crop to Shape tool to crop the map data to our desired inset extents. Using Crop to Shape is quick, and also retains the styling elements (colours, labels, strokes), topology, and attribute integrity of the cropped map layers. 

With most of the maps completed, all that was left was to populate the infographic with text and graphics. Using the MAPublisher layout tools, we added a functional North Arrow and customized the automatically generated legend layer to suit our infographic’s design. Lastly, we used an Illustrator graph tool to create a vertical line graph of park activity along the left side of the infographic.

Presenting the dataset in this way makes it much easier to extract insights and craft a story from the data. Some patterns are immediately noticeable, such as the overall increase in park space usage that is observed for most of the US during the pandemic period. This isn’t exactly unexpected, as parks were one of the most accessible forms of leisure activity and recreation amid widespread social distancing and retail/entertainment closures. We also see how state-specific factors may have affected park usage in different regions of the country at different times. Some states, such as South Dakota, had eased restrictions on out-of-state visitors to their park systems, resulting in a spring season surge in park usage earlier than their neighbours. Conversely, states which typically draw a high proportion of international tourists, such as California, Hawaii, and Florida, saw more of a decrease in average park usage as a result of global air travel decline. These patterns and stories are one of many that can be identified, providing compelling examples of why maps are such powerful tools for visualizing data.

The beauty of working with MAPublisher to create this map-heavy infographic is that we were able to implement the powerful mapping and data manipulation tools of a dedicated GIS while seamlessly integrating the advanced art and design tools offered by the Adobe Illustrator graphical environment. Together, these tools turned what would have been a complex workflow of importing and exporting data between different software, and allowed us to create the entire infographic in a single mapping and design-focused fully integrated workspace.

See the Full infographic below:

 

References:

Data – https://www.google.com/covid19/mobility/
Pandemic Timeline – https://www.ajmc.com/view/a-timeline-of-covid19-developments-in-2020
Raw Park Visitor Stats – https://irma.nps.gov/STATS/
Camping Stats – https://koa.com/north-american-camping-report/

News Reports and Park/State-Specific Articles

“Camping in Tennessee’s State Parks Increase during Pandemic.” Wreg, AP, 9 Dec. 2020, wreg.com/news/camping-in-tennessees-state-parks-increase-during-pandemic.

Marcus Schneck. “Camping at Pennsylvania State Parks ‘Going through the Roof’ as Coronavirus Restrictions Ease.” Pennlive, 1 July 2020, www.pennlive.com/coronavirus/2020/07/camping-at-pennsylvania-state-parks-going-through-the-roof-as-coronavirus-restrictions-ease.html.

Anderson, Patrick. “National Parks in South Dakota Remain Open as Others Close across the Country.” Argus Leader, 17 Apr. 2020, eu.argusleader.com/story/news/business-journal/2020/04/17/coronavirus-south-dakota-national-parks-remain-open-others-close/2981675001.

Henderson, Catherine. “Having a Hard Time Finding a Campsite in Colorado This Summer? You’re Not Alone.” The Know Outdoors, 15 July 2020, theknow.denverpost.com/2020/07/15/colorado-camping-covid-national-parks-state-parks/241704.

Wiley, Melissa. “What the 10 Most Visited National Parks in the US Have Said about Their Plans to Reopen, from Opening in Phases to Implementing Social Distancing Guidelines.” Business Insider, 21 May 2020, www.businessinsider.nl/are-national-parks-open-covid-19-coronavirus-united-states-nps-2020-5?international=true&r=US.