0

I have 3 point feature classes (test30, test90, test180) in a scratch.gdb. I would like to create a kernel density raster for each dataset. I would like the output of the kernel density raster to be saved in the scratch.gdb.

The error I am receiving is ERROR 010093: Output raster format UNKNOWN is unsupported. Can I save a kernel density raster to a File Geodatabase?

I am new to python and functions, so I may have some of this logic written incorrectly.

ArcDesktop 10.3.1

import os, sys, re, shutil
import arcpy
from arcpy.sa import *
import arceditor


cwd = os.getcwd()

scratchGDB = r'C:\Users\test\scratch.gdb'
arcpy.env.workspace = scratchGDB
arcpy.env.overwriteOutput = True


# kenrnel density
def kernel_density(dataset):

    try:
        if arcpy.CheckExtension("Spatial") == "Available":
            arcpy.CheckOutExtension("Spatial")
        else:
            raise LicenseError


        kd = KernelDensity(dataset, population_field='NONE', cell_size=1000, search_radius=50000, area_unit_scale_factor='SQUARE_MILES')

        kd.save(scratchGDB)

    finally:
            arcpy.CheckInExtension("Spatial")

kernel_density('test180')
kernel_density('test90')
kernel_density('test30')
  • Two things I would check: The KernelDensity didn't run successfully and outputs something strange, I'm not sure how to check that. Also, you are saving in your GDB without specifying a name for your output data, I think it should be something like kd.save(scratchGDB+"\\"+"kd_output") – chrki Aug 25 '16 at 21:19
  • For any code snippets presented here please remove the try/except blocks that can mask errors, and then present precisely the test you run and any errors it outputs. – PolyGeo Aug 25 '16 at 21:43
  • @chrki That worked! – a1234 Aug 25 '16 at 21:46
1

You are trying to save the KernelDensity result in your GDB without specifying a name for your output data:

kd.save(scratchGDB)

You have to add a name for your output layer, it may look like this:

kd.save(scratchGDB + "\\" + dataset + "_kd")
# resulting name: C:\Users\test\scratch.gdb\test180_kd

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.