How to use false color composite renderer?

666
1
08-18-2020 09:16 AM
EdCarlos
New Contributor

From jupyter notebook, I am trying to add a layer "USA NAIP Imagery", which is in color infrared,  in my map using the map.add_layer().  The image rendered is in natural color and not in false color.

It works fine using ArcGIS online when I create a map with the same layer and save it. Also, if I load the saved map in jupyter notebook using MapView the false color renders as expected.

I tried passing a renderer called FalseColorComposite in the map.add_layer() but still doesn't work. 

Any suggestions or corrections?

Thanks
ed

myMap = gis.map("Sedona, AZ")
myMap

image_search2_title = "USA NAIP Imagery"
image_search2 = gis.content.search(image_search2_title, item_type="Imagery Layer", outside_org=True)
image_search2

for image in image_search2:
    if image.title == image_search2_title + ": Color Infrared":
        image_layer2 = gis.content.get(image.id)
        break
image_layer2

myMap.add_layer(image_layer2, options={'opacity': 1.0, "type": "FeatureLayer", "renderer": "FalseColorComposite", "field_name: "band_indexes"})
myMap

0 Kudos
1 Reply
EdCarlos
New Contributor

i figured out how to apply the FalseColorComposite renderer.

I had to use the layer embedded in the map to get the raster functions instead of using the image layer found by the content manager.

myMap.layers[0].properties.rasterFunctionInfos ## i only had one layer so I have an index of 0

Once I got the list of raster functions, it was just a matter of passing in the raster function name using the syntax below

myMap.add_layer(image_layer2, {"imageServiceParameters" :{ "renderingRule": { "rasterFunction": "FalseColorComposite"}}})

0 Kudos