We can't see the labels on the polygons

264
4
03-14-2024 01:18 PM
julianrua
New Contributor II

Hi we have an ESRI SDK implementation we have version 200.3.0 and we are having problems visualizing the labels in the polygons, here are some flows we checked and tried to solve, we ask for your help to find a way to solve it.

  1. it is identified that this error is only in some polygons, when creating lines and points the label works correctly.
  2. Structures were reviewed at the level of the JSON saved in the database and tests were performed with this, and if you change from polygon to line string the label works, but not with polygons, also reviewed structures with polygons with labels and without labels and states are similar.
  3. tests were realized by creating polygons from the iOS app and on the web and the error persists.
  4. the LabelDefinition class was reviewed, and tests were made changing the appearance of the label to verify if this influenced in some way but was also unsuccessful.
  5. checked the forums and found this possible solution using GeometryEngine.simplifyOrNul but it did not work. 

This is our current implementation for adding the labels

 

val graphicAttributes = mutableMapOf<String, Any>(
            "identifier" to dataAttributes.identifier,
            "title" to title,
            "subtitle" to subtitle,
            "name" to name
        )
        type = ArcGISGeoFeatureType.POLYGON
        graphic = constructor.getGraphic(marker, graphicAttributes)


override fun getGraphic(geometry: Geometry, attributes: Map<String, Any>): Graphic {
        return Graphic(geometry, attributes)
    }

 

 

 

61312fab-a900-478f-a9e9-38664aa6e1e2.jpeg

Tags (3)
0 Kudos
4 Replies
RamaChintapalli
Esri Contributor

Hi,
Can you share the label definition that you are applying to your graphicsOverlay ?

Thanks
Rama

0 Kudos
julianrua
New Contributor II

Sure, thanks for the help here is @RamaChintapalli 

private fun makeLabelDefinition(): LabelDefinition {
        val textSymbol = TextSymbol().apply {
            size = 12f
            color = com.arcgismaps.Color(FulcrumMarker.Color.BLACK.intColorCode())
            haloColor = com.arcgismaps.Color(FulcrumMarker.Color.WHITE.intColorCode())
            haloWidth = 1.5f
            horizontalAlignment = HorizontalAlignment.Center
            verticalAlignment = VerticalAlignment.Bottom
        }

        val labelExpression = ArcadeLabelExpression("\$feature.name")

        val labelDefinition = LabelDefinition(labelExpression, textSymbol).apply {
            stackStrategy = LabelStackStrategy.Allow
            stackRowLength = 18.0
        }

        return labelDefinition
    }

 

0 Kudos
RamaChintapalli
Esri Contributor

I tried your label definition which seems to work fine. Is it possible that the name is returning empty string for certain graphics in your case? Also, assuming they are all part of the same graphics overlay with labels enabled.

If the issue is still present, would you be able to repro it with this sample . Add your label definition, provide the geometry of non-working polygons in the repro code?

Thanks
Rama

0 Kudos
julianrua
New Contributor II

Hi @RamaChintapalli  thanks for answering, reviewing what you say that maybe we have empty strings, we already did that test, even the curious thing is that the labels are not seen in the same polygons in the two platforms, try in android to burn the attributes to show you that even so the labels are still not seen, I attach the portion of code of the test and the screens where you can see the test in android and ios that the same labels are not displayed either

override fun getGraphic(geometry: Geometry, attributes: Map<String, Any>): Graphic {
        val newAttributes = linkedMapOf(
            "identifier" to "testidentifier ",
            "title" to "testtitle",
            "subtitle" to "testsubtitle",
            "name" to "testname"
        )
        return Graphic(geometry, newAttributes)
    }

 

645974bc-d248-428f-b661-ee62275a841c.JPG

 

IMG_1956.PNG

 

0 Kudos