I started using MapBox plugin but I’m not able to get map’s center latitude inside JS.
I used to have problem also with storing the latitude in DB but I worked-around it by setting custom state to store the map’s center latitude and saving this state in DB.
But that doesn’t help with passing the latitude to Run Javascript
action. I’m pasting screenshots and code, so maybe someone will figure out how this can be done, or maybe there’s some very simple mistake I made…
<script>
function updateCircle(mapWidth, mapHeight, zoomLevel, sliderValue, latitude) {
console.log("lat", latitude, `${typeof latitude}`, "cos(lat)", Math.cos(latitude), "cos(All)", Math.cos(latitude * Math.PI / 180) / Math.pow(2, zoomLevel+1));
the above prints
Here’s my workflow
and debug view, where the latitude actually has some reasonable value