Configuring Location and Map Functionality in SharePoint 2013
Step 1 – Get & Set a Bing Maps API Key at the Farm or Web Level
SharePoint 2013 uses Bings Maps to render the map of the location. To be able to use the Bing Maps feature, you need to create a Bing Maps key and set the key at the web or farm level. You’ll see an error message on the map if you do not use a valid Bing Maps key or if a key is not set at the web that contains the list or at the farm level.
Once registered, go to “Create or View Keys”:
A bit about the keys:
You are able to create two keys (Trial or Basic) for most application types and one additional Windows Store app Trial key under this account. Trial keys expire after 90 days and cannot be converted to Basic keys. You cannot delete keys or generate more than 3 keys from this account. If you intend to create a non-trial application, make one of the keys a Basic key and read the governing TOU that defines usage limits.
There are two types of keys, Trial and Basic. The details of both key types can be found here: https://www.bingmapsportal.com/application/Whats/1100949
In our case, since we are using it on a production portal, we are going to use the Basic key of the Public Website sort:
Set-SPBingMapsKey –BingKey “Enter your key here”
Your farm will now be activated for that particular Bing API key.
Full reference: http://msdn.microsoft.com/en-us/library/jj163283
Step 2 – Install SQLSysClrTypes.msi on each SharePoint Web Front-End Server
An MSI package named SQLSysClrTypes.msi must be installed on every SharePoint front-end web server to view the geolocation field value or data in a list. This package installs components that implement the new geometry, geography, and hierarchy ID types in SQL Server 2008. By default, this file is installed for SharePoint Online.
However, it is not for an on-premises deployment of SharePoint Server 2013. You must be a member of the Farm Administrators group to perform this operation. To download SQLSysClrTypes.msi, see Microsoft SQL Server 2008 R2 SP1 Feature Pack for SQL Server 2008, or Microsoft SQL Server 2012 Feature Pack for SQL Server 2012 in the Microsoft Download Center.
Step 3 – Add a GeoLocation column to a SharePoint 2013 List
Out of the box, even when you have a Bing API key applied to your farm, there is still no way to leverage GeoLocation data at the SharePoint List data – you must first programmatically add a List field of the type GeoLocation. The following PowerShell takes a SharePoint Site and List name as input parameters and will add the field with the displayname “GeoLocation” to said List:
Param( [parameter(Mandatory=$true)] $webUrl, [parameter(Mandatory=$true)] $listName ) Add-PSSnapin Microsoft.SharePoint.Powershell -ErrorAction SilentlyContinue $fieldXml = "<Field Type='Geolocation' DisplayName='Location' />" $web = Get-SPWeb $webUrl $list = $web.Lists[$listName] $list.Fields.AddFieldAsXml($fieldXml,$true,[Microsoft.SharePoint.SPAddFieldOptions]::Default) $list.Update()
Add-SPGeoField.ps1 -webUrl http://mySharePointSite -listName MyListName
You may want to go to your SharePoint and ensure the newly added “Location” field is in your view:
Full reference:
Juan
Great post with good information, do you have an idea how to set custom size of the map?
Keith Tuomi
Hi Juan,
If you want to customize the map or add complex shapes (like polygons), you will need to do some additional custom development, starting with the Bing Maps AJAX Control: http://msdn.microsoft.com/en-us/library/gg427608.aspx . I’m currently not aware of a simple way to modify the built-in SharePoint 2013 Bing maps, although i’m pretty for sure for sizing all you’d need to do is resize the bounding DIV tag that contains the map.
Henry Xiao
I have registered the map key on my farm and add a geolation on my site collection.
I then create a contact list and create a map view.
But here is the thing.
Only user who are site collection admins can see the map, others the loading the map just hang on and never end?
Can you help?
Keith Tuomi
Hi Henry, Try running Fiddler (http://www.telerik.com/fiddler) to check what is being sent from the server to the client, when the map view is being loaded. If you see any 403 forbidden or long-running processes relating to assets for the Bing map, then that would be your culprit – check that those assets are in a location where appropriate permissions are applied to allow general users to read them.