AspMap supports two kinds of tiles:
Dynamic tiles are generated at runtime and saved in the tile cache directory.
Static tiles are generated by the GenerateTiles method. A static tile has the 's' prefix in its name and it cannot be removed when the size of the tile cache directory is exceeded the size specified by MaxDynamicCacheSize property.
Generating static tiles can increase the site's performance because static tiles are ready for download when a client accesses the site for the first time. AspMap sends direct URLs to the static tiles to the web browser. Typically, it is enough to generate static tiles for the first 7-10 zoom levels, other tiles will be generated and stored in the tile cache directory dynamically.
To generate tiles in a ready to deploy application, add a temporary Button to the form and add the following code for the Click event:
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Dim tileLayer As AspMap.Web.TileLayer = TileLayer.Find("CountyMap")
If tileLayer IsNot Nothing Then Server.ScriptTimeout = 3600 ' 1 hour Dim tileFolder As String = MapPath("~/TileCache") Dim currentScale As Double = map.ZoomToScale(map.ZoomLevel) tileLayer.GenerateTiles(currentScale, tileFolder) End If
Set a 1 hour timeout for the ScriptManager control, to avoid timeout error messages:
<asp:ScriptManager ID="ScriptManager1" runat="server" AsyncPostBackTimeout="3600"/>
Select a zoom level in the ZoomBar control and press the button. AspMap will generate static tiles for the selected zoom level. An advanced example can be found in the GeneratingStaticTiles.aspx sample in the standard samples.
See also the TileGenerator.ascx user control in the standard samples. This control encapsulates the code from the GeneratingStaticTiles.aspx sample and can be temporarily added to an ASPX page without changing the code-behind files.
© 2018 VDS Technologies
|Converted from CHM to HTML with chm2web Standard 2.85 (unicode)|