using sharepoint's geolocation field - spsuk 2014

17

Click here to load reader

Upload: mark-stokes

Post on 08-Jul-2015

636 views

Category:

Technology


2 download

DESCRIPTION

My slide deck introducing the Geolocation Field in SharePoint 2013 and SharePoint Online.

TRANSCRIPT

Page 1: Using SharePoint's Geolocation Field - SPSUK 2014

Using SharePoint’s Geolocation FieldMark Stokes – SharePoint Saturday UK 2014

Page 2: Using SharePoint's Geolocation Field - SPSUK 2014

Mark Stokes [MVP]

Red Plane

Microsoft Partner in North West UK

www.redplane.co.uk

@FlyRedPlane

Office 365, SharePoint, Azure, nopCommerce, Windows 8 Apps, Windows Phone Apps, iOS Apps, .Net

[email protected]

@MarkStokes

Interests: Travel, Technology, Photography, Raspberry Pi, Snowboarding, Wakeboaring, Running, Tough Mudder, My Dog - Hugo

Page 3: Using SharePoint's Geolocation Field - SPSUK 2014

Agenda

What is the Geolocation Field?

Adding Geolocation Field

Bing Maps License

Creating a Map view

Geolocation field example scenarios

Page 4: Using SharePoint's Geolocation Field - SPSUK 2014

What is the Geolocation Field?

SharePoint 2013 introduced a new field type named Geolocation that enables you to annotate SharePoint lists with location information.

In columns of type Geolocation, you can enter location information as a pair of latitude and longitude coordinates in decimal degrees or retrieve the coordinates of the user’s current location from the browser if it implements the W3C Geolocation API.

In the list, SharePoint 2013 displays the location on a map powered by Bing Maps.

A new view named Map View displays the list items as pushpins on a Bing Maps Ajax control V7 with the list items as cards on the left pane.

Together, the Geolocation field and the Map View enable you to give a spatial context to any information by integrating data from SharePoint into a mapping experience, and let your users engage in new ways in your web and mobile apps and solutions.

Page 5: Using SharePoint's Geolocation Field - SPSUK 2014

SP2013 On-Premises – Pre-Requisites

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.

http://msdn.microsoft.com/en-us/library/office/jj163135(v=office.15).aspx

Page 6: Using SharePoint's Geolocation Field - SPSUK 2014

Enabling the Geolocation Field

Bing Maps License Key - https://www.bingmapsportal.com

To set the Bing Maps key at the farm level using Windows PowerShell

Set-SPBingMapsKey –BingKey "<Enter a valid Bing Maps key>”

When you use Windows PowerShell, the Bing Maps key can be set only at the

farm level. If you want to set the Bing Maps key at the web level, you can set

the key programmatically.

Page 7: Using SharePoint's Geolocation Field - SPSUK 2014

Enabling the Geolocation Field

To set the Bing Maps key at the web level using custom code (C#)

class Program

{

static void Main(string[] args)

{

SetBingMapsKey();

Console.WriteLine("Bing Maps set successfully");

}

static private void SetBingMapsKey()

{

ClientContext context = new ClientContext("<Site Url>");

Web web = context.Web;

web.AllProperties["BING_MAPS_KEY"] = "<Valid Bing Maps Key>”

web.Update();

context.ExecuteQuery();

}

}

Page 8: Using SharePoint's Geolocation Field - SPSUK 2014

Enabling the Geolocation Field

To set the Bing Maps key at the web level using custom code (JavaScript)

function SetBingKey() {

clientContext = new SP.ClientContext([Relative Web Address]);

var web = clientContext.get_web();

var webProperties = web.get_allProperties();

webProperties.set_item("BING_MAPS_KEY", “[Enter Bing Maps Key here]”);

web.update();

clientContext.load(web);

clientContext.executeQueryAsync(function (sender, args) {

alert("You have successfully entered BING map key on "+ web.get_title() + " site”);

}, function (sender, args) {

alert("Error: ” + args.get_message());

});

}

Page 9: Using SharePoint's Geolocation Field - SPSUK 2014

Map View

A Map View is a SharePoint view that displays a map (with data obtained from the Bing Maps service), using longitude and latitude entries from the Geolocation field type.

When the Geolocation field type is available on the SharePoint list, a map view can be created wither programmatically or from the SharePoint UI.

In the list, SharePoint 2013 displays the location on a map powered by Bing Maps.

In additions, a new view type named Map View displays the list items as pushpins on a Bing Maps Ajax control V7 with the list items as card on the left pane.

Page 10: Using SharePoint's Geolocation Field - SPSUK 2014

Map View

A map view provides three colors of pushpins, each of which provides a

difference user experience. A pushpin on the map has the same color as the

pushpin of the matching item in the left pane.

Orange Indicates that the Geolocation field for the item is mapped with the Bing

Maps services.

Grey Indicates that the Geolocation field for the item is empty. The item cannot

be mapped with Bing Maps services, so no pushpin for this item appears on the

map.

Blue When a user hovers over a list item, the pushpin color changes from orange

to blue. Both the pushpin in the left pane and the matching pushpin on the map

change color

Page 11: Using SharePoint's Geolocation Field - SPSUK 2014

Create a Map View Programmatically

class Program{

static void Main(string[] args){

CreateMapView ();Console.WriteLine("A map view is created successfully");

}

private static void CreateMapView(){

// Replace <Site URL> and <List Title> with valid values.ClientContext context = new ClientContext("<Site Url>");List oList = context.Web.Lists.GetByTitle("<List Title>");ViewCreationInformation viewCreationinfo = new ViewCreationInformation();

// Replace <View Name> with the name you want for your map view.viewCreationinfo.Title = "<View Name>";viewCreationinfo.ViewTypeKind = ViewType.Html;View oView = oList.Views.Add(viewCreationinfo);oView.JSLink = "mapviewtemplate.js";oView.Update();context.ExecuteQuery();

}}

Page 12: Using SharePoint's Geolocation Field - SPSUK 2014

Extending the Geoloaction field in a Content

Query Webpart

Shows how to show the Map in a Content Query Web Part

Gives some good examples on changing the format of the Map View, such as

zoom level

http://pafederwitz.wordpress.com/2014/08/19/using-cqwp-to-display-

sharepoint-geolocation-field/

Page 13: Using SharePoint's Geolocation Field - SPSUK 2014

Geolocation field example scenarios

Councils - Pot Hole reporting

Construction company / Oil rig – Health and Safety reporting

Logistics – vehicle tracking

Customer location heat maps

Statistical Reporting

Photo location Tagging

Office Locations

Power BI?

Page 14: Using SharePoint's Geolocation Field - SPSUK 2014

Power Map

Excel Formulas:

Lattitude: =MID(F2,FIND(" ",F2,10), FIND(")",F2) - FIND(" ",F2,10))

Longitude: =MID(F2,8,FIND(" ",F2,10)-8)

Page 15: Using SharePoint's Geolocation Field - SPSUK 2014

Geolocation “niggly” bits

Field is not indexed by search

Cannot “paste” list data into Quick Edit mode

Bing Maps only

You have to pay for a Bing Maps license

Page 16: Using SharePoint's Geolocation Field - SPSUK 2014

Links

Integrating location and map functionality in SharePoint 2013 http://msdn.microsoft.com/en-us/library/office/jj163135(v=office.15).aspx

Create a map view for the Geolocation field in SharePoint 2013 http://msdn.microsoft.com/en-us/library/office/jj656773(v=office.15).aspx

Getting started with the new Geolocation field in SharePoint 2013 http://zimmergren.net/technical/sp-2013-getting-started-with-the-new-geolocation-field-in-sharepoint-2013

Add a GeoLocation Field to SharePoint Online using PowerShell http://sharepointryan.com/2013/08/12/add-a-geolocation-field-to-sharepoint-online-using-powershell/

Geolocation field in SharePoint 2013 http://www.sharepoint2013.me/Blog/Post/146/Geolocation-field-in-SharePoint-2013

Using Content Query Web Part to display SharePoint Geolocation Field

http://pafederwitz.wordpress.com/2014/08/19/using-cqwp-to-display-sharepoint-geolocation-field/

Page 17: Using SharePoint's Geolocation Field - SPSUK 2014

Thank You to Our Sponsors!