I’m trying to pin a location on Google Maps, tied to my CMS collection using Javascript Velo code:
$w.onReady(function () {
$w('#dynamicDataset').onReady( () => {
let currentitem = $w('#dynamicDataset').getCurrentItem();
$w('#googleMaps1').location = {
"latitude": currentitem.latitude,
"longitude": currentitem.longitude,
"description": currentitem.title,
};
} );
} );
But the pin is stuck on Wix Office. I don’t want to use the html frame because I have to pin more than 100 locations.
You should be able to set it without code using the data connect icon on the map element.
Tried that, and set all fields but still stuck on Wix office pin on Preview/Live Mode.
I got this solved using the CMS data connection. The field should be set as an Address field, and I need to retype the address so that it reads the location on Google Map.
Oh, wrong field. That makes sense. I knew it could be done without code!
Good job figuring it out!
1 Like
I have an address field in my collection, but Google Maps only wants to show the wix office or other manually entered addresses. I have Google Maps connected to my collection, dataset and the address field, but it won’t display the hundreds of locations I have in my CMS collection. What am I missing?
I figured it out.
In the dataset settings, I had to set up a filter that makes sure the address field is not empty. (I had one location without an address and it killed the entire map)
2 Likes
Hey Grace - I’m looking to do the same thing. I set it up using the Address - but used the Lat and Long. Should I just use the physical address? Could I see the URL that you used this on?
I also need to connect about 100 locations to a CMS. Right now - only the last entry is showing while the other three (test setup) are hidden.
I used the physical addresses, and the CMS automatically displays the nearest available address. Apologies, the URL is private.
I used it on CMS dynamic page.
Thank you! The address worked over lat and long.
One more question. On the project you built - does the pin link back to the project Dynamic Page? I don’t actually need the map to take the user to the directions of the location. I need the pin to open the project page. I found some instructions about adding a URL column and linking it back to the URL, but when I add a URL column to match the page, all of the pins disappear but one.
@codequeen
The pin opens another browser showing Google Map direction, so I leave it as it is.
Another Wix flaw, i’m afraid.
First, if you can only see 1 address instead of multiple then you have to disconnect the map from the dataset. Set the map settings to multiple addresses but ALSO add more than 1 (fake) address so that the setting “stays put” before you connect it to a dataset.
Second, for whatever illogical reason, we cannot select dynamic page connection via the dataset settings while connecting a map to CMS. Because they just built it that way.
And lastly, I didn’t receive a notification when you tagged me to this post or else I would have answered you a long time ago.



If you added a new URL field and it broke the map connection, just repeat step 1 above.