currently I have a problem that I can't explain from docs.
1. When I load a mosaic dataset into my ArCGIS Pro 2.6 map as a layer.
2. I can access the mosaics "Image" layer from python window
layer = map.listLayers("Image")
3. Now why does layer.symbology doesn't have a colorizer or renderer property?
AttributeError: 'Symbology' object has no attribute 'colorizer'
AttributeError: 'Symbology' object has no attribute 'renderer'
From docs I would expect that raster layers always have a colorizer and vector layers have a renderer.
So I have a raster layer with no symbology at all oO? And how can I set it? In Pro itself I can easily set classified colors on that layer.
Any help would be really appreciated.
First off, it looks like you are using the ArcPy library. If that is the case, you may want to reach out to the Python Community instead.
As for your question, I am curious as to how your raster dataset displays in ArcGIS Pro when you added it. Is it RGB? Classified? Unique values? Stretched?
If it's RGB, then it won't have a colorizer or renderer property. If you manually change the symbology for the raster layer to use class breaks, stretched ramp, or unique values, you will notice that the layer.symbology.colorizer property does get defined.
Hope this helps.
thank you very much for your answer and sorry for posting into the wrong community. Maybe I was a little bit confused because in my Jupyter Notebook project I'm using arcpy, arcpy.mp and arcgis API as well.
In my workflow I'm:
1. Creating a new mosaic dataset
create_mosaic_result = arcpy.management.CreateMosaicDataset( fgdb_path, md_name, arcpy.SpatialReference(25832), 1, "32_BIT_FLOAT", NONE", None)
2. I'm referencing a singe TIFF from folder to the mosaic dataset
add_raster_to_mosaic_result = arcpy.management.AddRastersToMosaicDataset( os.path.join(fgdb_path, md_name), "Raster Dataset", raster_data_folder, "UPDATE_CELL_SIZES", "UPDATE_BOUNDARY", "NO_OVERVIEWS", None, 1, 1500, arcpy.SpatialReference(25832), '', "NO_SUBFOLDERS", "ALLOW_DUPLICATES", "BUILD_PYRAMIDS", "CALCULATE_STATISTICS", "BUILD_THUMBNAILS", '', "FORCE_SPATIAL_REFERENCE", "ESTIMATE_STATISTICS", None, "NO_PIXEL_CACHE", "")
3. If I add mosaic dataset to the map, the layer contains Boundary, Footprint and Image while Image ranges from value 0.2 to 10 with stretched greyscale (single band 32 bit float as defined in create statement above) and if I access the layer with arcpy.mp it's symbology is missing both attributes.
You say I can change colorizer manually but I need to do it from code. So can I initialize Symbology or just a colorizer like RasterClassifyColorizer and assign it to the layer?
If I have a predefined raster processing template in the mosaic dataset. Can I activate it programmatically to change the layer appearance?
I'm not sure about raster processing templates, but you could also try creating a raster dataset, symbolizing it with class breaks manually, saving the layer file, and then applying the symbology to the new layer.