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: