map in slideshow

on a dynamic page i’m trying to connect the address in collection that was created with google places API using the wix user address input

I have tried several code variations as follows

let myLocation = $w(“#googleMaps1”).location;

let txtGoogleMapsName = $w(‘#someDataSetName’).getCurrentItem().title;
let txtGoogleMapsLat = $w(‘#someDataSetName’).getCurrentItem().latitude;
let txtGoogleMapsLong = $w(‘#someDataSetName’).getCurrentItem().longitude;

    $w("#googleMaps1").location = { 

“longitude”: txtGoogleMapsLong,
“latitude”: txtGoogleMapsLat,
“description”: txtGoogleMapsName

and this one which is a mash up of the code used on the page where an address input is located with a map

in my case the address is now stored in the collection

function viewAddressOnMap(address) {
$w.onReady( function () {
$w(“#dynamicDataset”).onReady( () => {
let currentItem = $w(“#dynamicDataset”).getCurrentItem();
viewAddressOnMap(address);
$w(“#googleMaps1”).location = {
“latitude”: address.location.latitude,
“longitude”: address.location.longitude,
“description”: address.formatted
};
});

thanks Adam

Hey, Adam.

Did you check this example that might be exactly what you need?

If this is the example you were referring to, please share the link to your site so we can take a look at it.

Thanks!

Thanks website link here
https://editor.wix.com/html/editor/web/renderer/edit/b9f34163-10d4-42dd-b95e-2deec974cdd0?metaSiteId=594d236f-b270-48eb-bf5b-6399d04830fd&editorSessionId=cbf8001c-50f3-4c13-8d1e-caa2cd65b4bb&referralInfo=dashboard

on element fullWidthSlides1 which is on dynamic page fullName

and the address is in the collection under ltrAddress field key

Thanks
Adam

Hi i was really hoping that someone would have helped me with this by now.
Thanks in Hoping
Adam

ok so i have tried this code as i have Lat, Long and Description in my collection from using Google / Wix places API

  1. $w.onReady( function () {

  2. $w(“#dataset1”).onReady( () => {

  3. let currentItem = $w(“#dataset1”).getCurrentItem();

  4. $w(“#googleMaps1”).location = {

  5. “latitude”: currentItem.latitude,

  6. “longitude”: currentItem.longitude,

  7. “description”: currentItem.location,

  8. };

  9. });

  10. });

I am getting the following error messages from line 4.

I have the address saved as address field key in the collection and the input was configured using the places API from wix address input

Hi guys, from Wix or Wix Masters :slight_smile: can I get some help here please
Thanks
Adam

Make sure that the field type is number + that the value is a number and that the value exists.

I would love to screen shot the database entry based on the api places input but I know it’s in address format. So how do separate the address from the number because I guess if I change the field key to number only it still won’t work. Sorry this is a mobile response.

ok so i changed the field key from address to number but this hasn’t worked on its own. in the code above if its correct is lat, long and description picking up the correct values ?

ah currentItem is for a repeater right? but this map has been placed in a slideshow

.getCurrentItem() is for dynamic dataset.
Adam, your description is not detailed enough and it’s hard to understand, what values you have in your collection.

Thanks J.D. this is the collection field key view and the one that i’m trying to link to the map on the dynamic page

So you need to extract the values:

currentItem.ltrAdress.location.latitude;//use your field key instead of ltrAdress

and do the same to the longitude

ltrAddress is the field key but address, latitude and longitude are sub fields within the field key

and i’m not sure how location fits with this

Have a look:
https://www.wix.com/corvid/reference/$w.AddressInput.html#Address

thanks

  1. ltrAddress is fieldkey
  2. and googleMaps1 is the map on the page

Delete lines 33-46.
Make sure you use the correct selector in line 30.
Change lines 50-52 so they’ll fit to the structure of the address object:

"latitude": currentItem.ltrAdress.location.latitude;

I think i’m getting there but let address = $w(“#”).value; is neither the field key (ltrAddress) or googleMaps1 and i do not have another page element ?

I don’t understand what you’re doing and what you’re trying to do.
what is $w(“#”).value. It’s not a valid selector.
and why do you have a } in line 32?
and delete line 35.