How do I create a UI map

Create a map view for the Geolocation field in SharePoint

  • 5 minutes to read

Learn how to display location information in SharePoint using a map view. You can manually or programmatically create a map view using the SharePoint user interface (UI) with the new field type for Geolocation create. SharePoint introduces a new field type called Geolocationthat allows you to annotate SharePoint lists of location information. For example, you can now make "location-based" contains and display latitude and longitude coordinates via Bing Maps. An entry is typically thought of as a PIN on a map view. Learn how to display location information by using a map view in SharePoint lists. You can create a map view manually via the SharePoint user interface (UI) or programmatically by using the new Geolocation field type. SharePoint introduces a new field type named Geolocation that enables you to annotate SharePoint lists with location information. For example, you can now make lists "location-aware" and display latitude and longitude coordinates through Bing Maps. An entry is typically seen as a pushpin on a map view.

To view a map view in a SharePoint list, you must use the Bing Maps services. The Geolocation -Field is not available when creating a list through the user interface. Instead, this field must be inserted programmatically. For information about rendering and working with this type of data programmatically, see Integrating Location and Map Capabilities with SharePoint. The field Geolocation and map view, you can provide spatial context for all information by integrating data from SharePoint into a map in web and mobile apps. This article does not explain how to use the field Geolocation render or contain instructions for developers to create a mobile location-based application; It provides instruction programmatically to create map views using Bing Maps and from the SharePoint UI. The Geolocation field is not available when you create a list by using the UI. Instead, this field must be inserted programmatically. For information about how to render and work with this data type programmatically, see Integrating location and map functionality in SharePoint. The Geolocation field and the map view enable you to give spatial context to any information by integrating data from SharePoint into a mapping experience in web and mobile apps. This article does not explain how to render the Geolocation field or provide developer guidance for creating a location-based mobile application; it does provide instruction for creating map views programmatically and from the SharePoint UI by using Bing Maps.

You must install an MSI package named SQLSysClrTypes.msi on each SharePoint front-end web server in order to Geolocation- Display field values ​​or data in a list.An MSI package named SQLSysClrTypes.msi must be installed on every SharePoint front-end web server to view the Geolocation field value or data in a list. This package installs components that implement the new geometry, geography, and hierarchy ID types in SQL Server 2008. By default, this file is installed for SharePoint Online. However, it is not installed for an on-premises deployment of SharePoint You must be a member of the Farm Administrators group to perform this operation. For information about how to download SQLSysClrTypes.msi, see Microsoft SQL Server 2008 R2 SP1 Feature Pack for SQL Server 2008 or under Microsoft SQL Server 2012 Feature Pack for SQL Server 2012 in the Microsoft Download Center. To download SQLSysClrTyp es.msi, see Microsoft SQL Server 2008 R2 SP1 Feature Pack for SQL Server 2008, or Microsoft SQL Server 2012 Feature Pack for SQL Server 2012 in the Microsoft Download Center.

Prerequisites for creating a map view

  • Access to a SharePoint list, with sufficient privileges to create a view.

  • A list of SharePoint that started with the Geolocation Column contains A SharePoint list that contains a Geolocation column

  • A valid Bing Maps key set at the farm or web level, which can be obtained from the Bing Maps Account Center

    Important: You are responsible for complying with the terms and conditions applicable to your use of the Bing card key and for all necessary publications to users of your application regarding data transmitted to the Bing data service.Important: You are responsible for compliance with terms and conditions applicable to your use of the Bing Maps key, and any necessary disclosures to users of your application regarding data passed to the Bing Maps service.

  • Visual Studio 2012 or Visual Studio 2010

What is a map view?

A map view is a SharePoint view that shows a mapping (using data from the Bing Maps service), latitude and longitude entries from the Geolocation -Use field type. If the field type Geolocation is available on the SharePoint list, a map view can be created either programmatically or through the SharePoint UI. In the list, SharePoint shows the location on a map supported by Bing Maps. In addition, there will be a new type of view named Map view A map view is a SharePoint view that displays a map (with data obtained from the Bing Maps service), using longitude and latitude entries from the Geolocation field type. When the Geolocation Field type is available on the SharePoint list, a map view can be created either programmatically or from the SharePoint UI. In the list, SharePoint displays the location on a map powered by Bing Maps. In addition, a new view type named Map View displays the list items as pushpins on a Bing Maps Ajax control V7 with the list items as cards on the left pane.

Note

Each SharePoint list can have up to two Geolocation- columns included. You can't get a third Geolocation-Add column to the same list Geolocation columns in it; you won't be able to add a third Geolocation column in the same list. A map view can only be one Geolocation- Column included.A map view can have only one Geolocation column. You can have multiple map views with different GeolocationYou can create multiple map views with different Geolocation columns.

Create a map view from the SharePoint UI

The following steps demonstrate how to create a map view from the SharePoint UI.

  1. Open the SharePoint list with Geolocation -Column. Open the SharePoint list with Geolocation column.

  2. Select ECB in the (Edit Control Block) menu Create a viewas shown in Figure 1. Choose Create view from the ECB (Edit Control Block) menu, as shown in Figure 1.

    Figure 1. Creating a view from the ECB menuFigure 1. Creating a view from the ECB menu

  1. Select on the side Select a view of the typeMap viewas shown in Figure 2. On the Choose a view type page, choose Map View, as shown in Figure 2.

    Figure 2. Selecting a type of viewFigure 2. Choosing a view type

  1. After you choose a view type, you can select various fields to display in the map view, as shown in Figure 3.

    Figure 3. Selecting fields for a map viewFigure 3. Choosing fields for a map view

  1. After adding the required Geolocation dar and the other fields you need, choose OK. A map view will be created as shown in Figure 4 Geolocation field and any other field you need, choose OK. A map view is created, as shown in Figure 4.

    Figure 4. Full map viewFigure 4. Completed map view

Create a map view programmatically

Follow these steps to create a map view for a SharePoint list programmatically.

  1. Start Visual Studio. Start Visual Studio.

  2. On the menu bar, select the options File, new project out. The dialog box New project Opens. On the menu bar, choose File, New Project. The New Project dialog box opens.

  3. Click in the dialog box New project choose c # in The Field Installed templates, and then choose the template Console application.In the New Project dialog box, choose C # in the Installed templates box, and then choose the Console application template.

  4. Name the project, and then choose the button OKGive the project a name, and then choose the OK button.

  5. Visual Studio creates the project. Add a reference to the following assemblies and select OKVisual Studio creates the project. Add a reference to the following assemblies, and choose OK.

  • Microsoft.SharePoint.Client.dllMicrosoft.SharePoint.Client.dll

  • Microsoft.SharePoint.Client.Runtime.dllMicrosoft.SharePoint.Client.Runtime.dll

  1. Add a policy using In the default .cs file, add a using directive as follows.

  2. Add the following code to the MainMethod in the CS file Main method in the .cs file.

    Note

    The JSLink property is not supported for poll or event lists. A SharePoint calendar is a list of events. The JSLink property is not supported on Survey or Events lists. A SharePoint calendar is an Events list.

  1. Replace and with valid values.

  2. Navigate to the list. You should see a newly created view with the name you provided in the previous code. You should be able to see a newly created view that has the name you specified in the preceding code.

Understand color-coded pushpins in a map view

Display a card providing three colors of thumbtacks (as shown in Figure 5), each of which provides a different user interface. A map view providesthree colors of pushpins (as shown in Figure 5), each of which provides a difference user experience. A pushpin on the map has the same color as the pushpin of the matching item in the left pane.

  • orange Indicates that the field Geolocation associated with the item with the Bing Maps services.orange Indicates that the Geolocation field for the item is mapped with the Bing Maps services.

  • Gray Indicates that the field Geolocation for the item is empty. The item cannot be associated with Bing Maps services, so a PIN for that item will not appear on the map.Gray Indicates that the Geolocation field for the item is empty. The item cannot be mapped with Bing Maps services, so no pushpin for this item appears on the map.

  • blue When a user hovers over a list item, the PIN changes from orange to blue. Change the PIN in the left pane and the corresponding PIN on the color cardBlue When a user hovers over a list item, the pushpin color changes from orange to blue. Both the pushpin in the left pane and the matching pushpin on the map change color

Figure 5. A map view with different pin colorsFigure 5. A map view with different pushpin colors

After you've created a map view, all elements are shown as pins. The user can get more information about an item by hovering a pushpin as shown in Figure 6. The user can get more information about an item by hovering over a pushpin, as shown in Figure 6.

Figure 6. User experience with thumbtacks in a map viewFigure 6. User experience of pushpins in a map view

See alsoSee also