2

I have made a style with all my values and colours for my floodmap. I can match them manually at the properties, but is there a way (maybe with Python) to do this automatically in ArcMap?

When they add some new floods to the map it would be great if the colour based on the total floods will change automatically, because these floods are in despite a non-stop problem.

Does somebody know something for this?

2
  • If you name symbols in a style to match the values in a feature you can automatically match them. See esri.com/esri-news/arcwatch/1116/…
    – John
    Commented Dec 2, 2016 at 12:31
  • This also was my first idea, but I wasn't sure if the colour would change when there will be more floods at the riverbasin in future. Commented Dec 2, 2016 at 13:16

1 Answer 1

2

I suppose the right way is to use symbology layers, i.e. *.lyr file Firstly make a style of your layer in properties, then save your layer from Table of Contents to lyr file (Save as Layer file). Once this file is created you can use two ways:

  1. Make a model

In model builder add "Apply symbology from Layer" tool. Input is your floods layer. Symbology layer - the path to lyr file you made before.

  1. Make a script.

Complicated one but works fine for me.

import arcpy
from arcpy import env
mxd = arcpy.mapping.MapDocument("CURRENT")
df = mxd.activeDataFrame

#Add symbology layer to TOC

ary = arcpy.mapping.Layer(r"\\PATH TO YOUR LYR FILE\symbology.lyr")
arcpy.mapping.AddLayer (df,ary,"AUTO_ARRANGE")

#Apply symbology for Floods

for lyr in arcpy.mapping.ListLayers(mxd, "",df):
     if lyr.name == "Floods":
         arcpy.ApplySymbologyFromLayer_management("floods","symbology")

#Remove symbology layer from TOC (not necessary)

for lyr in arcpy.mapping.ListLayers(mxd, "",df):
         if lyr.name == "symbology":
             arcpy.mapping.RemoveLayer(df,lyr)
4
  • Sorry, I see i didn't explain it completely well. The floods are written in Excel and imported to arcgis, not placed in a attribute tabel of a layer. As far as I could see you can't make a lyr file from a table right? Commented Dec 2, 2016 at 13:08
  • Honestly, I can not imagine how is it possible to make symbology for Excel features. Anyway, to make a view of what you have in Excel, you should have a feature class at least with polygons of floods without attributes. Then you convert your *.xls table to *.dbf format (can be performed from ArcToolbox-Conversion Tools, then add it to Table of contents and join floods feature layer to dbf table by specific field Commented Dec 2, 2016 at 13:23
  • I made polygons by myself in arcgis and I have documented information about the floods in Excel. I already imported those tables to the specific layer, but you say import the layers to the table? Why is that? Commented Dec 2, 2016 at 13:35
  • Not layers to table but if you want to have your symbology layer based on specific parameters from table, you should add this data to layer's attribute table Commented Dec 2, 2016 at 13:48

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.