I'm seeing the following error when attempting to add a tiled and feature layer to the same map when using the ArcGIS Server JS API 3.1:
TypeError: Unable to draw graphic (geometry:null, symbol:null): _c is undefined http://serverapi.arcgisonline.com/jsapi/arcgis/3.1compact/js/dojo/dojo/DeferredList.js Line 8
After defining the map and adding a basemap, I'm iterating through a list of JSON layer definitions, building each layer based on its definition, then adding it to the map. The pseudo code is:
dojo.connect(map, "onLoad", function {
for layerDef in layerDefs:
if layerDef.type == tiled:
layer = buildTiledLayer
if layerDef.type == feature:
layer = buildFeatureLayer
map.addLayer(layer)
}
If I add just the tiled layer, or just the feature layer, there are no problems - it's only when I add both together that I see the error message. Once the error message has shown, an infoWindow is not shown when clicking on the feature layer.
This forum post lead me to suspect the problem may be due to the timing of adding the layers - during debugging I found that if I remove the map.addLayer
line, and instead push the layers into an array, I can manually enter map.addLayers(layerArray)
in Firebug, once the map has finished loading. In this case, both layers add correctly.
Adding a FeatureLayer ARCGIS JavaScript API isn't relevant as I know the feature layer definition is correct - the feature layer adds without error if it's added without the tiled layer.
Similarly, I believe that the layers are correctly defined since each is loaded correctly without the other.
Does anyone have any advice as to why this error might be occurring, and how to resolve the error?
Thanks