代码改变世界

在ArcGIS Server中如何定义“此级别无数据”图片?的终极解决方案

2010-03-30 23:21  flyingfish  阅读(1319)  评论(0编辑  收藏  举报

上篇文章:在ArcGIS Server中如何定义“此级别无数据”图片?中说到的方式经过试验只对ADF应用管用,对Silverlight客户端做的应用就不起作用。

经在http://support.esri.com/的细心查找,终于找到一个此问题的最终解决方案。收录在此。

 

http://support.esri.com/index.cfm?fa=knowledgebase.techarticles.articleShow&d=36939

HowTo:  Configure the cache folder to display a 'Data not available' tile for empty map cache areas or missing tiles

Article ID:
36939

Software:
ArcGIS Server for Silverlight 9.3.1

Platforms:
N/A

Summary

Configure the cache directory to display a 'Data not available' tile for empty map cache areas or when tiles are missing from the cache service.
A 'Data not available' tile can be useful if a user pans to the edge of the map or navigates to an area that has not completed caching or where cache tiles are missing.
Configuring the server to return a 'Data not available' tile can yield a better user experience than returning nothing in some cases.

Procedure

The following instructions are for use with ArcGIS Server 9.3.1 for both the .NET and Java platforms.
For ArcGIS Server for the Microsoft .NET Framework 9.3 and previous versions, follow the instructions in the article,Configuring your server to display a 'Data not available' tile for empty map cache areas.

  1. Download the appropriate file from the following links:
    missing.png
    missing.jpg
    blank.png
    Use missing.png if the cache tile format is PNG and if transparency is required.
    If a clear blank tile is needed, use blank.png instead. This is also used for overlay services that require transparency.
  2. For REST applications such as JavaScript API, Flex API, or Silverlight API applications, save a missing.png (or missing.jpg) under the _alllayers folder for the map service. For example:
    C:\arcgisserver\arcgiscache\MyMapService\Layers\_alllayers\missing.png
    The ArcGIS Server 9.3.1 Tile Handler automatically handles missing tiles by replacing the expected but missing tiles with the missing.jpg (or missing.png).
  3. For a Web ADF Application, save a missing.png (or missing.jpg) under the _alllayers folder for the map service. For example:
    C:\arcgisserver\arcgiscache\MyMapService\Layers\_alllayers\missing.png
    Additionally, the ArcGIS Server cache directory must be configured without specifying a virtual directory. This forces clients to use the tile handler to request tiles (instead of directly requesting tiles from the virtual directories) which will retrieve missing.jpg (or missing.png) when a cache tile is not found.
    Alternately, for .NET Web ADF Applications, a custom error response on the virtual cache directory can be configured for HTTP Error 404: “Not Found”. Instead of an error message, the Web server returns the tile. This approach is discussed in the ArcGIS Server Blog thread from the Related Information section below. This method is used in ArcGIS Server 9.3 and previous versions.
Related Information

Created: 6/25/2009
Last Modified: 12/3/2009