你甚至可以直接从数据库提供瓷砖。
格式传单指定非常灵活。
小册子只是使用z,x,y占位符来请求特定的瓷砖。
例如:
L.tileLayer('http://localhost/tileserver/tile.aspx?z={z}&x={x}&y={y}', {
minZoom: 7, maxZoom: 16,
attribution: 'My Tile Server'
}).addTo(map);
其中Tiles.aspx
Option Strict On
Partial Class tile
Inherits System.Web.UI.Page
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
Dim z, x, y As Integer
z = CInt(Request.QueryString("z"))
x = CInt(Request.QueryString("x"))
y = CInt(Request.QueryString("y"))
Dim b() As Byte = DB.GetTile(z, x, y)
Response.Buffer = True
Response.Charset = ""
'Response.Cache.SetCacheability(HttpCacheability.NoCache)
Response.ContentType = "image/png"
Response.AddHeader("content-disposition", "attachment;filename=" & y & ".png")
Response.BinaryWrite(b)
Response.Flush()
Response.End()
End Sub
仅供参考任何人阅读本 - 瓷砖不必是256x256px。您可以在TileLayer选项中设置一个正方形边的长度 - 但是256px是默认值(通常会让您的生活更轻松) – thisissami