WebGIS前端地图显示之根据地理范围换算出瓦片行列号的原理(核心)
参考arcgis 官网: ArcGIS 创建地图切片包https://desktop.arcgis.com/zh-cn/arcmap/10.3/tools/data-management-toolbox/create-map-tile-package.htm
1.切图方案
最大比例级别是1:500,采用压缩格式(减少空间存储)compat,采用PNG32,文件组织形式是 紧凑型瓦片(Bundle)。
实例数参数(Number of caching service instance)=cup+1 ?
切片格式选择什么?参考这个文章:24004: 建议使用 MIXED 切片格式缓存具有栅格图层的地图
<?xml version="1.0" encoding="UTF-8"?>
-<CacheInfo xmlns:typens="http://www.esri.com/schemas/ArcGIS/10.5"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="typens:CacheInfo">
-<TileCacheInfo xsi:type="typens:TileCacheInfo">
-<SpatialReference xsi:type="typens:GeographicCoordinateSystem">
<WKT>GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],
PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433],
AUTHORITY["EPSG",4326]]</WKT>
<XOrigin>-400</XOrigin>
<YOrigin>-400</YOrigin>
<XYScale>11258999068426.24</XYScale>
<ZOrigin>-100000</ZOrigin>
<ZScale>10000</ZScale>
<MOrigin>-100000</MOrigin>
<MScale>10000</MScale>
<XYTolerance>8.9831528411952133e-009</XYTolerance>
<ZTolerance>0.001</ZTolerance>
<MTolerance>0.001</MTolerance>
<HighPrecision>true</HighPrecision>
<LeftLongitude>-180</LeftLongitude>
<WKID>4326</WKID>
<LatestWKID>4326</LatestWKID>
</SpatialReference>
-<TileOrigin xsi:type="typens:PointN">
<X>-400</X>
<Y>399.99999999999977</Y>
</TileOrigin>
<TileCols>256</TileCols>
<TileRows>256</TileRows>
<DPI>96</DPI>
-<LODInfos xsi:type="typens:ArrayOfLODInfo">
-<LODInfo xsi:type="typens:LODInfo">
<LevelID>0</LevelID>
<Scale>769528.12628819409</Scale>
<Resolution>0.0018310621693923973</Resolution>
</LODInfo>
-<LODInfo xsi:type="typens:LODInfo">
<LevelID>1</LevelID>
<Scale>384764.063144113</Scale>
<Resolution>0.0009155310846962366</Resolution>
</LODInfo>
-<LODInfo xsi:type="typens:LODInfo">
<LevelID>2</LevelID>
<Scale>192382.0315720379</Scale>
<Resolution>0.00045776554234807406</Resolution>
</LODInfo>
-<LODInfo xsi:type="typens:LODInfo">
<LevelID>3</LevelID>
<Scale>96191.015786038872</Scale>
<Resolution>0.00022888277117408441</Resolution>
</LODInfo>
-<LODInfo xsi:type="typens:LODInfo">
<LevelID>4</LevelID>
<Scale>48095.507893019436</Scale>
<Resolution>0.00011444138558704221</Resolution>
</LODInfo>
-<LODInfo xsi:type="typens:LODInfo">
<LevelID>5</LevelID>
<Scale>24047.753946509718</Scale>
<Resolution>5.7220692793521103e-005</Resolution>
</LODInfo>
-<LODInfo xsi:type="typens:LODInfo">
<LevelID>6</LevelID>
<Scale>12023.876973235261</Scale>
<Resolution>2.8610346396713921e-005</Resolution>
</LODInfo>
-<LODInfo xsi:type="typens:LODInfo">
<LevelID>7</LevelID>
<Scale>6011.9384866176306</Scale>
<Resolution>1.430517319835696e-005</Resolution>
</LODInfo>
-<LODInfo xsi:type="typens:LODInfo">
<LevelID>8</LevelID>
<Scale>3005.9692433283726</Scale>
<Resolution>7.1525865992250161e-006</Resolution>
</LODInfo>
-<LODInfo xsi:type="typens:LODInfo">
<LevelID>9</LevelID>
<Scale>1502.9846216446081</Scale>
<Resolution>3.5762932995659225e-006</Resolution>
</LODInfo>
-<LODInfo xsi:type="typens:LODInfo">
<LevelID>10</LevelID>
<Scale>751.49038700791209</Scale>
<Resolution>1.788142072141633e-006</Resolution>
</LODInfo>
-<LODInfo xsi:type="typens:LODInfo">
<LevelID>11</LevelID>
<Scale>500</Scale>
<Resolution>1.18973050291514e-006</Resolution>
</LODInfo>
</LODInfos>
<PreciseDPI>96</PreciseDPI>
</TileCacheInfo>
-<TileImageInfo xsi:type="typens:TileImageInfo">
<CacheTileFormat>PNG32</CacheTileFormat>
<CompressionQuality>0</CompressionQuality>
<Antialiasing>false</Antialiasing>
<BandCount>1</BandCount>
<LERCError>0</LERCError>
</TileImageInfo>
-<CacheStorageInfo xsi:type="typens:CacheStorageInfo">
<StorageFormat>esriMapCacheStorageModeCompactV2</StorageFormat>
<PacketSize>128</PacketSize>
</CacheStorageInfo>
</CacheInfo>
2.注意事项
配图过程中,每一个级别的图层都配置可见比例范围,20190516-18这几天配图和切图,发布的地图发现17级别以下地图看不见,通过检查发现是空间比例范围设置错误(大一点或者小一点点都不行)。
以下是我设置的可见范围:
级别 缩小超过(不显示) 放大超过(不显示)
10级 无 1:769,528
11级 1:769,527 1:384,764
12级 1:384,763 1:192,382
13级 1:192,381 1:96,191
14级 1:96,190 1:48,095
15级 1:48,094 1:24,047
16级 1:24,046 1:12,023
17级 1:12,022 1:6,011
18级 1:6,010 1:3,005
19级 1:3,004 1:1,502
20级 1:1,501 1:751
21级 1:750 无
3.切图过程
如果选择 抗锯齿(最佳),切完全图大概10个小时。瓦片占用存储空间46G
如果不选择 抗锯齿(最佳),切完全图大概4个小时。瓦片占用存储空间32G