Select to view content in your preferred language

Accessing annotation feature baseline geometry

116
0
11-08-2024 07:38 AM
MichaelWidmer
Emerging Contributor

Hello there

I need to access the (text) baseline geometry of an annotation feature. I'm aware that with annotations, the feature geometry contains the (readonly and auto-updated) bounding box of the text element, so I have to get the symbol using the element field.

Using the normal query mechanism I'm able to get its value and decoding it from binary (using atob()) I can see the coordinates of the start and the end point of the line, but not its spatial reference. This leaves me in trouble as the stored coordinates are in a different coordinate system than the map's one. Unfortunately I haven't been able to find any SDK functionality that offers me to access this binary string as I didn't find any support for CIMTextGraphic.

So my question would be: How can I convert/deserialize this binary string into a fully processable format with JavaScript?

This is an example what my code looks like so far:

 

const extent: Extent = getCurrentExtent();
const features = await query.executeQueryJSON(myAnnotationLayerUrl, {
    spatialRelationship: "intersects",
    outSpatialReference: extent.spatialReference,
    outFields: ["*"],
    returnGeometry: true,
    geometry: extent,
}).then(features => {
    for (const feature of features.features) {
        const element = getFieldAs<string>(feature.attributes, "element");
        const baseline = atob(element);
        // returns something like: 
        // 1 *K390314.56620000023,5820539.9339000005;390333.81819999963,5820487.34149999922Musterstraße8�AV-!r@
        
    }
})

 

0 Kudos
0 Replies