SHARE
TWEET

Untitled

a guest May 23rd, 2018 88 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import arcpy
  2. import os
  3.  
  4.  
  5. # Local variables:
  6. Input_Service = "http://geoerpdev:6080/arcgis/rest/services/tests/MondayFull12.MapServer"
  7. OutPut_Cache_Location_Path = "C:\Users\carmel.han\Desktop\Caching\Output"
  8. Manage_Mode = "RECREATE_ALL_TILES"
  9. Cache_Name__2_ = "wensday1"
  10. # Input_Data_Source = "Ov_i04_L02_R000005F1_C000004567892"
  11. Input_Tiling_Scheme = "IMPORT_SCHEME"
  12. Import_Tiling_Scheme = "C:\Users\carmel.han\Desktop\tests_monday\config2133.xml"
  13. Scales__Pixel_Size___Estimated_Disk_Space_ = "64000;32000;16000"
  14. #Area_of_Interest = "in_memory\{3B818E7A-1914-4D00-9C2C-E97C6744D7BC}"
  15. Area_of_Interest = "#"
  16. Maximum_Source_Cell_Size = ""
  17. Minimum_Cached_Scale = "64000"
  18. Maximum_Cached_Scale = "16000"
  19. #Cache_Name = "C:\Users\carmel.han\Desktop\Wensday\wensday2"
  20. Source_Tile_Package = ""
  21. Upload_data_to_server = "false"
  22. Scales = "64000;32000;16000"
  23. Number_of_caching_service_instances = "3"
  24. Area_Of_Interest__Polygon_ = "in_memory\{8BBC3764-B579-4CCF-847B-E1D1E428CE1C}"
  25. #Area_Of_Interest__Polygon_ = "#"
  26. Overwrite_Tiles = "false"
  27. Output_Map_Service_URL = "http://geoerpdev:6080/arcgis/rest/services/System/CachingControllers/GPServer/ImportCache/jobs/j98c38213db434a8da6aec04aacb259c3"
  28. Source_Cache_Dataset = "C:\Users\carmel.han\Desktop\Wensday\Wensday1"
  29. directory = "C:\Users\carmel.han\Desktop\Caching\Input"
  30.  
  31. for Input_Data_Source in os.listdir(directory):
  32.     print (Input_Data_Source)
  33.     if Input_Data_Source.endswith(".tif") or Input_Data_Source.endswith(".ecw"):
  34.         Input_Data_Raster = directory + "\" + Input_Data_Source
  35.         print ("Input: " + Input_Data_Raster)
  36.         try:
  37.             os.stat(OutPut_Cache_Location_Path)
  38.         except:
  39.             os.mkdir(OutPut_Cache_Location_Path)
  40.         print ("Output: "+ OutPut_Cache_Location_Path)
  41.  
  42.         # Process: Manage Tile Cache
  43.         tempEnvironment0 = arcpy.env.newPrecision
  44.         arcpy.env.newPrecision = "SINGLE"
  45.         tempEnvironment1 = arcpy.env.autoCommit
  46.         arcpy.env.autoCommit = "1000"
  47.         tempEnvironment2 = arcpy.env.XYResolution
  48.         arcpy.env.XYResolution = ""
  49.         tempEnvironment3 = arcpy.env.processingServerUser
  50.         arcpy.env.processingServerUser = ""
  51.         tempEnvironment4 = arcpy.env.XYDomain
  52.         arcpy.env.XYDomain = ""
  53.         tempEnvironment5 = arcpy.env.processingServerPassword
  54.         arcpy.env.processingServerPassword = ""
  55.         tempEnvironment6 = arcpy.env.scratchWorkspace
  56.         arcpy.env.scratchWorkspace = "C:\Users\carmel.han\Documents\ArcGIS\Default.gdb"
  57.         tempEnvironment7 = arcpy.env.cartographicPartitions
  58.         arcpy.env.cartographicPartitions = ""
  59.         tempEnvironment8 = arcpy.env.terrainMemoryUsage
  60.         arcpy.env.terrainMemoryUsage = "false"
  61.         tempEnvironment9 = arcpy.env.MTolerance
  62.         arcpy.env.MTolerance = ""
  63.         tempEnvironment10 = arcpy.env.compression
  64.         arcpy.env.compression = "LZ77"
  65.         tempEnvironment11 = arcpy.env.coincidentPoints
  66.         arcpy.env.coincidentPoints = "MEAN"
  67.         tempEnvironment12 = arcpy.env.randomGenerator
  68.         arcpy.env.randomGenerator = "0 ACM599"
  69.         tempEnvironment13 = arcpy.env.outputCoordinateSystem
  70.         arcpy.env.outputCoordinateSystem = ""
  71.         tempEnvironment14 = arcpy.env.rasterStatistics
  72.         arcpy.env.rasterStatistics = "STATISTICS 1 1"
  73.         tempEnvironment15 = arcpy.env.ZDomain
  74.         arcpy.env.ZDomain = ""
  75.         tempEnvironment16 = arcpy.env.transferDomains
  76.         arcpy.env.transferDomains = "false"
  77.         tempEnvironment17 = arcpy.env.resamplingMethod
  78.         arcpy.env.resamplingMethod = "NEAREST"
  79.         tempEnvironment18 = arcpy.env.snapRaster
  80.         arcpy.env.snapRaster = ""
  81.         tempEnvironment19 = arcpy.env.projectCompare
  82.         arcpy.env.projectCompare = "NONE"
  83.         tempEnvironment20 = arcpy.env.cartographicCoordinateSystem
  84.         arcpy.env.cartographicCoordinateSystem = "PROJCS['WGS_1984_UTM_Zone_35S',GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]],PROJECTION['Transverse_Mercator'],PARAMETER['False_Easting',500000.0],PARAMETER['False_Northing',10000000.0],PARAMETER['Central_Meridian',27.0],PARAMETER['Scale_Factor',0.9996],PARAMETER['Latitude_Of_Origin',0.0],UNIT['Meter',1.0]]"
  85.         tempEnvironment21 = arcpy.env.configKeyword
  86.         arcpy.env.configKeyword = ""
  87.         tempEnvironment22 = arcpy.env.outputZFlag
  88.         arcpy.env.outputZFlag = "Same As Input"
  89.         tempEnvironment23 = arcpy.env.qualifiedFieldNames
  90.         arcpy.env.qualifiedFieldNames = "true"
  91.         tempEnvironment24 = arcpy.env.tileSize
  92.         arcpy.env.tileSize = "128 128"
  93.         tempEnvironment25 = arcpy.env.parallelProcessingFactor
  94.         arcpy.env.parallelProcessingFactor = ""
  95.         tempEnvironment26 = arcpy.env.pyramid
  96.         arcpy.env.pyramid = "PYRAMIDS -1 NEAREST DEFAULT 75 NO_SKIP"
  97.         tempEnvironment27 = arcpy.env.referenceScale
  98.         arcpy.env.referenceScale = ""
  99.         tempEnvironment28 = arcpy.env.processingServer
  100.         arcpy.env.processingServer = ""
  101.         tempEnvironment29 = arcpy.env.extent
  102.         arcpy.env.extent = "DEFAULT"
  103.         tempEnvironment30 = arcpy.env.XYTolerance
  104.         arcpy.env.XYTolerance = ""
  105.         tempEnvironment31 = arcpy.env.tinSaveVersion
  106.         arcpy.env.tinSaveVersion = "CURRENT"
  107.         tempEnvironment32 = arcpy.env.nodata
  108.         arcpy.env.nodata = "NONE"
  109.         tempEnvironment33 = arcpy.env.MDomain
  110.         arcpy.env.MDomain = ""
  111.         tempEnvironment34 = arcpy.env.spatialGrid1
  112.         arcpy.env.spatialGrid1 = "0"
  113.         tempEnvironment35 = arcpy.env.cellSize
  114.         arcpy.env.cellSize = "MAXOF"
  115.         tempEnvironment36 = arcpy.env.outputZValue
  116.         arcpy.env.outputZValue = ""
  117.         tempEnvironment37 = arcpy.env.outputMFlag
  118.         arcpy.env.outputMFlag = "Same As Input"
  119.         tempEnvironment38 = arcpy.env.geographicTransformations
  120.         arcpy.env.geographicTransformations = "NAD_1927_To_NAD_1983_NADCON;NAD_1927_To_NAD_1983_NADCON"
  121.         tempEnvironment39 = arcpy.env.spatialGrid2
  122.         arcpy.env.spatialGrid2 = "0"
  123.         tempEnvironment40 = arcpy.env.ZResolution
  124.         arcpy.env.ZResolution = ""
  125.         tempEnvironment41 = arcpy.env.mask
  126.         arcpy.env.mask = ""
  127.         tempEnvironment42 = arcpy.env.spatialGrid3
  128.         arcpy.env.spatialGrid3 = "0"
  129.         tempEnvironment43 = arcpy.env.maintainSpatialIndex
  130.         arcpy.env.maintainSpatialIndex = "false"
  131.         tempEnvironment44 = arcpy.env.workspace
  132.         arcpy.env.workspace = "C:\Users\carmel.han\Documents\ArcGIS\Default.gdb"
  133.         tempEnvironment45 = arcpy.env.MResolution
  134.         arcpy.env.MResolution = ""
  135.         tempEnvironment46 = arcpy.env.derivedPrecision
  136.         arcpy.env.derivedPrecision = "HIGHEST"
  137.         tempEnvironment47 = arcpy.env.ZTolerance
  138.         arcpy.env.ZTolerance = ""
  139.         arcpy.ManageTileCache_management(OutPut_Cache_Location_Path, Manage_Mode, os.path.splitext(Input_Data_Source)[0], Input_Data_Raster, Input_Tiling_Scheme, Import_Tiling_Scheme, Scales__Pixel_Size___Estimated_Disk_Space_, Area_of_Interest, Maximum_Source_Cell_Size, Minimum_Cached_Scale, Maximum_Cached_Scale)
  140.  
  141.  
  142.         # Process: Import Map Server Cache
  143.         print ("Importing new cache to tiling service...")
  144.         Cache_Name = OutPut_Cache_Location_Path + "\" +  os.path.splitext(Input_Data_Source)[0]
  145.         print (Cache_Name)
  146.         tempEnvironment0 = arcpy.env.newPrecision
  147.         arcpy.env.newPrecision = "SINGLE"
  148.         tempEnvironment1 = arcpy.env.autoCommit
  149.         arcpy.env.autoCommit = "1000"
  150.         tempEnvironment2 = arcpy.env.XYResolution
  151.         arcpy.env.XYResolution = ""
  152.         tempEnvironment3 = arcpy.env.processingServerUser
  153.         arcpy.env.processingServerUser = ""
  154.         tempEnvironment4 = arcpy.env.XYDomain
  155.         arcpy.env.XYDomain = ""
  156.         tempEnvironment5 = arcpy.env.processingServerPassword
  157.         arcpy.env.processingServerPassword = ""
  158.         tempEnvironment6 = arcpy.env.scratchWorkspace
  159.         arcpy.env.scratchWorkspace = "C:\Users\carmel.han\Documents\ArcGIS\Default.gdb"
  160.         tempEnvironment7 = arcpy.env.cartographicPartitions
  161.         arcpy.env.cartographicPartitions = ""
  162.         tempEnvironment8 = arcpy.env.terrainMemoryUsage
  163.         arcpy.env.terrainMemoryUsage = "false"
  164.         tempEnvironment9 = arcpy.env.MTolerance
  165.         arcpy.env.MTolerance = ""
  166.         tempEnvironment10 = arcpy.env.compression
  167.         arcpy.env.compression = "LZ77"
  168.         tempEnvironment11 = arcpy.env.coincidentPoints
  169.         arcpy.env.coincidentPoints = "MEAN"
  170.         tempEnvironment12 = arcpy.env.randomGenerator
  171.         arcpy.env.randomGenerator = "0 ACM599"
  172.         tempEnvironment13 = arcpy.env.outputCoordinateSystem
  173.         arcpy.env.outputCoordinateSystem = ""
  174.         tempEnvironment14 = arcpy.env.rasterStatistics
  175.         arcpy.env.rasterStatistics = "STATISTICS 1 1"
  176.         tempEnvironment15 = arcpy.env.ZDomain
  177.         arcpy.env.ZDomain = ""
  178.         tempEnvironment16 = arcpy.env.transferDomains
  179.         arcpy.env.transferDomains = "false"
  180.         tempEnvironment17 = arcpy.env.resamplingMethod
  181.         arcpy.env.resamplingMethod = "NEAREST"
  182.         tempEnvironment18 = arcpy.env.snapRaster
  183.         arcpy.env.snapRaster = ""
  184.         tempEnvironment19 = arcpy.env.projectCompare
  185.         arcpy.env.projectCompare = "NONE"
  186.         tempEnvironment20 = arcpy.env.cartographicCoordinateSystem
  187.         arcpy.env.cartographicCoordinateSystem = "PROJCS['WGS_1984_UTM_Zone_35S',GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]],PROJECTION['Transverse_Mercator'],PARAMETER['False_Easting',500000.0],PARAMETER['False_Northing',10000000.0],PARAMETER['Central_Meridian',27.0],PARAMETER['Scale_Factor',0.9996],PARAMETER['Latitude_Of_Origin',0.0],UNIT['Meter',1.0]]"
  188.         tempEnvironment21 = arcpy.env.configKeyword
  189.         arcpy.env.configKeyword = ""
  190.         tempEnvironment22 = arcpy.env.outputZFlag
  191.         arcpy.env.outputZFlag = "Same As Input"
  192.         tempEnvironment23 = arcpy.env.qualifiedFieldNames
  193.         arcpy.env.qualifiedFieldNames = "true"
  194.         tempEnvironment24 = arcpy.env.tileSize
  195.         arcpy.env.tileSize = "128 128"
  196.         tempEnvironment25 = arcpy.env.parallelProcessingFactor
  197.         arcpy.env.parallelProcessingFactor = ""
  198.         tempEnvironment26 = arcpy.env.pyramid
  199.         arcpy.env.pyramid = "PYRAMIDS -1 NEAREST DEFAULT 75 NO_SKIP"
  200.         tempEnvironment27 = arcpy.env.referenceScale
  201.         arcpy.env.referenceScale = ""
  202.         tempEnvironment28 = arcpy.env.processingServer
  203.         arcpy.env.processingServer = ""
  204.         tempEnvironment29 = arcpy.env.extent
  205.         arcpy.env.extent = "DEFAULT"
  206.         tempEnvironment30 = arcpy.env.XYTolerance
  207.         arcpy.env.XYTolerance = ""
  208.         tempEnvironment31 = arcpy.env.tinSaveVersion
  209.         arcpy.env.tinSaveVersion = "CURRENT"
  210.         tempEnvironment32 = arcpy.env.nodata
  211.         arcpy.env.nodata = "NONE"
  212.         tempEnvironment33 = arcpy.env.MDomain
  213.         arcpy.env.MDomain = ""
  214.         tempEnvironment34 = arcpy.env.spatialGrid1
  215.         arcpy.env.spatialGrid1 = "0"
  216.         tempEnvironment35 = arcpy.env.cellSize
  217.         arcpy.env.cellSize = "MAXOF"
  218.         tempEnvironment36 = arcpy.env.outputZValue
  219.         arcpy.env.outputZValue = ""
  220.         tempEnvironment37 = arcpy.env.outputMFlag
  221.         arcpy.env.outputMFlag = "Same As Input"
  222.         tempEnvironment38 = arcpy.env.geographicTransformations
  223.         arcpy.env.geographicTransformations = "NAD_1927_To_NAD_1983_NADCON;NAD_1927_To_NAD_1983_NADCON;NAD_1927_To_NAD_1983_NADCON"
  224.         tempEnvironment39 = arcpy.env.spatialGrid2
  225.         arcpy.env.spatialGrid2 = "0"
  226.         tempEnvironment40 = arcpy.env.ZResolution
  227.         arcpy.env.ZResolution = ""
  228.         tempEnvironment41 = arcpy.env.mask
  229.         arcpy.env.mask = ""
  230.         tempEnvironment42 = arcpy.env.spatialGrid3
  231.         arcpy.env.spatialGrid3 = "0"
  232.         tempEnvironment43 = arcpy.env.maintainSpatialIndex
  233.         arcpy.env.maintainSpatialIndex = "false"
  234.         tempEnvironment44 = arcpy.env.workspace
  235.         arcpy.env.workspace = "C:\Users\carmel.han\Documents\ArcGIS\Default.gdb"
  236.         tempEnvironment45 = arcpy.env.MResolution
  237.         arcpy.env.MResolution = ""
  238.         tempEnvironment46 = arcpy.env.derivedPrecision
  239.         arcpy.env.derivedPrecision = "HIGHEST"
  240.         tempEnvironment47 = arcpy.env.ZTolerance
  241.         arcpy.env.ZTolerance = ""
  242.         print ("Good")
  243.         arcpy.ImportMapServerCache_server(Input_Service, "CACHE_DATASET", Cache_Name, Source_Tile_Package, Upload_data_to_server, Scales, Number_of_caching_service_instances, Area_Of_Interest__Polygon_, "DEFAULT", Overwrite_Tiles)
  244.         print ("Good")
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top