Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Possible Duplicate:
Change Symbology of layers from within ArcMap

I need to write a script to change the symbology of the layer. I've read all the topics about symbology in ArcGIS-help and still haven't find the solution. I made my own symbol in corel, imported it to ArcGIS then I made a layer file (.lyr)..

ArcGIS help says: " When a model is run from its tool dialog box, you can specify how model outputs are to be symbolized when added to the ArcMap table of contents. This can be performed in two ways:

Using a layer symbology file
Using the Apply Symbology From Layer tool"

So I need to do it by the first method. There is also topic "Setting output symbology in scripts" ( I guess its nearly that what i'm trying to do) It says:

Set the symbology of the output.

#   output    = the output value
#   params[2] = the output parameter
#
params = arcpy.GetParameterInfo()
desc = arcpy.Describe(output)
if desc.shapeType == "Polygon":
    params[2].symbology = "c:/Tools/Extractor/ToolData/polygon.lyr"
elif desc.shapeType == "Polyline":
    params[2].symbology = "c:/Tools/Extractor/ToolData/polyline.lyr"
else:
    params[2].symbology = "c:/Tools/Extractor/ToolData/point.lyr"

I cant understand that. How to use it. The layer I want to change the symbology of is named "Three" so in the place of (output) i have to choose this layer... but what next? If I only have a layer with one kind of shape (point)

Can somebody help me? ( I have no idea about creating the scripts :) )

share|improve this question

marked as duplicate by artwork21, Aragon, iant, Devdatta Tengshe, whuber Dec 19 '12 at 16:42

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

add comment

1 Answer 1

It should be rather a comment than the actual answer, but from http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00170000006n000000:

import arcpy
arcpy.ApplySymbologyFromLayer_management("sf_points", "sf_points_water.lyr") ##, where "sf_points" is your point .lyr and "sf_points_water.lyr" is template .lyr.

Look at Applying layer file not formating labels in ARCGIS 10 or any gis.stackexchange question containing arcpy.ApplySymbologyFromLayer_management, so you have a glimpse how to construct script with this tool.

Edit: Sorry misread your question. Above would help you to prepare script of your own, but its seems like you are trying to amend already existing script, right? The question is a little bit unclear. What do you exactly need to do?

share|improve this answer
    
Thank you for the answer. I need to do a script to apply symbology to my layer, but i cannot do it by the "ApplySymbologyFromLayer" (my supervisor just said so). And my question is: Is there any different method to do it? i.e. by applying symbology from file (.lyr) - not from layer. If yes how to do it? The above script is what i found in ArcGIS help.. so ive been trying to use it for my work but it seems like my skills arent enough :) –  Justyna Dec 19 '12 at 12:26
1  
Just to be clear, .lyr is a file with symbology configuration (layer representation), so it is exacly what you are trying to accomplish. –  Tomek Dec 19 '12 at 12:37
    
But how can i import (by script) that file to layer im currently workin on?? –  Justyna Dec 19 '12 at 16:07
add comment

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