Select to view content in your preferred language

Is there any way to add a label to the middle of a polyline graphic in a sceneView

3961
11
Jump to solution
08-22-2023 01:47 AM
alionthego
Emerging Contributor

I am creating a poly line graphic to add to a sceneView for a SwiftUI app.  Is there any way to add a text label along this line?

Ideally I would like a box with some text inside it along the direction of the line in the middle of the line if that's achievable.

 

let polyline = Polyline(
    points: [
        point1,
        point2
    ]
)
let polylineSymbol = SimpleLineSymbol(style: .solid, color: .cyan, width: 2.0)
let polylineGraphic = Graphic(geometry: polyline, symbol: polylineSymbol)

 

11 Replies
MichaelBranscomb
Esri Frequent Contributor

🤣 Spatial puns are the best kind!

I recommend avoiding CompositeSymbol. It has a more modern equivalent in the MultiLayerSymbol, although this does involve a more complex object model. A great way to work with these newer multi layer symbols is to use ArcGIS Pro to create symbols and then put them in a mobile style file (a sqlite database under the hood) and then you can search and retrieve those symbols from the mobile style and apply to your features or graphics.

We don't currently have a Swift sample for this (on the roadmap), but conceptually you can refer to these existing .NET samples:

Our cartographer John Nelson publishes some lovely desktop styles that you can open in ArcGIS Pro and copy into a mobile style file and then use in the Native Maps SDKs - see this ArcGIS Online search for his current range.  

0 Kudos
Ting
by Esri Contributor
Esri Contributor

Apologies for the very late response. Just want to let you know this question is still under my radar and I'll post updates once I get feedback from our text feature team.

0 Kudos