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?
The CompositeSymbol is only supported for client side rendering. I've logged an issue to make this clearer in the documentation and also perhaps look into providing some sort of error message / warning
But there is rendered by featurelayer
Uri featureServiceUri = new Uri(
"http://sampleserver6.arcgisonline.com/arcgis/rest/services/DamageAssessment/FeatureServer/0");
// Initialize feature table using a url to feature server url
var featureTable = new ServiceFeatureTable(featureServiceUri);
// Initialize a new feature layer based on the feature table
_featureLayer = new FeatureLayer(featureTable);
// Set the selection color for feature layer
_featureLayer.SelectionColor = Colors.Cyan;
_featureLayer.Renderer= new Esri.ArcGISRuntime.Symbology.SimpleRenderer()
{
Symbol =
new Esri.ArcGISRuntime.Symbology.CompositeSymbol(new List<Esri.ArcGISRuntime.Symbology.Symbol>() { new Esri.ArcGISRuntime.Symbology.SimpleMarkerSymbol()
{
Color = Colors.Red,
Style = Esri.ArcGISRuntime.Symbology.SimpleMarkerSymbolStyle.Circle,
Size = 8
},new Esri.ArcGISRuntime.Symbology.SimpleMarkerSymbol()
{
Color = Colors.Blue,
Style = Esri.ArcGISRuntime.Symbology.SimpleMarkerSymbolStyle.Circle,
Size = 4
}
}
)
};
is there anyway to add filegeodatabase(.gdb) source,and render it use CompositeSymbol
Feature layers are rendered client side so that is why it works. So are feature layers linked to tables in a local Runtime Geodatabase, so you can use that too.
File Geodatabases needs to be converted to runtime geodatabases, and then you'll be able to do this.