2

I would like to change the file description with a python code on ArcMap (10.6). I could not find a way to do it or resource explaining it.

Do you have any idea?

enter image description here

1 Answer 1

5

Take a look at Layer - ArcGIS Desktop Help.

lyr = arcpy.mapping.ListLayers(mxd)[0]
lyr.description = "This is the description of this layer"
4
  • Thank you @Midavalo . I figured how to work this out but also realized that is not what I wanted. I do not have a map file (.mxd) or layer file (.lyr). I have bunch of raster files that I want to put the same description for each of them. I guess it involves with metadata manipulation. As far as I understand this method creates a layer or read layers from a map document. For example, if I send my original file (.img) to somebody without the layer file, he will not see the description I created, right?
    – Amadeus
    Commented Aug 9, 2018 at 20:49
  • @OguzSariyildiz Correct. Also if you send the original .img file to somebody without the metadata file, he will not see the description.
    – Midavalo
    Commented Aug 10, 2018 at 1:36
  • I cant get this to work from within ArcMap. I need to set the description of all layers in a document. I've tried saving the mxd, save a copy, export the layer to lyr. The description is not set. Do you know why?
    – Bera
    Commented Sep 5, 2022 at 12:41
  • 1
    @BERA I wonder if there's been a change in the syntax since 2018? I'll take a look next time I'm at my PC and see what happens for me.
    – Midavalo
    Commented Sep 7, 2022 at 0:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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