I'm trying to run arcgis.raster.functions.gbl.kernel_density (link to docs). I think I'm running it ok, but I have no idea what to do with the output! The docs just say you get an output raster, no samples included, and even Google search doesn't turn up much.
I create an input like this:
from arcgis import GIS import arcgis gis = GIS(profile="AGOL") points_item = gis.content.get('abcdefg123456...') points_fl = arcgis.features.FeatureLayer(points_item)
I tried running kernel density with the feature layer points_fl, but it only works if I use points_item as the input. That seems odd, but it works, or at least it stops giving me an error. Here is what I'm trying:
out_raster = arcgis.raster.functions.gbl.kernel_density( points_item, '<fieldname>', cell_size=1000, search_radius=2000, area_unit_scale_factor='SQUARE_MAP_UNITS', out_cell_values='DENSITIES', method='PLANAR', in_barriers=None)
I have confirmed that the Kernel Density GP tool in Pro works with this data set and these settings, so my inputs and parameters are valid as far as I can tell. If I do a type(out_raster), I get arcgis.raster._layer.ImageryLayer. With any attempt to find out about this raster, I get an error. Something as simple as trying to print out_raster.raster_info gives my a lengthy traceback, but this is the crux of it:
Exception: Invalid or missing input parameters.
Authentication token required. (status code 499).
(Error Code: 400)
Same for trying to access the columns or rows properties, which seem like pretty basic things you should be able to find out about a raster. Interestingly, if I try this in an AGOL notebook where I definitely should be signed in, I get the same error.
Can anyone tell me how to work with kernel density output and what I can do with it? So far, I just know kernel density ran and didn't fail, but have no idea how to do anything with the output.
Side note: I am also unable to run the out_raster.save() function. I also get a large traceback, but the main error is "RuntimeError: Unable to create service". I think I am just missing a role to create imagery services or something, because I lack any option to create them in Pro or on the AGOL website. I'm going to work on that before I worry about this part of it...