Hi there,
There are a couple of ways you can achieve this, so my way is not necessarily the only way or the best way.
That said, this is how I do it;
[EDIT:
I changed the URL format to allow Bing to auto-centre and auto-zoom to show all points
This allows Bing to autocentre and autozoom for you]
If you consider the map URL, there are three parts - a fixed beginning (or prefix), a variable body with the pins and then a fixed ending (or suffix).
URL example:
https://dev.virtualearth.net/REST/v1/Imagery/Map/Road?mapSize=500,500&pp=47.63156378,-122.20375238;26;Label&pp=47.61031576,-122.19883025;26;Label&key=[yourAPIkey]
The fixed prefix is
"https://dev.virtualearth.net/REST/v1/Imagery/Map/Road?mapSize=500,500"
The variable body is each pushpin, which may have one or multiple of the following;
"&pp=latitude,longitude;icon;label"
"&pp=latitude,longitude;icon;label"
"&pp=latitude,longitude;icon;label"
...
And the fixed suffix is your key at the end of the URL
"&key=[yourAPIkey]"
So to dynamically build this from data, the idea would be to build the string piece by piece, iterating the middle piece for your data, and then put the pieces together into one URL at the end.
For this example, I'm going to assume you've allocated an icon to each user manually and placed that data into your table - how you choose to do this may vary, I just collect the data into a collectIcons collection and added an "icon" column where I arbitrarily decided Kevin would get one icon (26) and Dave another (27).
ClearCollect(collectIcons, AddColumns(Source, "icon", If(name="Kevin", 26, name="Dave", 27, "false")))
You could also build an If(name="Kevin", 26, name="Dave", 27) logic directly into your formula, but to keep it simple I'm going to assume you've put it into your table.
Next, contruct the prefix:
UpdateContext({strPrefix: "https://dev.virtualearth.net/REST/v1/Imagery/Map/Road?mapSize=500,500"})[Edit: I've changed the URL to exclude a static centre point and zoom level, so you don't have to do anything else, Bing will auto-centre and auto-zoom for you.]
Then the variable body of pushpins - here I create a concatenated variable based on the rows of the table as follows;
UpdateContext({strPoints: Concat(collectIcons, "&pp=" & latitude & "," & longitude & ";" & icon & ";" & name)})latitude, longitude, icon and name are all columns in my collectIcons collection. The Concat function let's me add rows of data together into one long string and place the result conveniently into a variable. my strPoints variable now looks like this;
&pp=47.63156378,-122.20375238;26;Kevin&pp=47.61031576,-122.19883025;26;Kevin&pp=47.79679871,-122.01410675;26;Kevin&pp=47.56910516,-122.11846989;26;Kevin&pp=47.56875563,-122.11540806;26;Kevin&pp=47.53805161,-122.39715576;27;Dave&pp=47.72306,-122.35329;27;Dave&pp=47.60911213,-122.28940197;27;Dave&pp=47.57616,-122.22172;27;Dave&pp=47.6665352,-122.30149344;27;Dave
Then you construct the suffix, which is easily enough just your bing maps Key;
UpdateContext({strSuffix: "&key=[yourAPIkey]"})Lastly, you pull it all together into the URL string you will use for your image;
UpdateContext({imageURL: Concatenate(strPrefix, strPoints, strSuffix)})so my imageURL variable now looks like this;
https://dev.virtualearth.net/REST/v1/Imagery/Map/Road?mapSize=500,500&pp=47.63156378,-122.20375238;26;Kevin&pp=47.61031576,-122.19883025;26;Kevin&pp=47.79679871,-122.01410675;26;Kevin&pp=47.56910516,-122.11846989;26;Kevin&pp=47.56875563,-122.11540806;26;Kevin&pp=47.53805161,-122.39715576;27;Dave&pp=47.72306,-122.35329;27;Dave&pp=47.60911213,-122.28940197;27;Dave&pp=47.57616,-122.22172;27;Dave&pp=47.6665352,-122.30149344;27;Dave&key=[yourAPIkey]
Unfortunately I have to wrap it in the codeblock for this post, otherwise it get's treated like a hyperlink and gets cut off.
You can then set the Image property of your image to imageURL. I edited my reply to change the URL from a fixed zoom and centrepoint to a BING-defined one - to show the difference between the two I've include both images below;
OLD IMAGE WITH MANUAL STATIC CENTREPOINT
NEW IMAGE WITH AUTO-ZOOM AND CENTRE
Hope this helps 🙂
Kind regards,
RT