hi i want to show a small popup with dynamic data on several graphics of map onclick.
how can i achieve this.
Have you looked at this sample from Runtime Qt, https://developers.arcgis.com/qt/latest/qml/sample-code/show-a-popup/ ?
Erwin
i want to show username like the picture below it do not come from any feature layer but i have
to get it from private server to show, here on click
so i tried like this and trying to get graphic- attribute or geometry, but it always come undefined, as i have to identify the graphic clicked and then get the username .
// *** declare mapview***//
MapView {
id:mapView
property real initialMapRotation: 0
Component.onCompleted: {
mmpk.load();
}
anchors {
left: parent.left
right: parent.right
top: parent.top
bottom: parent.bottom
}
GraphicsOverlay{
id:hunterfreindPathOverlay
}
//! [show callout qml api snippet]
// initialize Callout
calloutData {
location: calloutLocation
detail: "LINZ USER"
}
Callout {
id: callout
calloutData: parent.calloutData
leaderPosition: leaderPositionEnum.Automatic
}
//! [show callout qml api snippet]
// display callout on mouseClicked
onMouseClicked: {
const tolerance = 22;
const returnPopupsOnly = false;
const maximumResults = 1;
if (callout.calloutVisible)
callout.dismiss()
else
{
mapView.identifyGraphicsOverlayWithMaxResults(hunterfreindPathOverlay, mouse.x, mouse.y, tolerance, returnPopupsOnly, maximumResults);
calloutLocation = mouse.mapPoint;
}
}
// Signal handler for identify graphics overlay
onIdentifyGraphicsOverlayStatusChanged: {
if (identifyGraphicsOverlayStatus === Enums.TaskStatusCompleted) {
if (identifyGraphicsOverlayResult.graphics.length > 0) {
console.log("===>"+identifyGraphicsOverlayResult.graphics.geometry);
console.log("===>"+identifyGraphicsOverlayResult.graphics.attribute);
callout.accessoryButtonHidden = true;
callout.showCallout();
}
} else if (identifyGraphicsOverlayStatus === Enums.TaskStatusErrored) {
console.log("error");
}
}
//! [identify graphics api snippet]
}//End Mapview
So i tried to add attribute like this and trying to fetch it, but unsuccessful
// *** Create graphic for boundaries and markers ***//
function createGraphic(geometry, symbol) {
var graphic = ArcGISRuntimeEnvironment.createObject("Graphic");
graphic.geometry = geometry;
graphic.symbol = symbol;
graphic.attributes.insertAttribute("username", "LINZs");
return graphic;
}//end createGraphic
Hi @ErwinSoekianto can you help me in this task. I m still stucked in it. I have to look for graphic attribute to identify on a particular overlay on mouse click.