There are two parts for creation of map view in SharePoint using Geo location field.
That completes the setting up of the list. The final view looks like below.
- Generating a valid Bing maps key.
- Creation of a Geo location field and list for showing the map view.
1. Generating a valid Bing maps key
Bing map key is a sort of license key. It makes sure that you are registered with Bing maps portal and not using Bing maps for free. There is a 90 days trail version which we can use for development. Register into the Bing maps portal and copy the a valid key. Now run the below powershell script for setting the Bing map key into sharepoint. Key can be set at farm level and web level. At farm level it can be set using powershell, at web level it needs to set using CSOM(Client side object model). Setting of bing map key at web level has high priority than setting at farm level.
Set-SPBingMapsKey -BingKey ""
2. Creation of a Geo location field and list for showing the map view
In the second part we need to create the geo location field. Geo location field cant be created using the UI we need to do it using powershell or programatically. I will go with powershell. the field can be created at a web level or a list level, i will create it at a web level.
$web=Get-SPWeb http://<Site>/sites/PP
$web.Fields.AddFieldAsXml("<Field Type='Geolocation' DisplayName='Location'/>")
$web.Update()
After the creation of the field create a custom list and add the location field to the list as shown below.
List settings view |
Now create new items, for the location field you need to enter the latitude and longitude values or select from the map and save it.
Creation of new item |
Default view |
Create a new view of type Map View in the list. select the location column and other columns for showing on the view. You can select only one location field in a map view. we can create another view with the other location field.
Creation of map view using Map View |
That completes the setting up of the list. The final view looks like below.
Map view |
I really like this feature in SharePoint. Need to explore more on this and whether Google maps is supported or not.
There is one issue which you might face, when you add the list as a web part on a page and publish it the map keeps on loading. One solution for this is to append #InplviewHash to the end of the url.
Comments
Post a Comment