Hey Everyone,
I am trying to get a map to show a bunch of different locations held within a dataset that lists the names of Shops and the Lat/Long positions. Because I know that the map errors when sent null values, I have filtered my dataset, so that it only shows records that have a valid lat/long. I have done this by adding filters of Latitude >= -180 and Latitude <=180 and Longitude >= -90 and Longitude < 90. I can show this data on my page - and see that all values are populated, however when I run this data into the map I get the following error:
Wix code SDK Warning: The latitude parameter of "locationMap" that is passed to the location method cannot be set to null or undefined.FIND SHOPS Line 7
I am using the following code:
$w.onReady(function () {
$w("#ShopsLatLngFilterDS").onReady(() => {
let currentItem = $w("#ShopsLatLngFilterDS").getCurrentItem();
$w("#locationMap").location = {
"latitude": currentItem.Latitude,
"longitude": currentItem.Longitude,
"description": currentItem.Title
};
});
});
Any ideas of why this is happening?
Wix code SDK error: The location parameter at index 17 that is passed to the markers function cannot be set to.
Any clue what this means and how to fix it?
Make sure that you are using the correct Field Key of the dataset item and not the Field Name.
Note that the Field Key does not start with a capital letter. So, you want to use:
currentItem.latitude currentItem.longitude currentItem.title