Layer symbology is not rendered as expected

524
0
12-27-2019 01:55 AM
kunalsuryavanshi
New Contributor

I am developing an ArcGIS Pro python tool. I am using "JSONToFeatures_conversiontool" to convert Esri GeoJson to feature class.

After adding a layer to map I am changing the symbology. 

1. on the output layer (Point Layer ) -

   scriptPath = sys.argv[0]

   toolSharePath = os.path.dirname(os.path.dirname(scriptPath))

   dataPath = os.path.join(toolSharePath, 'iGeolise')

   pointLyrPath = os.path.join(dataPath, 'updateFilterSymbol.lyrx')

   params = arcpy.GetParameterInfo() desc = arcpy.Describe(Output_layer)

   params[symbology_index].symbology = pointLyrPath 

2.  Using custom renderer  (Polyline layer)-  

   layerName = (arcpy.Describe(Output_layer)).baseName

   p = arcpy.mp.ArcGISProject('CURRENT') m = p.listMaps('Map')[0] m.addDataFromPath(Output_layer)

   lyr = m.listLayers(layerName)    

   for l in lyr: if l.name == layerName :

         classBreakValues = [5.0,15.0,30.0,60.0,120.0,300.0,14400]

         classBreakLowerValues = [0, 5, 15, 30, 60, 120, 300]

         classBreakLabels = ["0-5 min", "5-15 min", "15-30 min", "30-60 min", "1-2 hrs","2-5 hrs",">5 hrs"]

         sym = l.symbology

         if sym.renderer.type == 'SimpleRenderer':

                sym.updateRenderer('GraduatedColorsRenderer')

                sym.renderer.breakCount = len(classBreakValues)

                sym.renderer.classificationField = 'travel_time'

               sym.renderer.nomalizationType = ''

               sym.renderer.colorRamp = p.listColorRamps('Yellow to Red')[0]

               count = 0

               for brk in sym.renderer.classBreaks:

                     brk.upperBound = classBreakValues[count]

                    brk.label = classBreakLabels[count]

                    count += 1

l.symbology = sym

It is working fine on large data, but when on the very small data(1 to 3 records), symbology is not rendered as its expected behavior.
I have attache the layers please refer to generate the result.
Need help to solved this. 
0 Kudos
0 Replies