In this article, I will show you how to Create Map Report in SSRS.
1. First of all open Visual Studio 2010 and open your SSRS project.Then add report named as DemoMapReport in your project.
Now create a Dataset. In the dataset, we will use following query:
1
2
3
4
5
6
7
8
9
10
| SELECT s.BusinessEntityID, s. Name , a.SpatialLocation,a.StateProvinceID FROM Sales.Store AS s INNER JOIN Person.BusinessEntityAddress AS bea ON s.BusinessEntityID = bea.BusinessEntityID INNER JOIN Person.AddressType AS at ON bea.AddressTypeID = at .AddressTypeID AND at . Name = 'Shipping' INNER JOIN Person.Address AS a ON bea.AddressID = a.AddressID INNER JOIN Person.StateProvince AS sp ON a.StateProvinceID = sp.StateProvinceID INNER JOIN Sales.SalesTerritory AS st ON sp.TerritoryID = st.TerritoryID INNER JOIN Person.CountryRegion AS cr ON st.CountryRegionCode = cr.CountryRegionCode WHERE (cr. Name = 'United States' ) and S.BusinessEntityID > 1030 |
2. right click on report area and go to Insert–>Map.
3. A New Map Layer Window Opens. In that select Sql Server spatial queryas shown in below screenshot. Then click on Next Button.
4. In next screen, select dataset which we created earlier in this article. Then click on Next Button.
5. In next screen, Select Point in Layer Type and then click on Next Button.
6. In next screen, choose Map Visualization. Here we select Basic Marker Mapas shown in below screen shot. Then click on Next Button.
7. In next screen, choose color theme and data visualizations as shown in below screen shot. Then click on Finish Button.
8. Now your Report Design should looks like below :
9. Now click on Preview Tab. You will see results like below :
10. Now we are going to add a Polygon Layer to the Map.To add a Polygon Layer, Double click on your map to display the Map Layers Pane.
11. Now click on the first icon of Map Layers Pane.
12. A New Map Layer window opens. In that select Map Gallery option and then select USA By State Inset as shown in below screenshot. Then click on Next Button.
In next window, also click on Next Button.
13. In next screen, select map visualization. Here we select Basic Map. See below screen shot. Then click on Next Button.
14. In next screen, select option as shown in below screenshot.
Then click on Finish Button.
15. Now click on Map Layers Pane. In that select PointLayer1 and then click onUp arrow as shown in below screen shot.
16. Now right click on Polygon Layer in Map Layers Pane and select Properties. In that select Fill option from left pane and then select color. Then click on OK Button.
17. Now click on preview tab. You will see results like below screenshot:
Congratulations! We successfully created Map Report in SSRS.