Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
Time to cover the last option in the Data Visualization section, adding maps to our reports. As you might imagine, if you want to use maps, it does put some expectations on the data that you have. It needs to be geographic in some fashion. While you can go very exact, all the way to working with GPS latitude and longitude coordinates, you don't need that to begin with. You can start off as long as you have some cities or states or counties. So, I want to add a map to this blank report that I just created a moment ago. I will choose the Map option and select Map Wizard.
The first thing I'm asked for is a source of spatial data. Now, all maps in Reporting Services display two kinds of data: spatial data and analytical data, which is really what's the map and what's important about it? Spatial data describes the points, the regions or lines or areas of the map. Spatial data is what places exist. Now, right out of the box, I have a few examples in the Map Gallery section here that I can use. It is somewhat USA centric, but I have a folder with all the states by county that I can start to drill through and take a look, get a basic idea of what this map is.
And the spatial data is what's describing the boundaries of all these regions on the map. Underneath that I have three versions of a larger USA map as well. Up above, there are options to change this from the Map gallery to an ESRI shape file. If you have access to those, some of them are commercial, some are freely available that you could link to, for other countries and world maps and so on. And if you have a lot of GIS data internally, you could even write your own SQL Server spatial query that actually returns coordinates, points, and lines and regions that you can work with.
I'm going to go with the basic map gallery here and use USA by State Inset. Click Next. I get a few options about just positioning the map information if I want to. Zooming in or out. There's an option at the bottom here to even add a Bing Maps layer, which will underlay the map with either road or aerial or a hybrid version. It looks interesting, but I really don't need that right now, so I am going to uncheck that box and just use a normal map, and click Next here. This next section of the map visualization is somewhat deceptive.
At first, it might look like picking a color palette for a chart, but it's very different. If I use the Basic Map option, all I am really going to add is the spatial data. It's just the map, but nothing about the map. If, on the other hand, I choose the Color Analytical Map or the Bubble Map, it's going to ask me for a source of analytical data. What's important about this map? What am I trying to show about the individual states on it? Now, I actually don't have a dataset yet. The dataset would be my analytical data. So I am just going to choose Basic Map so we can step all the way through this.
Just like working with charts or tables, we have the Color Theme options here. There is a checkbox to change this into a single color map, which sometimes works well and sometimes doesn't. I am just going to go ahead and click Finish. That's now added to my report. And while I can go ahead and run this, it's not going to do anything. We might have the map, but we have no descriptions of anything important about the map. We have no analytical data. Now, there's a couple of ways this can be added. If I've already added the map here, what you can start doing is adding more layers over the top of it.
By clicking the map and clicking again, you'll get the pop-up window very similar to working with charts or sparklines, where it shows that right now I have one layer on this map, and I can use these options at the top to create a new layer, which will again ask me for spatial data and/or analytical data. If, on the other hand, I wanted to specifically add analytical data to this map, I can do that as well. Right-clicking the layer will allow me to bring up an option for Layer Data, and in there I can provide a dataset of analytical data.
Could do it that way. I'm not going to. I am actually going to use the wizard all the way through. I am just going to cancel out of that, but we need some analytical data first, which means create a dataset. I will add a normal dataset; there is nothing magical about this one at all. I am going to connect to AdventureWorks. I had a data source defined earlier. And in my Query Designer, I'm going to drill down into Sales, into Views, into the vIndividualCustomer, and all I'm going to look for here is the StateProvinceName, and one other column. I will go with BusinessEntityID.
Now, if I run that query, what I'm seeing here is things like New South Wales, British Columbia, Seine Saint Denis, Hamburg. Okay, I'm going to put a filter on this to only bring back the US ones, because I am going to map this to the United States map. So I will add a filter to this query. I am going to filter on CountryRegionName. I know from looking at this data that that is United States. And that needs to be an is and not a like. Go ahead and run this query. And now what I'm getting back are various state province names, California, Washington quite heavily involved there, with just a Business Entity ID that I don't really care about.
As far as I'm concerned, I'm done. This is my dataset. It has all the data that I will need for this map. Rather than add this as an analytical source of data, I am actually just going to run through the wizard again, because it's always good to look at it once or twice. So I am going to select the map, delete it, and we're going to add a new map here. Back to the Insert Tab, add the Map Wizard. Once again, I'm going to use the Map Gallery. My spatial data will just be the built-in USA by State Inset. I will click Next. I don't need to make any changes here. I will click Next again.
This time around, I could choose Color Analytical or Bubble Map. I am going to go with Bubble Map. But by selecting that, the very next thing it's going to ask me for here is to choose the analytical dataset. Okay, I want to represent some information on this map. Where is the information? So I am going to choose this dataset that I just created. It has a list of city names. I am going to ask the map to count them up and to represent them properly. Selecting that, click Next. Now comes the important part. Here is how we tie together our spatial and our analytical data, to match up the information in our normal dataset so it shows up in the right place in our spatial data, in our map.
It might look confusing. It really isn't. This middle section contains data that's already in the map. It's already in our spatial data. We have the STATEFP, which is the FIPS code, the Federal Information Processing State code. We have the USPS abbreviation, and we have State Name. All those options are available, built into the map itself. What I need to do is figure out what's in my analytical data that I can map this to. I can see that really StateProvinceName needs to connect to STATENAME. So that's what I am going to select is the Match field.
Check the checkbox here that STATENAME in the Spatial dataset connects to StateProvinceName in my Analytical dataset. Now, click Next. It's going to ask me for the color theme and visualization. I'm going to select the Generic option. Because I picked a bubble map, it's asking me, do I want to use bubble sizes to visualize data? And yes, I actually do. I want to have a bubble that represents customer count in every particular state. So, with that checked, it's asking, what data am I representing? And I need to click the dropdown because what I want it to do is do a count of the Business Entity IDs, just count up all the companies that came back for that particular state.
I don't care what any particular Business Identity ID is; I just want a count of all of them. So I will do that. And below this, there is an option to display labels. I don't have to have that, but I find it useful. But I would want the labels to have the same information, which is count of business entity ID, and I'll click Finish. Giving myself a little more room on this report, we'll go ahead and run it, and there is our map. And it's immediately obvious where the AdventureWorks customers are primarily distributed, all along the west coast here.
Over 4,000 customers in California, 1,000 in Oregon, 2,000 in Washington, with just a smattering of others all over the rest of the US. So this can immediately give us a view of the data that's much more intuitive than looking at long lists in a table, which is the only way we would have been able to get this before. Getting more advanced, you can create your own spatial datasets to overlay lines and regions on top of this, but that is beyond the scope of this course. So hopefully, this will get you moving on the most common tasks with maps.
Get unlimited access to all courses for just $25/month.Become a member
82 Video lessons · 101006 Viewers
61 Video lessons · 87804 Viewers
71 Video lessons · 71679 Viewers
56 Video lessons · 103563 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.
Your file was successfully uploaded.