TCVanHalen

Can't set location of Callout

Discussion created by TCVanHalen on Sep 29, 2020
Latest reply on Oct 15, 2020 by LDanzinger-esristaff

I've followed a couple Callout samples when creating my own but I can't get the location of the callout to display where I clicked or the xy coordinate of the feature I am selecting.  Every time the callout displays in the upper left of the screen like below:

 

Callouts appear to be pretty straightforward so I'm not sure why I can't get mine to work.  (I am using a mmpk)

 

property Point clickedPoint

calloutData {
    }
Callout {
        id: callout
        calloutData: parent.calloutData
        accessoryButtonHidden: true
        leaderPosition: leaderPositionEnum.Automatic
    }
onMouseClicked: {
        clickedPoint = mouse.mapPoint;
        var tolerance = 5,
        returnPopupsOnly = false,
        maximumResults = 1;
        mapView.identifyLayerWithMaxResults(featureLayer, mouse.x, mouse.y, tolerance, returnPopupsOnly, maximumResults);
    }

onIdentifyLayerStatusChanged: {
         if (identifyLayerStatus === Enums.TaskStatusCompleted) {
             featureLayer.clearSelection();
             const elem = identifyLayerResult.geoElements[0];
             const count = identifyLayerResult.geoElements.length;
             featureLayer.selectFeatures(elem);
             var featureName = elem.attributes.attributeValue("Name");
             var xcoord = elem.attributes.attributeValue("POINT_X");
             var ycoord = elem.attributes.attributeValue("POINT_Y");
             mapView.calloutData.geoElement = elem;
             mapView.calloutData.detail = featureName;
             mapView.calloutData.location = clickedPoint;
             callout.showCallout();
         }
    }

Outcomes