Install label to Sceneview

616
3
04-24-2021 07:02 AM
AlexanderKulikov
New Contributor II

Hi! I'm using the ArcGIS Runtime SDK Android

How do I get FeatureLayer from SceneView to install label? I tried like this :

mArView!!.sceneView.scene.operationalLayers.forEach { layer ->
if (layer is FeatureLayer) {
val l = layer.featureTable
val featureLayer = FeatureLayer(l)
featureLayer.labelDefinitions.add(labelDefinition)
}
}  

 

How do I set a lable for a layer?

Thank you in advance!

0 Kudos
3 Replies
RamaChintapalli
Esri Contributor

Hi ,

Can you check if the labels are enabled on the feature layer,

featureLayer.setLabelsEnabled(true)

Here is a sample,
https://github.com/Esri/arcgis-runtime-samples-android/tree/main/java/show-labels-on-layer/src/main/...

Thanks
Rama

0 Kudos
AlexanderKulikov
New Contributor II

Hi! 

The problem is that this code if (layer is FeatureLayer) returns false. How can I set a layer's lable?

Thanks
Alexander

0 Kudos
RamaChintapalli
Esri Contributor

If the FeatureLayer has labels disabled by default, you can enable them by setting featureLayer.setLabelsEnabled(true) and setting a LabelDefinition on the feature layer. 
https://developers.arcgis.com/android/api-reference/reference/com/esri/arcgisruntime/arcgisservices/...

If your map is coming from a arcgis online webmap portalitem, you can also set LabelDefinition defined in the webmap itself on the ArcGIS Online MapViewer, otherwise you would need to come with a LabelDefinition similar to the one in the above provided sample.

Thanks
Rama

0 Kudos