Back to column formats
Column formattingSharePoint Online

Location Bing Maps

This sample demonstrates how to use a Location column to display details and a Map from Bing.

Location Bing Maps formatting preview
Sample preview · View original animation

Copy. Apply. Make it yours.

Get this format

1 definition

Review the requirements below, then paste this JSON into the matching formatting panel. Show me where.

Use your list's internal column names and replace any tenant-specific URLs or flow IDs. Formatting is presentation, not a way to secure data.

Column formatting
Download JSON
{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "div",
  "children": [
    {
      "elmType": "div",
      "children": [
        {
          "elmType": "div",
          "style": {
            "display": "flex"
          },
          "children": [
            {
              "elmType": "div",
              "attributes": {
                "iconName": "POI",
                "class": "ms-fontSize-20"
              }
            },
            {
              "elmType": "div",
              "style": {
                "min-height": "20px",
                "min-width": "100px"
              },
              "attributes": {
                "class": "ms-fontSize-18 ms-fontColor-themePrimary"
              },
              "inlineEditField": "@currentField",
              "txtContent": "@currentField.DisplayName"
            },
            {
              "elmType": "div",
              "style": {
                "display": "=if(length(@currentField)>0,'','none')",
                "text-decoration": "none",
                "padding-left": "10px",
                "cursor": "pointer"
              },
              "attributes": {
                "iconName": "OpenInNewWindow",
                "class": "ms-fontSize-18 ms-fontColor-themePrimary"
              },
              "customCardProps": {
                "openOnEvent": "click",
                "isBeakVisible": true,
                "directionalHint": "bottomCenter",
                "formatter": {
                  "elmType": "div",
                  "style": {
                    "display": "inline"
                  },
                  "children": [
                    {
                      "elmType": "div",
                      "style": {
                        "padding": "5px",
                        "display": "flex"
                      },
                      "attributes": {
                        "class": "ms-bgColor-themePrimary ms-fontColor-white ms-fontWeight-semibold"
                      },
                      "children": [
                        {
                          "elmType": "div",
                          "children": [
                            {
                              "elmType": "div",
                              "children": [
                                {
                                  "elmType": "div",
                                  "txtContent": "='City: '+ @currentField.Address.City"
                                }
                              ]
                            },
                            {
                              "elmType": "div",
                              "children": [
                                {
                                  "elmType": "div",
                                  "txtContent": "='State: '+ @currentField.Address.State"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "elmType": "div",
                          "style": {
                            "padding-left": "20px"
                          },
                          "children": [
                            {
                              "elmType": "div",
                              "children": [
                                {
                                  "elmType": "div",
                                  "txtContent": "='Country: '+ @currentField.Address.CountryOrRegion"
                                }
                              ]
                            },
                            {
                              "elmType": "div",
                              "children": [
                                {
                                  "elmType": "div",
                                  "txtContent": "='Street: '+ @currentField.Address.Street"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "elmType": "a",
                          "style": {
                            "text-decoration": "none"
                          },
                          "attributes": {
                            "iconName": "POI",
                            "href": "='https://www.bing.com/maps/embed?h=800&w=800&cp='+@currentField.Coordinates.Latitude+'~'+@currentField.Coordinates.Longitude+'&lvl=17&typ=d&sty=a&src=SHELL&FORM=MBEDV8'",
                            "target": "_blank",
                            "class": "ms-bgColor-themePrimary ms-fontColor-white ms-fontSize-28"
                          }
                        }
                      ]
                    }
                  ]
                }
              }
            }
          ]
        }
      ]
    }
  ]
}

From the contributor

How to use this sample

Summary

This sample demonstrates how to use a Location column to display details and a Map from Bing.

screenshot of the sample

View requirements

  • This format can be applied to any Location Column.

Sample

Solution Author(s)
location-bing-maps.json André Lage

Version history

Version Date Comments
1.0 May 27, 2022 Initial release

Disclaimer

THIS CODE IS PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.