Reply To: Site Updates and Feature Requests
Welcome › Forums › Huddersfield Exposed › Site Updates and Feature Requests › Reply To: Site Updates and Feature Requests
The site’s map feature (which displays icons of geoindexed locations) has just had a major update which should improve performance…
The icons are delivered via an API which takes the boundaries of the displayed map and, combined with the current zoom level, decides which markers should be displayed. Previously, the API response included details such as geocoordinates, location name, location ID, icon details, etc. and, if a large number of markers needed to be displayed, the response size could be large — perhaps up to around 15kB for a particularly busy map. Each time the user adjusts the map (scrolling, zooming, etc), another API request was needed, generating network traffic and CPU load on the server.
The new update moves to using the web browser’s localStorage (if available) to cache a full copy of all geoindexed locations using a JSON file on the server. The browser will periodically check to see if the localStorage cache is up-to-date and, if not, pull a fresh copy of the JSON file from the server. The API response is now much smaller (around 1kB) and contains only the location IDs of the markers to display — the rest of the information (geocoordinates, name, icon, etc) is retrieved from the localStorage.