arcgis server 9.2 建FUSED类型的缓存可用ZoomLevel ,建MULTI_LAYER的不可用ZoomLevel
需要建立是地图 cache
不过创建了地图cache后“zoomin”和“zoomout”只能在定义的cache的几个点放大、缩小了。
附录一:Creating a map cache
About creating a map cache
A map cache is a collection of pre-rendered map tiles that can be used for display of a map service. Cached services display quickly because the map image does not have to be rendered on the fly; the cost of rendering the image is paid only once when the cache is created.
In order to create a map cache, you must first publish a map document as a map service. The simplest way to do this is to right-click the map document and click Publish to ArcGIS Server.
You must have an administrative connection to the server in order to create a map cache. Following are the simple steps for creating the cache. For extensive information on map caches and how to create them, see the topic "Using cached map services to improve performance" in the ArcGIS Server Help system.
How to create a map cache
1. In ArcCatalog, create an administrative connection to the server that contains the map service you want to cache. See Connecting to a GIS server if you need help with this.
2. Make sure that the service is started
3. Right-click the service and click Service Properties.
4. Click the Caching tab
5. Select a cache directory.
6. Click Build. The Generate Map Server Cache tool opens with many of the appropriate parameters already entered. You can adjust the settings, then click OK. For more information on using the Generate Map Server Cache tool, see the Generate Map Server Cache (附录二)geoprocessing tool reference.
7. When you have finished filling in the parameters for the Generate Map Server Cache tool, click OK to begin creating the cache.
8. When the cache creation has completed, stop the service, then start it again.
附录二:Generate Map Server Cache (Server)
Generates a cache of static image tiles for an ArcGIS Server Map Service.
Usage tips
· This tool only works with ArcGIS Server MapServices.
· Before running this tool, configure the MapService to use as many instances as possible. This will dramatically decrease cache generation time.
· Only one data frame can be cached at a time. If other data frames are needed, separate caches must be generated that associated with separate MapServices.
· The tiling scheme determines how the client should reference the tiles in the cache. A new tiling scheme can be created, or an existing tiling scheme created with the Generate Map Server Cache Tiling Scheme tool can be used.
· Use Fused caches for most cases. All the layers in the map are composited into single images for each specified scale level, then split into many tiles.
· Use Multi-layer caches for cases where you want to toggle layers on and off.
· The Number of Scales parameter is the number of different map scales the tool will create layers for in the cache.
· Choosing large scale levels (> 1/100,000) will result in large creation times.
· The primary benefit of employing image-compression in your cache is to reduce the size of the image tiles to improve performance over the network. Because less data is transmitted between the client and the server, it is possible to cache large, seamless raster datasets (as large as several terabytes) and serve them quickly to a client for display. An added benefit is the significantly reduced size of the cache on disk.
· When using this tool to add additional levels (scales) to an existing cache, make sure to specify the same compression factor that was used in the original levels.
· JPEG is best used with raster data. When used with vector data, lines and text may be blurred.
· JPEG file format is not supported for multi-layer caches.
· The cache tile format cannot be changed once the cache is generated. The cache must first be deleted before switching to a different file format.
· For best performance of streaming cache tiles to clients choose the JPEG image format. For the best combination of performance and transparency support, choose the PNG8 image format.
· The Antialiasing option smooths out the edges of lines and text, but offers little enhancement for raster images.
· This tool does not accept any Environment Settings that have been specified.
Command line syntax
An overview of the Command Line window
GenerateMapServerCache_Server
Parameter |
Explanation |
Data Type |
|
The host name of the ArcGIS Server to use to generate the cache.
|
String |
|
The name of the Map Service to use to generate the cache.
|
String |
|
The map from from the source map document to cache.
|
String |
|
The parent directory for this Map Service cache.
|
String |
|
Choose to use a NEW or PREDEFINED tiling scheme. A new tiling scheme can be defined in this tool, or a predefined scheme file (.xml) can be loaded. A predefined scheme can be created by running the Generate Map Server Cache Tiling Scheme GP Tool. NEW is the default.
|
Boolean |
|
Set the scale level
|
Boolean |
|
The number of scale levels to create in the cache.
|
Long |
|
The dots per inch of the intended output device. If a DPI is chosen that does not match the resolution of the output device, the scale of the map tile will appear incorrect. The default value is 96.
|
Long |
|
The width, in pixels, of output map tiles. Small widths map improve performance of the application requesting tiles from the cache as less data will travel over the wire. However, smaller tile size results in a larger cache size and longer creation time. The default tile width is 512.
|
Long |
|
The height, in pixels, of output map tiles. Small heights map improve performance of the application requesting tiles from the cache as less data will travel over the wire. However, smaller tile size results in a larger cache size and longer creation time. The default tile height is 512.
|
Long |
{FUSED| MULTI_LAYER} |
Choose to generate a FUSED or MULTI_LAYER cache:
|
Boolean |
{tiling_schema} |
Path to a pre-defined tiling scheme.
|
String |
{tile_origin} |
Specify the origin (upper left corner) of the tiling scheme in coordinates of the spatial reference of the source map document. The extent of the source map document must be within (but does not need to coincide) with this region.
|
String |
{Scale; Scale...} |
Scales at which to cache the Map Service.
|
String |
{Layer; Layer...} |
Layers to include in the cache if MULTI_LAYER cache type is chosen.
|
String |
{thread_count} |
The number of MapServer Instances to use while generating the cache.
|
Long |
{ANTIALIASING | NONE} |
Choose whether to use antialiasing when rendering the tiles. If ANTIALIASING is chosen, edges of lines, borders, and text will be smoothed. There is a performance cost for this option. No benefit will be gained on raster data.
|
Boolean |
{PNG8 | PNG24 | PNG32 | JPEG} |
Choose either PNG8, PNG24, PNG32 or JPEG file format for the tiles in the cache. PNG24 is the default.
|
String |
{tile_compression_quality} |
Enter a value between 1 and 100 for the JPEG compression quality. The default value is 75 for JPEG tile format and zero for other formats. Compression is supported only for JPEG format. The level of compression will depend on the data, but can also be controlled by changing the compression quality. Choosing a higher value will result in less compression and a higher-quality image. Choosing a lower value will result in more compression but a lower-quality image.
|
Long |
Data types for geoprocessing tool parameters
Command line example
GenerateMapServerCache "myServer" "myMapService" "Layers" "C:\arcgisserver\arcgisscache\" NEW STANDARD "3" "96" "512" "512" FUSED # "0 0" "8000000;4000000;2000000" "Layer1;Layer2" 2 ANTIALIASING "JPEG" "75"
Scripting syntax
About getting started with writing geoprocessing scripts
GenerateMapServerCache_Server (server_name, object_name, data_frame, out_folder, tiling_scheme_type, scales_type, num_of_scales, dpi, tile_width, tile_height, map_or_layers, tiling_schema, tile_origin, levels, layer, thread_count, Antialiasing, cache_format, tile_compression_quality)
Parameter |
Explanation |
Data Type |
server_name (Required) |
The host name of the ArcGIS Server to use to generate the cache.
|
String |
object_name (Required) |
The name of the Map Service to use to generate the cache.
|
String |
data_frame (Required) |
The map from from the source map document to cache.
|
String |
out_folder (Required) |
The parent directory for this Map Service cache.
|
String |
tiling_scheme_type (Required) |
Choose to use a NEW or PREDEFINED tiling scheme. A new tiling scheme can be defined in this tool, or a predefined scheme file (.xml) can be loaded. A predefined scheme can be created by running the Generate Map Server Cache Tiling Scheme GP Tool. NEW is the default.
|
Boolean |
scales_type (Required) |
Set the scale level
|
Boolean |
num_of_scales (Required) |
The number of scale levels to create in the cache.
|
Long |
dpi (Required) |
The dots per inch of the intended output device. If a DPI is chosen that does not match the resolution of the output device, the scale of the map tile will appear incorrect. The default value is 96.
|
Long |
tile_width (Required) |
The width, in pixels, of output map tiles. Small widths map improve performance of the application requesting tiles from the cache as less data will travel over the wire. However, smaller tile size results in a larger cache size and longer creation time. The default tile width is 512.
|
Long |
tile_height (Required) |
The height, in pixels, of output map tiles. Small heights map improve performance of the application requesting tiles from the cache as less data will travel over the wire. However, smaller tile size results in a larger cache size and longer creation time. The default tile height is 512.
|
Long |
map_or_layers (Optional) |
Choose to generate a FUSED or MULTI_LAYER cache:
|
Boolean |
tiling_schema (Optional) |
Path to a pre-defined tiling scheme.
|
String |
tile_origin (Optional) |
Specify the origin (upper left corner) of the tiling scheme in coordinates of the spatial reference of the source map document. The extent of the source map document must be within (but does not need to coincide) with this region.
|
String |
levels (Optional) |
Scales at which to cache the Map Service.
|
String |
layer (Optional) |
Layers to include in the cache if MULTI_LAYER cache type is chosen.
|
String |
thread_count (Optional) |
The number of MapServer Instances to use while generating the cache.
|
Long |
Antialiasing (Optional) |
Choose whether to use antialiasing when rendering the tiles. If ANTIALIASING is chosen, edges of lines, borders, and text will be smoothed. There is a performance cost for this option. No benefit will be gained on raster data.
|
Boolean |
cache_format (Optional) |
Choose either PNG8, PNG24, PNG32 or JPEG file format for the tiles in the cache. PNG24 is the default.
|
String |
tile_compression_quality (Optional) |
Enter a value between 1 and 100 for the JPEG compression quality. The default value is 75 for JPEG tile format and zero for other formats. Compression is supported only for JPEG format. The level of compression will depend on the data, but can also be controlled by changing the compression quality. Choosing a higher value will result in less compression and a higher-quality image. Choosing a lower value will result in more compression but a lower-quality image.
|
Long |
Data types for geoprocessing tool parameters
Script example
# Script Name: Generate Fused Map Server Cache # Description: Generates a fused map server cache using PNG8 image format # Uncomment sys.argv[] lines to accept arguments from the command line. # Import standard library modulesimport sys, string, os, arcgisscripting # Create the Geoprocessor objectgp = arcgisscripting.create() # Set the path to the cache. # Example: \\\\myServer\\arcgiscache\\MyServiceFolder_MyService\out_folder = "\\\\myServer\\arcgiscache\\MyServiceFolder_MyService\\" #out_folder = sys.argv[1]# Set the SOM server name# Example: "mySOM" server_name = "mySOM"#server_name = sys.argv[2]# Set the object_name # Example: "MyServiceFolder/MyService"object_name = "MyServiceFolder/MyService" #object_name = sys.argv[3]# Set the data frame# Example: "Layers" data_frame = "Layers"#data_frame = sys.argv[4]# Set the map cache tiling origin # Example: "-180 90"tile_origin = "-180 90"#tile_origin = sys.argv[5] # Set the scale levels for the cache.# Example: "2000000;500000;250000" scales = "2000000;500000;250000"#scales = sys.argv[6]# Set the layers to cache. # Example: "My First Layer;My Second Layer;My Third Layer" layers = "My First Layer;My Second Layer;My Third Layer"#layers = sys.argv[7] # Set number of instances to use while updating the cache# Example: "3" thread_count = "3"#thread_count = sys.argv[8]# Set cache tile image format. # Example: "PNG8"cache_format = "PNG8"#layers = sys.argv[9] # Non-argument variable declarationstiling_scheme_type = "NEW"tiling_schema = "" scales_type = "STANDARD"num_of_scales = "3"dpi = "96"tile_width = "512" tile_height = "512"map_or_layers = "FUSED"antialiasing = "ANTIALIASING" tile_compression_quality = "0"try:print 'Starting Cache Generation' gp.GenerateMapServerCache
(server_name,
object_name,
data_frame,
out_folder,
tiling_scheme_type,
scales_type,
num_of_scales,
dpi, tile_width,
tile_height,
map_or_layers,
tiling_schema,
tile_origin,
scales,
layers,
thread_count,
antialiasing,
cache_format,
tile_compression_quality)
print 'Finished Cache Generation'
except:
gp.AddMessage(gp.GetMessages(2))
print gp.GetMessages(2)