当前位置:网站首页 > 更多 > 玩电脑 > 正文

[玩转系统] SharePoint 2013 中带有地理位置列的 Bing 地图

作者:精品下载站 日期:2024-12-14 13:41:18 浏览:13 分类:玩电脑

SharePoint 2013 中带有地理位置列的 Bing 地图


SharePoint 2013 引入了名为“地理位置”的新功能作为字段类型,以在 SharePoint 列表中启用基于位置的数据。所以通过GeoLocation字段,我们可以给用户带来“地图”体验。 默认情况下不启用地理位置字段类型。我们必须进行一些配置才能使其在 SharePoint 2013 中可用。

以下是在 SharePoint 2013 中启用地理位置字段的摘要步骤:

  1. 注册 Bing 地图密钥
  2. 在 SharePoint 中设置 Bing 地图键
  3. 以编程方式将地理位置列添加到 SharePoint 网站/列表。
先决条件:
您需要在每个 SharePoint 前端 Web 服务器上安装 SQLSysClrTypes.msi,才能实现 SharePoint 2013 GeoLocation-Bing 地图功能。因此,从以下位置下载并安装“SqlSYsCLRTypes.msi”:https://www.microsoft.com/en-us/download/details.aspx?id=29065(对于 SQL Server 2012。)

第 1 步:获取 Bing 地图密钥

通过在 https://www.bingmapsportal.com 注册来获取 Bing 地图密钥。就我而言,这是我通过单击“创建或查看密钥”创建的内容。

[玩转系统] SharePoint 2013 中带有地理位置列的 Bing 地图

单击“提交”后,您将收到一条消息“密钥创建成功”,密钥在表单下方列出。

[玩转系统] SharePoint 2013 中带有地理位置列的 Bing 地图

步骤 2:在 SharePoint 2013 中设置 Bing 地图密钥

登录到您的 SharePoint Server,从 SharePoint Management PowerShell 输入:

Set-SPBingMapsKey -BingKey“”

这会在场级别设置 Bing API 密钥。还可以在 Web 应用程序级别设置 Bing 地图密钥。

步骤 3:将地理位置字段添加到 SharePoint 网站/列表

不幸的是,没有 UI 方式可以将地理位置列添加到 SharePoint 网站或列表!那么,让我们使用 PowerShell 以编程方式完成此操作。


Add-PSSnapin Microsoft.SharePOint.PowerShell

#SharePoint Site URL to add Geolocation field
$webURL = "https://sharepoint.crescent.com/"

#Field definition for Geolocation  
$fieldXml = "<Field Type='Geolocation' DisplayName='Location' />"

#Get the Web 
$web = Get-SPWeb $webURL

#Add field to the Web
$web.Fields.AddFieldAsXml($fieldXml,$true,[Microsoft.SharePoint.SPAddFieldOptions]::Default)

这会将“位置”字段添加到提供的 SharePoint 网站。您可以导航到列表设置>>从现有列添加,然后选择自定义列组下的“位置”列。

还可以将地理位置列直接添加到 SharePoint 列表。这是 PowerShell 脚本:


Add-PSSnapin Microsoft.SharePOint.PowerShell

#SharePoint Site URL and List name parameters.
$webURL = "https://sharepoint.crescent.com/"
$ListName = "Project List"

#Field definition for Geolocation  
$fieldXml = "<Field Type='Geolocation' DisplayName='Project Location' />"

#Get the Web & List  
$web = Get-SPWeb $webURL
$list = $web.Lists[$ListName]

#Add the Field to List  
$list.Fields.AddFieldAsXml($fieldXml,$true,[Microsoft.SharePoint.SPAddFieldOptions]::Default)
$list.Update()

#or use: $FieldType = [Microsoft.SharePoint.SPFieldType]::Geolocation
#$List.Fields.Add($columnName, $FieldType, $false)

设置地理位置列值:
现在,您可以通过提供纬度-经度坐标或基于当前位置来输入位置。单击“使用我的位置”链接后,SharePoint 会根据您的 IP 自动设置位置!

[玩转系统] SharePoint 2013 中带有地理位置列的 Bing 地图

地理定位领域正在发挥作用!

[玩转系统] SharePoint 2013 中带有地理位置列的 Bing 地图

地图视图
地理位置功能还提供了另一个功能:地图视图,它为标记的位置提供地图布局。只需为您的列表/库创建一个新视图>>选择“地图视图”

[玩转系统] SharePoint 2013 中带有地理位置列的 Bing 地图

结果如下:

[玩转系统] SharePoint 2013 中带有地理位置列的 Bing 地图

要将地理位置列添加到 SharePoint Online,请参阅:如何使用 PowerShell 将地理位置(Bing 地图)字段添加到 SharePoint Online 列表?

您需要 登录账户 后才能发表评论

取消回复欢迎 发表评论:

关灯