Im using google map on my dynamic page and repeater. The problems are:
Direction always end to Wix office location. I set up the latitude and longitute on database and it show the correct location on the google map (dynamic page) but misleading when clicking the direction link.
Anyone has successfully attached google map into repeater?
Are you using any Wix Corvid example as you mention that it always points to the Wix Offices?
Post any used code and screenshots here so that it can be looked over and checked etc.
This works for me.
$w.onReady(function () {
$w("#dynamicDataset").onReady(() => {
let currentItem = $w("#dynamicDataset").getCurrentItem();
$w("#googleMaps1").location = {
//next data base field latitude
"latitude": currentItem.latitude,
//next data base field longitude
"longitude": currentItem.longitude,
//next data base field name of site, restaurant, etc
"description": currentItem.nombre_emp,
};
});
});
And the direction’s link provide the right direction upon clicking it?
The code works and show the right place in the google map but direction’s link does not provide the correct end point based on latitude and longitude from dynamicdataset. It always end with the address set manually on the google map’s setting which cant be leave empty too.
Did you manage to attached google map to repeater’s container too?
You are right it is not possible, I put a standard local address as something by default for when they do not put the location data and delete the address link so I simply visualize a point on the map but I cannot offer a route.
We are 2 with the same problem, hopefully someone helps us.
Apologies to revive an old thread, but is there any further development to this? I have a dynamic page set up, linked to a database, then using a Google Map object to display the location of a specific location by calling the Lat + Lon from the database.
This part works fine, but as discussed above, if you use the “Directions” link on the Google Maps object, you always get directions to the Wix HQ.
I’ve tried using the following code, but to no avail.
import wixData from 'wix-data';
import wixLocation from 'wix-location';
$w.onReady(function () {
let currentItem = $w('#teamDataset').getCurrentItem();
$w('#googleMaps1').location = {
"latitude": currentItem.latitude,
"longitude": currentItem.longitude,
"description": currentItem.dealer,
"direction": currentItem.latitude + currentItem.longitude,
}
});
export function directionsLink_click(event) {
const lat = $w("#teamDataset").getCurrentItem().latitude;
const lon = $w("#teamDataset").getCurrentItem().longitude;
const coordinates = lat + "," + lon;
wixLocation. to("https://www. google. com/maps/dir///@" + coordinates);
}
//ignore spaces in the URL above - purely for posting here
Does anyone have any further advice? Or is this something that’s not possible yet?