Add an image to a map marker description

394 views
Skip to first unread message

Giorgio Borgonovo

unread,
Jul 25, 2019, 9:22:54 AM7/25/19
to MIT App Inventor Forum
Hi,
I'm trying to show an image in the InfoBox description of a marker in a map. I see it takes html tags but I cannot use html to show the image.
Is img tag disabled?

If so, I would like to add a link in the InfoBox description and open it somewhere in the application (I'm thinking of a webViewer), but I'm not able to catch the link url when clicked and to fire it to the webView.

Someone can help me, please?

Thank you

Giorgio

SteveJG

unread,
Jul 25, 2019, 9:50:07 AM7/25/19
to mitappinv...@googlegroups.com
You probably cannot do this Giorgio.    What can be done is described here  Marker
      
You can provide a link in the Marker.Description using Blocks showing text but it will be text, not a linkable html.  The text will display within a Marker.InfoBox but will not be clickable.  Clicking the InfoBox cannot be used to elicit a WebViewer (the InfoBox itself has no event handler click event).   Have you thought about writing  Blocks so that when a user clicks on a specific Marker that action elicits a WebViewer pointing to a Web page that shows your image (or to an Image component that would display an image stored on the device)?  Use the when Marker.Click or Marker.LongClick do  block.

You can also use a Custom Marker where the marker itself is a small image instead of a pin.

Does that help?


Regards,
Steve

TimAI2

unread,
Jul 25, 2019, 10:11:24 AM7/25/19
to MIT App Inventor Forum
You can change the marker to an image and back again, see attached video, which includes the blocks, the image is hosted on google drive
marker-image.webm

Giorgio Borgonovo

unread,
Jul 25, 2019, 10:34:11 AM7/25/19
to MIT App Inventor Forum
Thank you Steve.
Yes, it was the Plan C, and with your confirm I'll give it a try.
Thank you again,
Giorgio

Giorgio Borgonovo

unread,
Jul 25, 2019, 10:34:42 AM7/25/19
to MIT App Inventor Forum
Brilliant, Tim.
Even if it is not exactly what I was looking for I want to try it to see how it looks like.
Thank you
Giorgio

SteveJG

unread,
Jul 25, 2019, 10:39:57 AM7/25/19
to MIT App Inventor Forum
:)   Try the attached Giorgio  .   The aia shows three things you can do  (one is similar to the example provided by Tim) to display an image.

-Steve



ClickMapMarker.aia

TimAI2

unread,
Jul 25, 2019, 10:48:45 AM7/25/19
to MIT App Inventor Forum
You may also want to have a look at this thread, where you can place an image inside the marker itself.

Giorgio Borgonovo

unread,
Jul 26, 2019, 6:20:41 AM7/26/19
to MIT App Inventor Forum
At the end I used this solution.

The WebViewer is not visible.
When Marker.click I make the WebViewer visible and the Map not visible.
The Map has a (close) button to reverse the visibility.

If the description begins with "FILE", the infobox is not enabled and I load a page from my server with the html for that point, so I can have the title, image, description and so on...
otherwise I show the infobox with the usual text (short) description.

It works well.

Thank you for the help!

ABG

unread,
Jul 26, 2019, 11:35:48 AM7/26/19
to MIT App Inventor Forum

TimAI2

unread,
Aug 4, 2019, 5:21:23 PM8/4/19
to MIT App Inventor Forum
I had also forgotten about the method used in the example below, using the map features event
This enable the grabbing of the text in the Description (Infobox) and if a url to use it. Same could be done with an image

Reply all
Reply to author
Forward
0 new messages