Rotate Labels in AGOL using JSON?

480
2
02-12-2019 10:56 AM
RyanClose
New Contributor III

Howdy.

I'm trying to rotate labels in a map in AGOL. They don't give you native options for that as of yet, so I figured I'd try to work it into the JSON in AGO Asst. There's an "Angle" field within the feature service (dataset was originally an annotation feature class, and was converted to a point.) which contains the angle of deflection for the original annotation.
The layer is parcel dimensions and I can have them rotated to match the line angle in ArcMap, but the labeling doesn't carry through when I publish it to a feature service on AGOL.

I've added the labelAngleInfo tag to the JSON but the numbers remain horizontal regardless.

Am I missing something? Am I way off base? Admittedly, I'm absolutely not versed in JSON so I'm just digging into documentation.

                    "labelingInfo": [
                        {
                            "labelExpression": null,
                            "labelExpressionInfo": {
                                "expression": "$feature[\"TextString\"]",
                                "value": "{TextString}"
                            },
                            "useCodedValues": true,
                            "maxScale": 0,
                            "minScale": 6297,
                            "where": null,
                            "labelPlacement": "esriServerPointLabelPlacementCenterCenter",
                            "labelAngleInfo": {
                                 "angleExpressionInfo": {
                                    "expression": "$feature.Angle",
                                    "returnType": "number"
                                  },
                            "rotationType": "arithmetic"
                            },
                            "symbol": {
                                "color": [
                                    0,
                                    0,
                                    0,
                                    255
                                ],
                                "type": "esriTS",
                                "backgroundColor": null,
                                "borderLineColor": null,
                                "borderLineSize": null,
                                "haloSize": 0,
                                "haloColor": null,
                                "verticalAlignment": "baseline",
                                "horizontalAlignment": "center",
                                "angle": 0,
                                "rightToLeft": false,
                                "xoffset": 0,
                                "yoffset": 0,
                                "text": "",
                                "rotated": false,
                                "kerning": true,
                                "font": {
                                    "size": 8.25,
                                    "style": "normal",
                                    "decoration": "none",
                                    "weight": "normal",
                                    "family": "Arial Unicode MS"
                                }
                            }
                        }
                    ]

I'm trying to make it look like this: (ArcMAP)

Instead, I can't get them to change from this: (AGOL)

Thanks in advance.

Tags (3)
2 Replies
MichaelDeliberato
New Contributor III

Good Afternoon Ryan,

Definitely following this thread. I have also came across this. I work for Franklin County Ohio's Auditors Office so i think it is safe to assume that we are dealing with similar issues. For our parcel viewer we created an annotation class and published that class to AGOL or server respectively. I used the annotation to do all the labeling for the app rather then the data that is published. Obviously creating an annotation class for hundreds of thousands of parcels is not only time consuming but a rather large file. We are currently working on creating a historic parcel viewer where you can see the changes in parcels and dimensions through the years but because of time and space were not going to create 20 something annotation classes to use on a single application so i share the same feeling about AGOL having issues with labels. But you may want to look into Creating an annotation class and then publishing that as a service. Please let me know if you find a work around within AGOL.

Mike

acharko
New Contributor II

Any updates to this issue? We are having the same problem and looking for a solution.

Thanks,

Allison

0 Kudos