SharePoint 2013 introduced a new functionality called "Geolocation" as a Field type to enable location based data in SharePoint lists. So with GeoLocation field, we can bring "Map" experience to the users. Geolocation Field type is not enabled by default. We have to do few configurations to make it available in SharePoint 2013.
Here are the steps in summary to enable Geolocation field in SharePoint 2013:
- Register for a Bing map key
- Set Bing map key in SharePoint
- Add GeoLocation column to SharePoint site/list Programmatically.
Step 1: Get a Bing map key Obtain a Bing map key by registering at: https://www.bingmapsportal.com. In my case, Here is what I've created by clicking "Create or View Keys".
Step 2: Set Bing Map Key in SharePoint 2013
Login to your SharePoint Server, From SharePoint Management PowerShell, Enter:
Set-SPBingMapsKey –BingKey "<Bing Maps key obtained>"
This sets Bing API Key at the farm level. Its also possible to set Bing map key at Web Application Level.
Step 3: Add GeoLocation Field to SharePoint Site/List
Unfortunately, There is no UI way to add Geolocation column to SharePoint site or List! So, Lets do it programmatically using PowerShell.
Add-PSSnapin Microsoft.SharePOint.PowerShell #SharePoint Site URL to add Geolocation field $webURL = "http://sharepoint.crescent.com/" #Field definition for Geolocation $fieldXml = "<Field Type='Geolocation' DisplayName='Location' />" #Get the Web $web = Get-SPWeb $webURL #Add field to the Web $web.Fields.AddFieldAsXml($fieldXml,$true,[Microsoft.SharePoint.SPAddFieldOptions]::Default)This adds "Location" field to the provided SharePoint web. You can Navigate to List settings >> Add from Existing columns and then Select "Location" column under Custom columns group.
Its also possible to add GeoLocation column directly to the SharePoint list. Here is the PowerShell script:
Add-PSSnapin Microsoft.SharePOint.PowerShell #SharePoint Site URL and List name parameters. $webURL = "http://sharepoint.crescent.com/" $ListName = "Project List" #Field definition for Geolocation $fieldXml = "<Field Type='Geolocation' DisplayName='Project Location' />" #Get the Web & List $web = Get-SPWeb $webURL $list = $web.Lists[$ListName] #Add the Field to List $list.Fields.AddFieldAsXml($fieldXml,$true,[Microsoft.SharePoint.SPAddFieldOptions]::Default) $list.Update() #or use: $FieldType = [Microsoft.SharePoint.SPFieldType]::Geolocation #$List.Fields.Add($columnName, $FieldType, $false)
Set GeoLocation column Value:
Now, You can enter locations either by Providing Latitude-Longitude coordinates or based on current location. On clicking "Use My Location" link, SharePoint automatically sets the location based on your IP!
Geolocation functionality also provides an another feature: Map View, which gives map layout for the locations tagged. Just create a new view for your list/library >> Choose "Map View"
and the result goes here:
You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.