LoadMap performance issues
|Reported by:||pagameba||Owned by:||madair|
|External ID:||Operating System:||All|
This affects both MapGuide and MapServer. Currently, LoadMap.php (as called by loadMap and reloadMap) enumerates all the layers, scale ranges and styles/classes to generate a full list of the structure of the Map. But the Map widget only uses the layer list to manage layers, it is the Legend widget that needs the extra information.
When you dynamically add or remove layers during a session, then, you need to call reloadMap which processes the whole map again and returns all that information to the client which again needs to parse it all. This is slow and wasteful.
This enhancement is to refactor the code in LoadMap.php, the Map widgets, the Legend widget and possibly the LayerManager widget to remove the scale range/style/class code from LoadMap into a separate php script that can be called from the Legend widget directly. This new script could cache scale range information in the server-side session and other code that changes the representation of the layer can then just remove the information from the session to cause it to be rebuilt.
This will allow LoadMap to run faster and return a LOT less information to the client, making initial load and reload faster.
The Legend widget will need to be refactored to get the layer list from the Map (as it does now) and then make separate asynchronous requests to the server to load up scale range/style/class information per layer. Then on reload, it can make more intelligent choices to get only the information that has changed.
The Legend widget should also be refactored to not rebuild itself on reload but rather just restructure its existing tree if possible.