Copying lots of data out of an image service?

2297
1
12-02-2013 02:42 PM
ChrisSnyder
Regular Contributor III
So I have this image service that I want to use to batch extract some data out of. The issue I am running into is that via Python you must limit each "clip" to a predefined extent limit... in my case: 4100 rows x 15000 columns.

Funny thing is that if I just "drag" the image layer from ArcMap into... say the CopyRaster tool... I can download as big of a tile as I want... but only if I connect to the image service directly through ArcMap.

I've seen this post (http://forums.arcgis.com/threads/59661-Setting-the-Maximum-image-size-per-request-for-an-Image-Servi...) about getting the image service admins to change the default max tile size, but... Why does this work via ArcMap and not a Python script? And specifically, how can I get my Python script to perform (and download whatever size tile I want!) like ArcMap?!?! This is what some basic code looks like... but bombs if the tile polygon is "too big":

import arcpy
arcpy.env.overwriteOutput = True
arcpy.SetLogHistory(False)
arcpy.env.pyramid = "None"
arcpy.env.rasterStatistics = "None"
naipImgPath = r"\\snarf\am\div_lm\ds\gis\tools\sde_connections_read\arcgis_geoservices.wa.gov\ImageServices\Statewide_2011_1m_434color_wsps_83h_img_blah_blah_so_u_dont_f_with_it.ImageServer"
clipFC = r"C:\csny490\test.shp" #this assumes to have multiple polygons and a field called TILE_ID
outDir = r"C:\csny490\temp" #Folder where the clipped outputs will go
arcpy.env.snapRaster = naipImgPath
searchRows = arcpy.da.SearchCursor(clipFC, ["SHAPE@","TILE_ID"])
for searchRow in searchRows:
    shapeObj, tileId = searchRow
    outRaster = outDir + "\\clip_tile_" + str(tileId) + ".img"
    arcpy.env.extent = shapeObj.extent
    arcpy.MakeImageServerLayer_management(naipImgPath, "image_server_layer") #bombs with "tile too big" if done before the cursor
    arcpy.CopyRaster_management("image_server_layer", outRaster, pixel_type="8_BIT_UNSIGNED")
del searchRow, searchRows
0 Kudos
1 Reply
ChrisSnyder
Regular Contributor III
Bump back up
0 Kudos