SharePoint 2013: Geolocation Field

Back in 2007 I needed to implement a map in SharePoint 2003 / 2007 to show locations like HQs. I decided to go with Virtual Earth, now Bing Maps, and use a xml to provide the actual locations I want to show on the map. It worked, but lets just keep at that. Now, with SharePoint 2013, I heard of this field "Geolocation", but I wasn't able to find it anywhere. Of course I searched the Interwebz and found a couple of blogs and possible solutions, but sadly none of the worked 100% for me. So this is how I finally got the Geolocation field.

First, we need a list, so I created a custon list, which looks like this:

Now we need the field, unfortunately I was not able to add it via UI. PowerShell it is.

Add-PSSnapin Microsoft.SharePoint.PowerShell

$web = Get-SPWeb "http://win-51thg297n5l:31132/sites/cinfo"

$list = $web.Lists["Company Locations"]

$fieldXML = "<field displayname="GLoc" type="Geolocation">"

$list.Fields.AddFieldAsXml($fieldXML)

$web.update()

It should look something like this:

When you are adding an item, you have two options for the location data. I picked the first one, but forgot to create a screenshot for that.

As you can see below, you have this little icon. Click on it an a small map will pop up.

An about that little banner telling you, that you need an account. PowerShell.

Add-PSSnapin Microsoft.SharePoint.PowerShell

$web = Get-SPWeb "http://win-51thg297n5l:31132/sites/cinfo"

$web.AllProperties["BING_MAPS_KEY"] = "YOURKEY"

$web.Update()

Something else that is pretty cool: Map View.

The whole process still got some flaws, but I guess that's a problem with the whole cloud-first thing. It seems that SharePoint Online can use this without all this PowerShell stuff. I like this thing, I needed it a long time ago and from time to time, I guess, I will need something like that again. It could be a bit cooler if I could enter a city and Bing would get the coordinates for me, but that is something a workflow of some kind can handle.

SharePoint 2013: Update User Information without User Profile Synchronization Service

SharePoint 2010: Get used Databasesize