Hey All,
I’m working on an app that includes a Google Maps feature with markers on predetermined locations. When the user clicks on a marker, I want them to be directed to that specific location’s website. For now, all I can do is, using the “when map on calloutpress,” assign one link for all the markers. How do I add different links for each location?
Thanks for your help!
Have you found a solution so far? I’m working on something similar and I’m having the same issue.
here’s one way of handling a markerpress. match the coordinates returned by the get_property calls, to the ACTUAL coordinates defined for the marker in order to determine which marker was pressed. then you can do the desired action.
Is there any other way to do this? I have 85 different markers and this would be way too many pages.
I do this in my app, however, the on Callout clicked does not work on iOS…just saying…
the idea is to keep your marker data in a table (local storage, airtable, firebase) and you would use a loop to go over the stored marker data, obtained as a list, and match that against the latitude and longitude values returned by the marker press block. you just have to make sure that values used in defining the markers are exactly the same values stored in the table, or if you want fuzzy matching, you may have to round down the to values to 2 or 1 decimal place/s.
This is a cool idea! But what OP was asking about is how to handle onCallOutPress and not onMarkerPress
i thought the requirement was for a specific marker?
You’re probably right. I must have misread the post in haste. I now see that’s what they could use.
Oh my, I suppose I’m a big noob to all this… can you show a screenshot or an example of what that means? Thanks!
here i made an example app from my demo by adding an airtable and search for url on markerpress then view the url in webview
this is what my airtable looks like:
note: lonlat is a concatenation of the absolute value of longitude with latitude (with the assumption that all latitude values are never more than 100, which applies to continental US). on marker press, i recompute this from the returned lat and long returned from markerpres so that i will do a search on one column only (ie. lonlat) instead of matching latitude and longitude… ( i’m not sure if it really saves any time!)
and the app in action:
here’s a copy of the project (with api and database id blanked out)
https://x.thunkable.com/copy/1a7bc591e787af454e2b6ae1d8fec5bd
This looks great @manyone,
Thanks for sharing!
This is cool. I still wonder about “onCalloutPress”. This does nothing for me on iPhone.
Does anyone have a working example of some action occurring onCallOutPress
OnMarkerPress works just fine for me.
Hi Jared, this was the issue I reported earlier on the thread.
OnCalloutPressed does not work on iOS - the event does not contain the native event which is needed to get the location.
Android is fine for this.