Monday, October 5, 2015

Map Report in SSRS




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.
2-Map Report in SSRS
3. A New Map Layer Window Opens. In that select Sql Server spatial queryas shown in below screenshot. Then click on Next Button.
3-Map Report in SSRS
4. In next screen, select dataset which we created earlier in this article. Then click on Next Button.
4-Map Report in SSRS
5. In next screen, Select Point in Layer Type and then click on Next Button.
5-Map Report in SSRS
6. In next screen, choose Map Visualization. Here we select Basic Marker Mapas shown in below screen shot. Then click on Next Button.
6-Map Report in SSRS
7. In next screen, choose color theme and data visualizations as shown in below screen shot. Then click on Finish Button.
7-Map Report in SSRS
8. Now your Report Design should looks like below :
8-Map Report in SSRS
9. Now click on Preview Tab. You will see results like below :
9-Map Report in SSRS
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.
10-Map Report in SSRS
11. Now click on the first icon of Map Layers Pane.
11-Map Report in SSRS
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.
12-Map Report in SSRS
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.
13-Map Report in SSRS
14. In next screen, select option as shown in below screenshot.
14-Map Report in SSRS
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.
15-Map Report in SSRS
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.
16-Map Report in SSRS
17. Now click on preview tab. You will see results like below screenshot:
17-Map Report in SSRS
Congratulations! We successfully created Map Report in SSRS.