Select to view content in your preferred language

How to place a label in the center of a polygon in Feature layer?

462
2
07-11-2023 06:37 AM
PrashantR
New Contributor III

I have a feature layer with polygons and I want to place a label in the center of the polygon. I tried with polylines and polygons both but with the current label placement options available I am not able to place it in the center. 

Is there any way to do this? 

0 Kudos
2 Replies
-Smita-
New Contributor

Hi @PrashantR,

You can try:

1. to find the centroid of each polygon and set the label

2. if you are using LabelClass, then you can set the labelPlacement property

0 Kudos
UndralBatsukh
Esri Regular Contributor

Hi there, 

The always-horizontal label placement for polygons always places the labels at the center of polygons. Is this what you are not seeing?  Here is a simple codepen that shows labels for polygon features: https://codepen.io/matt9222/pen/LYXeqdP?editors=1000

 

0 Kudos