相信很多人都做过这样的操作,在Server 9.3.1 的时候发布了一个切片服务,然后升级到了Server10,升级后使用旧版本发布的切片服务,或者在另一台新机器上使用这些切片,我们完全不必重新将地图切一次,我们可以继续使用以前切好的地图切片,操作也很容易,只需要随便发布一个地图服务,定义切片的结构,也就是生成切片的缓存方案XML文件(当然要和以前的切片结构是一样的),然后用以前的切片直接覆盖到新的切片目录中对应的目录。
升级到ArcGIS 10.1 for Server可不可以这样做呢,我们知道ArcGIS 10.1 在发布服务的时候其实是用的是msd文档,是用该文档在发布的时候进行很多验证措施,比如空间参考,标注等。
我们发布地图不能像以前那样随便发布一个MXD文档,因为可能通不过验证。其次ArcGIS Server 10.1 目录结构是有变化的,在10.1 中切片是放在 /home/Soft/ArcGIS/server/arcgis/server/usr/directories/arcgiscache(我用的Linux系统,如果是windows系统,则切片路径在定义的缓存路径下,如D:\arcgisserver\directories\arcgiscache)中的,比如我发布的服务的名称是PointsofInterest,该服务的切片路径是PointsofInterest/home/Soft/ArcGIS/server/arcgis/server/usr/directories/arcgiscache/PointsofInterest/Layers,该目录下的文件如下图:
-alllayers目录中是存储切片的目录,而conf.xml文件是该切片服务的描述文件,里面包含切片级别,切片大小,空间参考等信息,conf.cdi文件是10.0增加的,该文件其实也是一个xml文件,里面包含了地图范围,空间参考,切片原点等信息,而Status.gdb是10.1增加的,是一个文件数据库,该数据库中存储了切片的状态信息,比如哪一个级别切片完了,哪一个级别正在切割,以及每一个级别的切片个数和大小,这个我们对我们了解整个切片是有很大的帮助意义的,下图是PointsofInterest的状态:
按照以前的做法,用已有的切片去覆盖现有的,我在ArcMap中将原来的图添加进来,看到的效果如下(上面的是替换后我新加的服务,下面的是原来的服务)
我们看到两个范围,大小都不能完全重合,这说明如果在10.1中直接覆盖或者替换切片是有问题的,原因在什么地方呢?
在10.1中,服务的切片有自己的存放位置,同时相应的服务也有自己的存储位置,服务的存储位置在配置的config-store下面,如我的服务的存储位置如下:/home/Soft/ArcGIS/server/arcgis/server/usr/config-store/services,而每一个服务在该目录下都有一个单独的文件夹,如PointsofInterest.MapServer,该文件夹中含有该服务的一些重要文件,如下图:
lock结尾的文件是锁文件我们不理会,json结尾的文件里面包含了该服务所使用的数据源,服务的地址等信息,具体信息如下所示:
{
"serviceName": "PointsofInterest",
"type": "MapServer",
"description": "",
"capabilities": "Map,Query,Data",
"clusterName": "default",
"minInstancesPerNode": 1,
"maxInstancesPerNode": 2,
"instancesPerContainer": 1,
"maxWaitTime": 60,
"maxStartupTime": 300,
"maxIdleTime": 1800,
"maxUsageTime": 600,
"loadBalancing": "ROUND_ROBIN",
"isolationLevel": "HIGH",
"configuredState": "STARTED",
"recycleInterval": 24,
"recycleStartTime": "00:00",
"keepAliveInterval": 1800,
"private": false,
"isDefault": false,
"maxUploadFileSize": 0,
"allowedUploadFileTypes": "",
"properties": {
"maxBufferCount": "100",
"virtualCacheDir": "/rest/directories/arcgiscache",
"maxImageHeight": "2048",
"maxRecordCount": "1000",
"textAntialiasingMode": "Force",
"filePath": "Z:\\home\\Soft\\ArcGIS\\server\\arcgis\\server\\usr\\directories\\arcgissystem\\arcgisinput\\PointsofInterest.MapServer\\extracted\\v101\\PointsofInterest.msd",
"hasStaticData": "true",
"maxImageWidth": "2048",
"enableDynamicLayers": "false",
"cacheOnDemand": "false",
"dynamicDataWorkspaces": "",
"useLocalCacheDir": "false",
"outputDir": "/home/Soft/ArcGIS/server/arcgis/server/usr/directories/arcgisoutput",
"virtualOutputDir": "/rest/directories/arcgisoutput",
"supportedImageReturnTypes": "URL",
"minScale": "500000000",
"isCached": "true",
"tilingScheme": "3",
"ignoreCache": "false",
"maxScale": "125000000",
"antialiasingMode": "None",
"clientCachingAllowed": "true",
"cacheDir": "/home/Soft/ArcGIS/server/arcgis/server/usr/directories/arcgiscache"
},
"extensions": [
{
"typeName": "NAServer",
"capabilities": "",
"enabled": "false",
"maxUploadFileSize": 0,
"allowedUploadFileTypes": "",
"properties": {
"oDCostMatrix_MaxDestinationsToFind": "",
"oDCostMatrix_ForceHierarchyBeyondDistance": "",
"vRP_MaxFeaturesInPolygonBarriers": "",
"vRP_MaxRoutes": "",
"serviceArea_ForceHierarchyBeyondDistance": "",
"serviceArea_MaxBarriers": "",
"oDCostMatrix_MaxFeaturesInPolygonBarriers": "",
"route_MaxFeaturesInLineBarriers": "",
"closestFacility_MaxFeaturesInLineBarriers": "",
"locationAllocation_MaxDemandPoints": "",
"oDCostMatrix_MaxBarriers": "",
"closestFacility_MaxFacilitiesToFind": "",
"closestFacility_MaxFeaturesInPolygonBarriers": "",
"closestFacility_MaxFacilities": "",
"oDCostMatrix_MaxDestinations": "",
"closestFacility_MaxBarriers": "",
"serviceArea_MaxBreakValue_Length": "",
"serviceArea_MaxBreakValue_Other": "",
"vRP_MaxFeaturesInLineBarriers": "",
"serviceArea_MaxFacilities": "",
"vRP_ForceHierarchyBeyondDistance": "",
"locationAllocation_MaxFeaturesInPolygonBarriers": "",
"oDCostMatrix_MaxOrigins": "",
"oDCostMatrix_MaxFeaturesInLineBarriers": "",
"locationAllocation_MaxBarriers": "",
"route_MaxFeaturesInPolygonBarriers": "",
"locationAllocation_ForceHierarchyBeyondDistance": "",
"locationAllocation_MaxFeaturesInLineBarriers": "",
"closestFacility_ForceHierarchyBeyondDistance": "",
"route_ForceHierarchyBeyondDistance": "",
"saveLayerOnServerWhenError": "",
"vRP_MaxOrders": "",
"serviceArea_ForceHierarchyBeyondOther": "",
"defaultOutputGeometryPrecision": "",
"serviceArea_MaxFeaturesInPolygonBarriers": "",
"serviceArea_ForceHierarchyBeyondTime": "",
"route_MaxStops": "",
"serviceArea_MaxFeaturesInLineBarriers": "",
"serviceArea_MaxBreakValue_Time": "",
"closestFacility_MaxIncidents": "",
"vRP_MaxBarriers": "",
"route_MaxBarriers": "",
"locationAllocation_MaxFacilities": ""
}
},
{
"typeName": "MobileServer",
"capabilities": "Uploads",
"enabled": "false",
"maxUploadFileSize": 0,
"allowedUploadFileTypes": "",
"properties": {}
},
{
"typeName": "KmlServer",
"capabilities": "SingleImage,SeparateImages,Vectors",
"enabled": "true",
"maxUploadFileSize": 0,
"allowedUploadFileTypes": "",
"properties": {
"message": "",
"minRefreshPeriod": "30",
"linkDescription": "",
"useNetworkLinkControlTag": "false",
"compatibilityMode": "GoogleEarth",
"imageSize": "1024",
"dpi": "96",
"endPointURL": "",
"linkName": "",
"composite": "true",
"featureLimit": "1000000",
"useDefaultSnippets": "false"
}
},
{
"typeName": "WFSServer",
"capabilities": "",
"enabled": "false",
"maxUploadFileSize": 0,
"allowedUploadFileTypes": "",
"properties": {
"appSchemaURI": "http://liuyu:6080/arcgis/services/PointsofInterest/MapServer/WFSServer",
"phone": "",
"providerSite": "",
"administrativeArea": "",
"electronicMailAddress": "",
"enableTransactions": "",
"city": "",
"title": "",
"postalCode": "",
"name": "PointsofInterest",
"customGetCapabilities": "false",
"deliveryPoint": "",
"role": "",
"axisOrderWFS10": "LongLat",
"axisOrderWFS11": "LatLong",
"serviceTypeVersion": "",
"accessConstraints": "",
"positionName": "",
"abstract": "",
"onlineResource": "http://liuyu:6080/arcgis/services/PointsofInterest/MapServer/WFSServer",
"facsimile": "",
"keyword": "",
"individualName": "",
"fees": "",
"serviceType": "",
"country": "",
"hoursOfService": "",
"providerName": "",
"pathToCustomGetCapabilitiesFiles": "",
"appSchemaPrefix": "PointsofInterest",
"contactInstructions": ""
}
},
{
"typeName": "SchematicsServer",
"capabilities": "Query",
"enabled": "false",
"maxUploadFileSize": 0,
"allowedUploadFileTypes": "",
"properties": {"supportsREST": "true"}
},
{
"typeName": "FeatureServer",
"capabilities": "Query,Create,Update,Delete,Uploads,Editing",
"enabled": "false",
"maxUploadFileSize": 0,
"allowedUploadFileTypes": "",
"properties": {
"allowGeometryUpdates": "true",
"xssPreventionEnabled": "true",
"maxRecordCount": "1000",
"editorTrackingTimeZoneID": "UTC",
"enableZDefaults": "false",
"realm": "",
"allowOthersToDelete": "false",
"allowTrueCurvesUpdates": "false",
"editorTrackingRespectsDayLightSavingTime": "false",
"zDefaultValue": "0",
"enableOwnershipBasedAccessControl": "false",
"editorTrackingTimeInUTC": "true",
"allowOthersToUpdate": "false"
}
},
{
"typeName": "WCSServer",
"capabilities": "",
"enabled": "false",
"maxUploadFileSize": 0,
"allowedUploadFileTypes": "",
"properties": {
"phone": "",
"maxImageHeight": "",
"maxImageWidth": "",
"city": "",
"providerWebsite": "",
"title": "",
"name": "PointsofInterest",
"customGetCapabilities": "",
"province": "",
"role": "",
"accessConstraints": "",
"abstract": "",
"onlineResource": "http://liuyu:6080/arcgis/services/PointsofInterest/MapServer/WCSServer",
"keywords": "",
"fax": "",
"zipcode": "",
"fees": "",
"country": "",
"responsiblePerson": "",
"providerName": "",
"responsiblePosition": "",
"email": "",
"address": "",
"pathToCustomGetCapabilitiesFiles": "",
"serviceHour": "",
"contactInstructions": ""
}
},
{
"typeName": "WMSServer",
"capabilities": "",
"enabled": "false",
"maxUploadFileSize": 0,
"allowedUploadFileTypes": "",
"properties": {
"abstract": "",
"onlineResource": "http://liuyu:6080/arcgis/services/PointsofInterest/MapServer/WMSServer",
"keyword": "",
"postCode": "",
"inheritLayerNames": "false",
"contactPosition": "",
"fees": "",
"addressType": "",
"contactVoiceTelephone": "",
"pathToCustomSLDFile": "",
"contactFacsimileTelephone": "",
"country": "",
"city": "",
"title": "",
"contactOrganization": "",
"address": "",
"contactElectronicMailAddress": "",
"customGetCapabilities": "false",
"name": "WMS",
"stateOrProvince": "",
"pathToCustomGetCapabilitiesFiles": "",
"accessConstraints": "",
"contactPerson": ""
}
}
],
"datasets": []
}
这个配置文件的信息指向了一个MSD文档 位置为Z:\\home\\Soft\\ArcGIS\\server\\arcgis\\server\\usr\\directories\\arcgissystem\\arcgisinput\\PointsofInterest.MapServer\\extracted\\v101\\PointsofInterest.msd,而这个文档使用的数据/home/Soft/ArcGIS/server/arcgis/server/usr/directories/arcgissystem/arcgisinput/PointsofInterest.MapServer/extracted/v101,这个目录下有一个gdb的数据库,所以这个msd的数据的范围就来自这里(到这里我们可以知道和一个切片服务相关的目录有这些: Services目录,arcgissystem\arcgisinput目录和Cache目录)。按照这个推理,我自己创建了一个要素类,画了几个多边形,发布服务,替换切片,结果又不能让人满意,因为地图服务可以重合但是范围小了,于是我打开这个/extracted/v101目录下的数据跟地图服务叠加,效果如下:
我们知道ArcGIS 10.1 for Server在发布数据的时候会copy原来数据库中的数据(如果注册了就不用了),Copy后自己重新计算了要素类的范围。
现在原因算是找到了,如果将这个服务的范围修改为跟要替换的切片是一样的,应该就不会有问题。将原先的切片加载到ArcMap中,创建一个范围大小和这个一样的要素类(点,先,面)都可以,我这里用的是面数据,创建后的要素类如下:
然后将这个要素类发布服务,在发布的时候,选择定义好的的切片结构,然后选择手动切片,如下图:
这样发布之后然后替换切片目录即可。效果如下图:
通过上面的分析要在10.1中使用早先已经切好的切片,我们用与该切片数据源范围必须一致的数据做地图文档,发布,然后切片,然后替换这样就OK了,那我如何得到原来图的范围呢,10.0的时候我们可以将所有的切片作为一个栅格数据加进来,创建一个等范围的要素类,然后发布服务,然后替换,现在大家知道如何做了吧?