I need help with code to add Multiple Map Pins onto a Google Map.
OnSelect will launch the Google Map outside of the PowerApps.
I am currently using the following code to launch Google Maps with the address of the selected item(Account) in BrowseGallery1 with the DataSource of AcctMain:
Now I need to launch Google Maps with the addresses of all items(Accounts) in BrowseGallery1 with the DataSource of AcctMain.
Any help would be greatly appreciated. Thanks, Marc...
Solved! Go to Solution.
Hi @BrianJ. Without getting into the code very deep...
Keep hackin' you'll get it 🙂
Ok I got this code working by clicking on the date in the List box. But I would like foe a marker to show for each address that is in the list box.
"https://maps.googleapis.com/maps/api/staticmap?center=formatpng&markers=color:red%7C" & EncodeUrl(ListBox1_1.Selected.Result) & "&size=" & txtImageWidth & "x" & txtImageHeight & "&key=" & txtGoogleMapsKey.Text
I'm not real sure if a list box is my best option. Attached is a screenshot of what I am working with.
Hi @BrianJ. Nice looking app!
Maybe try changing the ListBox out for a Gallery. Then try:
Filter( Inventory, Address exactin Gallery.AllItems.address ),
Where Gallery.AllItems.address is the text box in your gallery displaying the address. You might have to use Gallery.AllItems.address.Text (or it might not work at all!). I'm more of a hands-on PowerApper. Its difficult for me to recall solutions without trying various things.
Hope this helps!
@ericonline I changed to a Gallery and add your suggestion but I am now getting this error
"Invalid argument type (Table). Expecting a Text value instead."
Here is the code.
"https://maps.googleapis.com/maps/api/staticmap?center=formatpng&markers=color:red%7C" & EncodeUrl(Gallery1.AllItems.lblAddress) & "&size=" & txtImageWidth & "x" & txtImageHeight & "&key=" & txtGoogleMapsKey.Text
Hi @BrianJ. I had a few minutes to look at @luuminhvuong93's solution. His is different than what you're trying to do. He's filtering a Collection by something (say Agent Name in your case) and returning an array of Lat/Longs. I googled "multiple markers google maps by address". Of the two writeups I looked at, both are ALSO using Lat/Longs.
You'll have to do some more research and see if its possible to pass Google Maps multiple Addresses at once or if you need to geocode them first (get Lat Longs) then supply the API those instead.
I am looking for multiple pins with google o bing maps. I have find midle of a "solution" maybe you can help me.
I give you the solution for 1 pin with google maps and gallery
( i prefer google maps because the zoom work good. With bing the zoom in a static map its crazy)
My gallery have a item "Address" with a inputtext "Subtitle2_1 ".
I enter the Street, city .. like this : "7s9s Technology Way, Denver, co 80237"
In a picture :image: "https://maps.googleapis.com/maps/api/staticmap?center="
& Substitute(Subtitle2_1.Text; " "; "+") & "&zoom=5 &size=600x600 &key=MyKey &markers=color:red%7Clabel:A%7C" &(Subtitle2_1.Text)
For multiple pins:
If i use gallery.allitems.address not work
If i use this formula its ok :
& "&zoom=13 &size=600x600 &key=MyKez
We need to separate the markers.
Now i am looking for automate the multiple marker.
I try to make a collection and the idea is to select each ID, ID=1, ID=2 with a formula who auto create the line "&markers=color:red%7Clabel:A%7C" &" " and complete with the resulte of the ID=x
But when i test with one markers to call the ID this dont work.
I want to build the same that "mymaps" from google but with my own data directly in powerapps