AnsweredAssumed Answered

Problem with setting renderer JSAPI 4.5

Question asked by rralbritton on Oct 3, 2017
Latest reply on Oct 3, 2017 by rralbritton

I'm trying to set the renderer property on a feature layer. I've tried a few different ways, all resulting in some type of rendering error:

app.layers = {

                         
    'allOffsiteLocations': new FeatureLayer({url: 'https://fmags.fm.utah.edu/arcgis/rest/services/mapservices/network_offsite_locations/MapServer/8',
        'id': 'allOffsiteLocations',
        'outFields': ['*'],
        'maxScale': 18057,
        'renderer': {
            'type': 'simple',
         'symbol':{
          'type': 'simple-marker',
          'size': 20,
          'color': 'black'
          }
          }
      }),
}               

 

ERROR

 

I've also tried: 

'allOffsiteLocations': new FeatureLayer({url: 'https://fmags.fm.utah.edu/arcgis/rest/services/mapservices/network_offsite_locations/MapServer/8',
   'id': 'allOffsiteLocations',
   'outFields': ['*'],
   'maxScale': 18057,
   'renderer': new SimpleRenderer ({
      'symbol':{
         'type': 'simple-marker',
         'size': 20,
         'color': 'black'
      }
   }),
}),

Which resulted in:

      

 

I do have SimpleRenderer listed in my require statement and both the require/functions appear to be in the same order:

require(['esri/widgets/Home', 'ugis/widgets/Track', 'esri/widgets/Compass', 'esri/widgets/Search', 
               'esri/layers/TileLayer','esri/layers/FeatureLayer', 'esri/layers/GraphicsLayer', 'esri/Graphic',
               'esri/symbols/SimpleMarkerSymbol','esri/symbols/SimpleFillSymbol', 'esri/symbols/SimpleLineSymbol',
               'esri/symbols/PictureMarkerSymbol', 'esri/tasks/QueryTask','esri/tasks/support/RelationshipQuery',
               'esri/geometry/Point','esri/geometry/Polygon','esri/tasks/support/Query','esri/geometry/SpatialReference',
               'esri/renderers/SimpleRenderer','dojo/query', 'dojo/dom-class', 'dojo/touch', 'dojo/dom-attr'],
               function (Home, Track, Compass, Search, TileLayer, FeatureLayer, GraphicsLayer, Graphic, SimpleMarkerSymbol,
                           SimpleFillSymbol, SimpleLineSymbol, PictureMarkerSymbol, QueryTask, RelationshipQuery, Point,
                           Polygon,  Query, SpatialReference, SimpleRenderer, query, domClass, touch, dojoDomAttr)

Outcomes