Maps in PowerApps

This post outlines how to render address information on a map using PowerApps.  We will utilize SharePoint Online as the data source. However, keep in mind that you could opt for other (growing number of) sources, e.g.: Salesforce, Dynamics CRM Online, etc.

Quick Disclaimer –  At the time of writing this post, PowerApps is in Public Preview, so PowerApps’ features and accuracy of this post are subject to change.

Prep Work:

  1. Find a REST service to render your map. For this post, we’ll leverage Bing Maps:
    • Documentation and Requirements:
    • There are tons of options you could explore with Bings. To keep it simple and use plain address fields, let’s use this service:
      https://dev.virtualearth.net/REST/V1/Imagery/Map/Road/
      [YourAddressSpaceDelimited]?key=[YourBingMapKey]
    • Confirm your REST endpoint by going to the URL using a web browser
  2. Get the data source ready
    • Since SharePoint Online serves the underlying data for this example, I have created a plain-vanilla-custom-list, then added out-of-box address-related site columns.
    • Record the internal field names for all of your Address Fields

Steps in PowerApps Studio

  1. Open PowerApps Studio (currently available only for Windows 10 & 8.1)
  2. Create a New app and connect to your data source
  3. If you have connected to the data source correctly, some of your content should surface immediately
  4. Click on DetailScreen1 on left navigation pane, to display a single record view
  5. Click “Add a custom card” in the form design
  6. Select the Insert Tab then click on “Image”
  7. At this point, you should see the landscape icon in your Form.  If so, we will now construct our Bing Map onto this image.
  8. Go to the function (fx) text box to replace “SampleImage” with the REST Endpoint URL combined with the SharePoint internal field names, using the PowerApps Concatenate function.
  9. If you have done it correctly, the map should render almost instantly in Design mode.  A few additional notes:
    • Since this REST method separates the address with space, we are constructing a ” ” in our formula
    • PowerApps auto-populates field names in the function text box so you could easily confirm if you have the correct SharePoint internal field names

And there you have it! Hopefully straightforward.  Please leave comments with your thoughts and feedback.

Very much looking forward to the exciting things coming out of the labs of the MS Product Team and the magic our community creates out of this very promising product.

Advertisements

6 responses to “Maps in PowerApps

  1. Hi, I’m trying this and I’m not receiving any errors but my maps are not rendering at all. This is my formula
    Concatenate(“https://dev.virtualearth.net/REST/V1/Imagery/Map/Road/”, Address_x0020_Line_x0020_1, ” “, Address_x0020_Line_x0020_2, ” “, City, ” “, County, ” “, “Postcode”, “?key=MyBingmapsKey”)

  2. How can I show on the map all the values in a certain column on an Excel sheet that is already linked as a data source on one drive?

    I want the map to show all the cities in that column

    Cheers

    • @wi you would swap the connection. Instead of using SharePoint, point the connection to the OneDrive that hosts your Excel. From there, your Address columns would get exposed as data fields and it should be the same steps from there. Hope this helps. Good luck!

      • I already connected the data source but I’m not very familiar on how to make the map show multiple values i.e. all the values that are in that column. I so far only managed to make it show the most recent value entered.
        so how should the code look like if the excel sheet is called “siteinspector” and the column I want its values to be shown on the map is called “city”

        (Forgive my ignorance but I’m only starting to learn all about coding just now)

        So far your instruction definitely helped me mapping each entry on its own so thank you for that but now I want to add a screen that shows the entire cities from all entries.

        Many thanks in advance!

  3. @wi You should be able to do that using a different REST end point. You can see some examples here using longitude and latitude https://msdn.microsoft.com/en-us/library/ff701724.aspx#Examples Good luck and please share your finding

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