0

I have a Python script that read csv files containing location and attributes for several objects and put all of them in a geodatabase. I modified this script adding also a TIFF imagine with the bathymetry of the interested region using RasterToGeodatabase_conversion.

When I open the gdb file in ArcGIS the bathymetry is in black & white and I have to modify it manually.

What I want is to set the bathymetry map colour thought the Python script.

Looking around I discovered that I can export to a xml file template with the changes I have done manually to the bathymetry map using the button Export raster function template... in Layer Propertis\Symbology.

I tried to use this xml file in my script in this way:

mdname = r"D:\Projects\test_map_colour.gdb\GEBCO_Geotiff"
editmode = "EDIT_MOSAIC_DATASET"
editmethod = "INSERT"
funcfile = r"D:\Projects\Stretched.rft.xml"
funcname = "#"

arcpy.EditRasterFunction_management(mdname, editmode, editmethod, funcfile, funcname)

but I obtain the error:

Traceback (most recent call last):
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.1.1\helpers\pydev\_pydevd_bundle\pydevd_exec.py", line 3, in Exec
    exec exp in global_vars, local_vars
  File "<input>", line 1, in <module>
  File "C:\Program Files (x86)\ArcGIS\Desktop10.6\arcpy\arcpy\geoprocessing\_base.py", line 510, in <lambda>
    return lambda *args: val(*gp_fixargs(args, True))
ExecuteError: ERROR 000582: Error occurred during execution.

I don't think I really understand how to use the EditRasterFunction function neither if this is the right way to do it... Do you have any suggestion?

Update

I tried to save the modified bathymetry map, with the color and limits I want, into a layer file (.lyr). Opening the .lyr file in ArcMap, it keeps the settings. Then I tried to save it into the .gdb file using ArcPy, in this way:

arcpy.CopyFeatures_management(r'D:\Projects\test_map.tif.lyr',
                              r'D:\Projects\test_map_colour.gdb\map')

but I obtain the error:

arcgisscripting.ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000840: The value is not a Feature Layer.
ERROR 000840: The value is not a Raster Catalog Layer.
Failed to execute (CopyFeatures).

I also tried to export it using ArcMap with Data\Export Data... into the .gdb file, but I obtain the B&W imagine.

Any suggestion? What I want is to have the colored imagine in the .gdb file, the way to obtain it is not important.

0

I don't know if this is the right solution, but I decided to create a Group Layer, set all the layer properties manually in ArcMap and save it in a .lyr file. At the end I will have 2 files, the .gdb with the data and the .lyr with the layer properties, and not just one, but it's fine.

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.