產生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和穩定性是關鍵。