What controls the location of the map when a user logs in?

When we log in to Alloy, the map defaults to the location that was displayed when we were last logged in. In some cases it always defaults to another location, why is that?

How does Alloy know the view of the map from the previous session? And therefore what is likely to stop this from happening?

The web map uses two pieces of information. The first is Local Storage, we hold a value which is the coordinate of the last viewed position of the map, this is updated each time you pan/zoom etc.

When the main map initialises we first default the centre to the last known position from local storage (or 0,0 if not found). Secondly we check if the customer has a bounding box as defined on the customer model from the api. If it does and the current map bounds (taken from the first part) does not intersect or contain it then the map is set to the bounds of the customer.

The reasoning behind this was to always bring the user back to the customers area where they have data so we don’t initialise the map in another country etc. and the user has to pan back and find where they have information.

Thanks for the question.

1 Like