Geolocalization field

SharePoint 2013 has a hide field that allows to show a geolocalization position in a Bing maps. Is possible to add this field to any list or library by Powershell, but it’s not posible to add it by the user interface. So let’s go on!

To add the geolocalization map, we have to execute the following PowerShell code:

$web = Get-SPWeb "http://urlappweb"

$list = $web.Lists["[ListName]"]

$list.Fields.AddFieldAsXml( "<Field Type=´Geolocation´ DisplayName=´[FieldNameToShow]´/>", $true, [Microsoft.SharePoint.SPAddFieldOptions]::AddFieldToDefaultView)

We have to modify the fields: “urlappweb” “Listname” and “Fieldnametoshow”

Once this PS has been executed, we could see that the following field has been added to the list, and if we click on it, it shows the following:

1g

If we click “Especify Location”, it shows a popup were we need to specify latitude and longitude of the position

2g

In other hand, if we use the option “Use my localization”, it will detect the position where we are working (very nice 🙂 )

Once the geolocalization point it has been added, it is posible that when we try to show the localization in the map we receive the following message “The specified credentials are not valid”, so if you are in this step, keep Reading.

We need to do additional steps, first of them, it’s that we need to have a Bing Maps account. It is possible to obtain a free account as a Developer

3g

It will be necessary to complete the form, and once it has been click on submit, we will receive on the screen the Bing Keys.

If we want to actívate the bing maps for all the webaaplication on the farm, type the following:

Set-SPBingMapsKey -BingKey "BingKey"

Or if you want to actívate the bing maps to a specific webapp, type the following:

$web = Get-SPWeb "webappurl"

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

$web.Update()

Once this has been done, it is posible to view a previsualization of the geolocalization field on a list

4g

 

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s