Last active
February 26, 2019 21:58
-
-
Save OterLabb/3c73bf5a771f56f0e97e390296b0cd59 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Converting kmz to raster | |
for kmz in kmzList: | |
arcpy.AddMessage("Converting {0} of {1} .kmz files".format(firstCount,count)) | |
kmzFile = os.path.join(tempFolder, kmz + '.kmz') | |
arcpy.KMLToLayer_conversion(kmzFile, tempFolder, kmz, True) | |
firstCount += 1 | |
# Enable adding data to map again and arcpy.AddMessage status | |
arcpy.env.addOutputsToMap = 1 | |
arcpy.AddMessage("Creating raster mosaic dataset") | |
# create gdb | |
arcpy.CreateFileGDB_management(inFolder, 'mosaic.gdb') | |
# Move GroundOverlay folder from temp folder | |
shutil.move(os.path.join(tempFolder, 'GroundOverlay'), inFolder) | |
# Variables for new mosaic dataset | |
gdbname = os.path.join(inFolder, 'mosaic.gdb') | |
mdname = "mosaicds" | |
coords = spatialRef | |
noband = "3" | |
pixtype = "8_BIT_UNSIGNED" | |
pdef = "NONE" | |
wavelength = "" | |
# Create new mosaic dataset | |
arcpy.CreateMosaicDataset_management(gdbname, mdname, coords, noband, pixtype, pdef, wavelength) | |
# Variables needed for adding rasters to Mosaic Dataset | |
mdname = os.path.join(inFolder, 'mosaic.gdb', 'mosaicds') | |
rastype = "Raster Dataset" | |
inpath = os.path.join(inFolder, 'GroundOverlay') | |
updatecs = "NO_CELL_SIZES" | |
updatebnd = "NO_BOUNDARY" | |
updateovr = "UPDATE_OVERVIEWS" | |
maxlevel = "" | |
maxcs = "#" | |
maxdim = "#" | |
spatialref = "#" | |
inputdatafilter = "*.png" | |
subfolder = "NO_SUBFOLDERS" | |
duplicate = "OVERWRITE_DUPLICATES" | |
buildpy = "NO_PYRAMIDS" | |
calcstats = "NO_STATISTICS" | |
buildthumb = "NO_THUMBNAILS" | |
comments = "Add Raster Datasets" | |
forcesr = "#" | |
estimatestats = "NO_STATISTICS" | |
auxilaryinput = "" | |
enablepixcache = "" | |
cachelocation = tempFolder | |
# Build Raster Mosaic Dataset | |
arcpy.AddRastersToMosaicDataset_management(mdname, rastype, inpath, updatecs, updatebnd, updateovr, | |
maxlevel, maxcs, maxdim, spatialref, inputdatafilter, subfolder, duplicate, buildpy, calcstats, | |
buildthumb, comments, forcesr, estimatestats, auxilaryinput, enablepixcache, cachelocation) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment