I'm setting the default map zoom via the 'Initial Position and Zoom' configuration in the Attributes tab on the Region configuration panel with the following code:
select to_number(:P17_GPS_LATITUDE) as LAT,
to_number(:P17_GPS_LONGITUDE) as LON,
15 as ZOOM
from DUAL
This is working correctly the first time, but stops working when I enter this page again until I log off the application and log in again.
I've looked at what could be the problem and found that a part of the script that loads the map is different the first time compared to when it loads after that.
The first time it loads this is what I can find (I'm only leaving the parts that are different between loads):
apex.jQuery('#localitzacioMapa_map_region')
.spatialMap({
"regionStaticId": "localitzacioMapa",
"resetMapPosition": true,
"initPosition": { "basedOnFeatures": false, "lon": 1.8246315941379123, "lat": 45.97590926950204, "zoom": 15, "getFromBrowser": false }
})
After that, it will load like the following code and it won't be fixed until i log off and log in again:
apex.jQuery('#localitzacioMapa_map_region')
.spatialMap({
"regionStaticId": "localitzacioMapa",
"initPosition": { "basedOnFeatures": false, "zoom": 0, "getFromBrowser": false }
})
My issue is that the LAT and LON values are not being passed correctly and the zoom value resets to 0 for some reason.
