Google maps dynamic page

I’m having some trouble with Google maps not displaying Latitude and Longitude on a dynamic page. What I’m trying to do is view a location on the map using lat & long to be displayed per location…

Hi,
As the error message indicates, please make sure that the Field Type of “latitude” field in your database is set to Number.
For further info about field types, please see this article: CMS (Formerly Content Manager): Field Type Support and Limitations in Collections | Help Center | Wix.com


Ok I figured it out and for anyone else who wants to know Make sure the Latitude & Longitude is set to “Numbers”, not text or anything else. mapdescription needs to be set to “Rich text” in your Dataset.
also exact code that works is pasted below

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

Hello Security Risk,

thank you for that code!
I copied the code but i cant get it to work somehow. Furthermore, WIX tells me, that the location-command is “undefined”. Why that?
While i am trying to figure it out, i am looking forward to your answer!

Greetings,

Dawd

Is the Map name google map named “#googlemap1” also makes sure you are using the number field for lat and long… Make sure the spelling is exact!!! Let me know if any of this helps

I checked everything. Still not working i think. “location” is still underlined red. What about the permissions for the page or the database?

I was wondering if i got something wrong within my html code. I didnt mention any marker function there. Also it is still centered on a specific point on the map.
Did you include anything special to your html code?

Can someone who worked with that code tell me about his html code content? That would be nice :slight_smile:

Just added the code into my page, it works perfect. No need to use rich text, works perfect with text values too