SharePoint 2013 now offers a so called geolocation field. This field provides a new field of type geolocation where users can input longitude and latitude of a point of interest like office locations or customer locations, etc.
4 Tipps you should know:
Before you can use it, you should know that it’s not available in the choice of column types. You have to setup the field using Powershell or any other script.
[sourcecode language=”csharp”]
Add-PSSnapin Microsoft.SharePoint.PowerShell
$web = Get-SPWeb “http://servername/sites/sitecollection”
$list = $web.Lists[“My Offices”]
$list.Fields.AddFieldAsXml(
“
$true,
[Microsoft.SharePoint.SPAddFieldOptions]::AddFieldToDefaultView)
[/sourcecode]
In order to use the field, a bing maps key has to be add to the farm or the site collection by using Powershell or Javascript or any other script.
[sourcecode language=”csharp”]
//for the farm
Set-SPBingMapsKey -BingKey “yourBINGmapsKEY”
//for a site collection
Add-PSSnapin Microsoft.SharePoint.PowerShell
Get-SPWeb “http://server/sites/sitecollection”
$web.AllProperties[“BING_MAPS_KEY”] = “yourBINGmapsKEY”
$web.Update()
[/sourcecode]
It is necessary to install a special software component to use the geolocation field. It’s a MSI-Package named “SQLSysClrTypes.msi – Here you find more information.
You can put your data manually by typing or you use a .csv file where the coordinates are included or using automatically scripts to insert the locations you like.
[sourcecode language=”csharp”]
$item[“Office Location”] = “POINT (Longitude Latitude)”
[/sourcecode]
Another good source of resource is the post of Tobias Zimmergren with examples and pictures.
..:: I LIKE SHAREPOINT ::..
Leave a Reply
You must be logged in to post a comment.