Performance
Geospatial web sites can quickly become unusable because of performance problems. To avoid these, follow the steps below.
1. Data Set
This is the most serious issue that impacts maps on the web. The problem is that we are trying to get rather large sets of data from the server to the client and render them for the user quickly. For typical data, try the following:
- Remove all unnecessary data from attribute tables
- Set a minimum zoom level and then simplify the spatial data until it looks good at your minimum zoom level
- Break up your data into multiple files at different levels of zoom with increasing resolution
- At higher resolution, break up your files into multiple regions on the earth. An example might to be break up the continents into different files at high resolution.
If none of these approaches improve the performance it is time to go to either raster or vector tiles.
Raster tiles
These are the best supported and most straight forward to use. See the tutorial on how to create pyramid tiles with BlueSpray. If you are starting with vector data, you'll want to create a high resolution raster for the tiles.
Vector tiles
CanvasMap supports vector tiles but they have a lot of overhead so this is the last resort but can be effective for complex road and stream layers especially.
2. Settings
Settings are usually not a problem unless you are setting a lot of settings in an animation loop. Typically we use "SetSetting()" to change settings but this function actually creates a JSON dictionary entry and then calls SetSettings() making it relatively slow. switch to using "SetSettings()" or even "SetSettingGroup()" to improve the speed. SetSettings allows you to set multiple settings in one call with error checking. SetSettingsGroup() replaces the existing group of settings without error checking so it is very fast.
3. Tiles
Tiles are the ultimate solution for complex spatial data sets. If you have vector data, you may want to convert it to a high resolution raster and then create raster tile from it. If you want the user to be able to interact with the vector data, you'll need to use vector tiles. See the tutorials on pyramiding for both solutions.
As a final note, you can use all of the techniques above to keep your maps performing well as you add more data.