Display line geometry in a SharePoint List using ESRI Maps for SharePoint

A while ago I was asked to find out how to display line geometry on a map using SharePoint lists. After some creative googling, I came across an ESRI thread, and another one, which pointed me in the right direction. This example uses a single line feature to demonstrate the methodology I developed.

In ArcGIS:

  1. Convert the line feature to JSON using the tool or using Python (my preferred method):

    # @date 29/04/2015
    # @author Cindy Williams
    # Converts geometry in a feature class to JSON,
    # and writes it to a CSV file.
    # For use in the Python window in ArcCatalog.
    import arcpy
    arcpy.env.workspace = r"C:\Some\Arb\Folder"
    lyr = arcpy.management.MakeFeatureLayer("work.gdb\ftr_line")
    outcsv = r"line_json.csv"
    # Get geometry of first feature as JSON
    lyr_json = arcpy.da.SearchCursor(lyr, "SHAPE@JSON").next()[0]
    # Write JSON to CSV
    with open(outcsv, 'wb') as csvw:

    Of course you can save the file immediately as a JSON file, but I am so used to writing it out to CSV that I automatically put that there.

In your SharePoint site:

  1. Create a custom list (or open your existing one).
  2. Add a plain text column called Shape of type Multiple Lines (not sure if this is a requirement, but I figured it couldn’t hurt). As mentioned in the thread, the column must be created with the correct title – renaming an existing column will not work.
  3. Add a ESRI Maps Location column to the list. Under Location Settings > Coordinate Fields, select Shape. The field dropdown should automatically populate the Shapecolumn we added earlier.
  4. Start editing your list.
  5. Create a new record in your list, and populate your attributes. Copy the JSON string from the file created earlier and paste it into the Shape column.

Here is the result (click to enlarge):


JSON representation of a line in a SharePoint list using ESRI Maps for SharePoint

This is a nice way of storing commonly accessed features such as study area boundaries, in a central list without a dependency on map services hosted on ArcGIS Server or ArcGIS Online.

2 thoughts on “Display line geometry in a SharePoint List using ESRI Maps for SharePoint

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 )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.