How do you create a Google map with multiple locations?
Hi,
I want to integrate into my Ninox database a Google map to display multiple locations.
Has anyone been able to come up with a functional solution that could be shared here or at least give me some instructions?
Thanks
6 replies
-
Someone created an elegant multi point map which might be of interest to you
follow this thread and the various links
-
and can you share a sample database?
-
Here is the code that I use to create the map for a road trip :
Dynamic image is by calling : html("<img src='" + 'Google URL' + "' />")
Creating the URL for the dynamic image and the static image with the button "Carte"
let pno := 0;
let pointeurs := for p in Programme order by Date do
if Origine = true or
Origine != true and p.text('Lieu final du jour') != p.text(Voyage.'Départ de') then
pno := pno + 1;
"&markers=color:red" + "|label:" + pno + "|" +
urlEncode(text(p.'Lieu final du jour'))
end
end;
'Google URL' := "https://maps.googleapis.com/maps/api/staticmap?" + "center=" + "&zoom=" + Zoom +
"&size=1222x652&scale=2&maptype=" +
text(MapType) +
pointeurs +
"sensor=false&format=jpg&key=" +
first(select settings).'Google Maps API Javascript';
'Map Statique' := null;
'Map Statique' := importFile(this, 'Google URL', "staticmap.jpg") -
After research, I concluded that the Maps Embed API is the easiest way to display an interactive Google map inside Ninox using iframe.
You need to get a Google Cloud API key by following the detailed instructions here: https://developers.google.com/maps/documentation/embed/get-started
I want the best direction between my location and each contact's address in my database. For this, I put the code below into a formula field:
let x := latitude('location field'); let y := longitude('location field'); html("<iframe width=1330 height=630 frameborder=0 style=border:0 referrerpolicy=no-referrer-when-downgrade src=https://www.google.com/maps/embed/v1/directions?key=YOUR_API_KEY&origin=38.031780,23.702418&destination=" + x + "," + y + " allowfullscreen> </iframe>")
You must replace the 'location field', 'YOUR_API_KEY', and the origin parameter.
I've attached the result for you to look over.
Content aside
- Status Answered
- 5 mths agoLast active
- 6Replies
- 278Views
-
3
Following