SharePoint 2013 introduces a new geolocation (for mapping a location) field type that can be used in lists and libraries. By default Bing Maps is used. However, a custom field type can be created with the geolocation base type to use other services like Nokia Maps.

Adding a new geolocation column is currently not available from the SharePoint GUI and must be done through code. This can be done via the SharePoint Object Model to an existing list or through a custom list definition. In addition, using Bing Maps as the mapping provider requires a Bing Maps Key to be set on the farm or web level. This also must be done through code.

Setting the Bing Maps key simply requires a property to be added to the farm or web. Microsoft has a code sample here: http://code.msdn.microsoft.com/sharepoint/SharePoint-2013-Set-the-b5925468. Below is the code used to set the Bing Maps key on an SPWeb object from the Client Object Model in C#:

The field type name is simply “Geolocation”. So adding the field to a custom list definition is done simply with:

Microsoft has a code sample illustrating how to add the field programmatically to an existing list: http://code.msdn.microsoft.com/sharepoint/SharePoint-2013-Add-a-d3fa8288. Below is the C# code used to add the field to an existing list:

Microsoft also has a code sample illustrating how to extend the Geolocation field type to use a custom maps provider (in this case Nokia Maps) here: http://code.msdn.microsoft.com/sharepoint/SharePoint-2013-Create-a-d9a91551.

Hopefully you find the new geolocation field useful.


Pin It on Pinterest

Share This
%d bloggers like this: