SharePoint Pals
 | Sign In
How to use Geo Location Field in SharePoint Online with Bing Maps
by Sriram Varadarajan 4 Jun 2016
Author
Enterprise Architect
Visits   
Today  :   5     Total  :    3330

It’s been a while since Microsoft introduced Geolocation location datatype in SQL but it’s wasn’t rolled out to SharePoint immediately. Microsoft has addressed this demand in SharePoint 2013 (though not that straight forward) but still you can use it.

What is Geolocation means to us

In columns of type Geolocation, you can enter location information as a pair of latitude and longitude coordinates and retrieve those co-ordinates and display it in a Bing Map (Or any equivalent API).

How to add a Geolocation Column: I’m pretty sure this would be the next question, how to add this column as you don’t find this column type either in site/list column.

The Geolocation column is not available in SharePoint lists for users, by default. To add the column to a SharePoint list, you need to write code.

Script:

 $WebUrl = "Site collection URL"
 $EmailAddress = "User ID"
 $Context = New-Object Microsoft.SharePoint.Client.ClientContext($WebUrl)
 $Credentials = Get-Credential -UserName $EmailAddress -Message "Please enter your Office 365 Password"
 $Context.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($EmailAddress,$Credentials.Password)
 $List = $Context.Web.Lists.GetByTitle("List Name")
 $FieldXml = "<Field Type='Geolocation' DisplayName='Demo locatie'/>"
 $Option=[Microsoft.SharePoint.Client.AddFieldOptions]::AddFieldToDefaultView
 $List.Fields.AddFieldAsXml($fieldxml,$true,$option)
 $Context.Load($list)
 $Context.ExecuteQuery()
 $Context.Dispose() 
 

How to display this column in Bing Map

1. List Data in Bing Map is a SharePoint online app that is used for visualizing the data from SharePoint list and it’s a free APP

Follow the steps to add this APP to you site

Navigate to your target site and select the gear in the top right corner: Please refer to this article to understand the access and permission required to perform the below activity

clip_image002

Select Add an APP from the list options.

a.

clip_image004

Select SharePoint Store from the list of options displayed on the left side of the page.

b. In the SharePoint Store site, search for the APP List data in Bing Map in the search BOX available in the top right corner.

clip_image006

clip_image008

c. Select the APP and Click REQUEST IT. (Since this APP needs high privilege this can’t be directly added to the site, this needs to be approved by the store admin to get this added to your site)

d. Once approved this APP would get added to your site.

Next step is to add this APP to your page

Please follow the below steps:

Step 1

clip_image009

clip_image011

After successfully installing the Bing Map App, you may use it right away. The app is ideal for the visualization of SharePoint list data. You will need a SharePoint list with at least two data columns – latitude and longitude. To fully visualize all your contents, you will need additional columns containing more information. In addition, a valid Bing Map Key is required; without it you won’t be able to use the app. To embed the app part in a website, open the target website in its editing mode. Enable the tab "INSERT". In the ribbon, click the button "App Part" to view the available app parts in list form. Select the app part dev-sky - List data in Bing Map. Click ADD on the right to install the app part on the website. To configure the part and its user settings, set the app part to its editing mode (see left image). Open the context menu of the app part to enable the menu item EDIT WEB PART. Then configure the part itself following Step 2 below.

Step 2

clip_image013

Enter a valid Bing Map Key into the upper text field.

WARNING: You can not use this app without a valid key!

Select the SharePoint list containing the data for visualization from the selection window below. A new list will display all available list view settings. Select the desired view. The selection windows below will display all available columns in the selected view format. Select the columns according to their contents. After entering all information, click the lower button to save the settings. WARNING: Saving the web part settings only, will not save all configurations made.

Control behaviour via List settings

You might need to adjust the size of the map's text fields according to their content length. To do so, the selected view setting must have the two fields: BingMapInfoHeight and BingMapInfoWidth. Both fields must be set to a NUMBER value. Here, you can enter the size for each text field. Leave blank, if the size of your text fields shall remain unchanged.

TIP: For these settings to be recognized, enable the option "Pop-up Dimensions" under Web Parts settings.

2. User should generate the Bing map key and add them to the configuration list on the same SharePoint site (one time activity)

a. Creating BING KEY

b. When you use any Bing Maps API with a Bing Maps Key (you must have a Bing Maps Account), transactions are recorded. Transactions track API usage and can be billable or non-billable.

c. The Bing Maps API usage tracking doesn’t save any of the site/user related information.

d. To understand more on billable and non-billable service, please refer to

With this we should able to see the Bing Map actually functioning.

blog comments powered by Disqus

SharePoint Pals

Pals
SharePoint Pals, a community portal for SharePoint developers, Administrators and End Users. Let's join hands and share the point together.
Read this on mobile

Training

Angular Js Training In Chennai
Advanced Angular Js training with real world developer scenarios
Angular Js, Web Api and Ionic for .Net Developers
All in one client side application development for .Net developers
Angular Js For SharePoint Developers
Get ready for the future. Its no more just C#

Get Connected

SharePoint Resources

SharePoint 2013 and 2010 Web Parts
Free Web Parts with Source Code for SharePoint Community




SharePoint 2013 Books and Tutorials
Collection of free SharePoint 2013 books and tutorials (eBooks, pdfs)

Supported By

Contribute your article and be eligible for a one month Free Subscription for Plural Sight. The Author of the most popular New Article (published in the previous month) will be awarded with a Free One month Plural Sight Subscription. Article can be sent to articles@sharepointpals.com in a word document.

Related Resources

Recent Tweets

Twitter January 15, 00:25
How To Enable Target Value And Actual Value In #D3 Gauge Chart https://t.co/VxSi4QnNrC

Twitter January 15, 00:24
How To Open #SharePoint List Hyperlink Column In Modal #Popup Window https://t.co/EQ7HkoZDkX

Twitter January 15, 00:24
Quick Introduction To #Asp.NetCore And It’s Features https://t.co/zAXObHCFpH

Twitter January 15, 00:22
How To Configure #PerformancePoint Services To Use Secure Store In #SharePoint 2013 https://t.co/LEwnUoI7EY

Twitter January 15, 00:21
How To Block Or Disable #Office365 Services https://t.co/Yvp2VPFIRP

Follow us @SharePointPals
Note: For Customization and Configuration, CheckOutRecent Tweets Documentation