Center the map using user/browser location

I’m able to get the location from the browser using:

<script>
function setMapPosition(position) {
    const pos = {
        lat: position.coords.latitude,
        lng: position.coords.longitude,
        };
    console.log(pos);
}

navigator.geolocation.getCurrentPosition(setMapPosition);
</script>

And from this method, I want to call the method from Google Map objectsetCenter(pos) documented here Géolocalisation : affichage de l'emplacement d'un utilisateur ou d'un appareil sur une carte  |  API Maps JavaScript  |  Google for Developers

But how I can get the instance of my map defined in a Softr block?

Thank you

Hi @jphblais what is your need? To get latitude and longitud and placing them in a map block???. There is a main point in my apps and it is to avoid "“scripts” if there are not neccesary, any other solution is better for me, because after a month I do not know where they are hahaha and they have to be maintained, so I prefer other kind of workarounds…

I got the same, just using fillout, for me these are the steps:

  1. Get the position with the form
  2. In Airtable get the position and split it with Right and Left formula
  3. Place them in a softr´s block