生成ags cache图片之后,不少人应该碰到过这样的问题,切过的图片有很明显的噪点,有时甚至左边的切片显示正常,右边确有噪点,造成左右差异的原因目前还不知道,但消除噪点的方法就是使用PNG32格式进行切图。
如果大家做过网页设计,应该记得PNG图片和部分浏览器不兼容,特别是部分格式的透明效果很难实现,ags官方博客上最近给出了专业建议:
PNG8 - Use this format for overlay services that need to have a transparent background, such as roads and boundaries. PNG 8 creates tiles of very small size on disk with no loss of information. However, you should use a different PNG format if your map contains more than 256 colors. Imagery, hillshades, gradient fills, transparency, and the antialiasing caching option can easily push your map over 256 colors.
PNG24 - You can use this format for overlay services, such as roads and boundaries, that have more than 256 colors (if fewer than 256 colors, use PNG 8). Do not use PNG 24 if your tiles will be viewed in Internet Explorer version 6 or previous.
PNG32 - Use this format for overlay services, such as roads and boundaries, that have more than 256 colors. This format creates larger tiles than PNG 24, but the tiles are fully supported in all browsers.
JPEG - Use this format for base map services that have large color variation and do not need to have a transparent background. For example, raster imagery tends to work well with JPEG.
很容易理解为什么PNG8容易出现噪点了,因为我们的数据底图很容易超过256色,8位图片显然无法满足基本要求,虽然PNG32文件比PNG8和PNG24相对要大,但正式项目中我还是倾向于它,出色显示效果,对主流浏览器的完美支持就足以坚定我们的信心,多出的文件大小就让海量硬盘去消化吧。
为栅格、矢量图层做cache时,一定要先取地图的小部分区域检验切片效果,避免上机就做完整切图,最后多天的等待之后发现前功尽弃。做cache的电脑,建议为高性能PC或工作站,CPU和稳定性是关键。