AnsweredAssumed Answered

CompositeSymbol don't display on ArcGISMapImageSublayer

Question asked by htkinghtk on Jul 28, 2017
Latest reply on Jul 31, 2017 by mnielsen-esristaff

I Add a FileGeodatabase in the localserver,then i display it on map

 

String mapServiceURL = _emptyMpkPath;
LocalMapService localMapService = new LocalMapService(mapServiceURL);

//create a gdb workspace
FileGeodatabaseWorkspace geodatabaseWorkspace = new FileGeodatabaseWorkspace(uniqueId, directoryPath);

// add the dynamic workspace to the localMapService

localMapService.SetDynamicWorkspaces(new DynamicWorkspace[] { geodatabaseWorkspace });

await localMapService.StartAsync();

// create a layersource that represents the actual gdb on disk
TableSublayerSource source = new TableSublayerSource(geodatabaseWorkspace.Id, fileName);
// create a sublayer instance from the source
ArcGISMapImageSublayer shapefileSublayer = new ArcGISMapImageSublayer(0, source);

// ready to add the shapefile layer to the map. Create a map image layer using url
ArcGISMapImageLayer imageLayer = new ArcGISMapImageLayer(localMapService.Url);

imageLayer.Sublayers.Clear();
imageLayer.Sublayers.Add(shapefileSublayer);
// add the sub layer to the image layer
imageLayer.LoadStatusChanged += ((s, e) =>
{
if (imageLayer.LoadStatus == LoadStatus.Loaded)
{
shapefileSublayer.LoadStatusChanged += ((a, b) =>
{
if (shapefileSublayer.LoadStatus == LoadStatus.Loaded)
{
var layerInfo = shapefileSublayer.MapServiceSublayerInfo;
shapefileSublayer.Renderer = new SimpleRenderer()
{
   Symbol =
            new CompositeSymbol(new List<SimpleMarkerSymbol>() {

            new SimpleMarkerSymbol(){
               Color = GetRandomColor(),
               Style = SimpleMarkerSymbolStyle.Circle,
                  Size = 8
         }})

      }
   }

});
shapefileSublayer.LoadAsync();
}
});
await imageLayer.LoadAsync();

 mapView.Map.OperationalLayers.Add(, layer);

 

But this is nothing in the map,is there any way to add filegdb source and render it use CompositeSymbol?

Outcomes