Good Day,
How can I get a position/location point from the locationDisplay? I want to get that point. I am using the code below but I nothing happens when I click the button.
import QtQuick 2.7
import QtQuick.Controls 2.1
import QtPositioning 5.3
import QtSensors 5.3
import ArcGIS.AppFramework 1.0
import ArcGIS.AppFramework.Controls 1.0
import Esri.ArcGISRuntime 100.2
App {
id: window
visible: true
//Create MapView that contains a Map
MapView {
anchors.fill: parent
//Nest the Map as a child of the MapView
Map {
//Nest the ArcGISTiledLayer to add it as one of the Basemap's baselayers
ArcGISTiledLayer {
url: "https://services.arcgisonline.com/arcgis/rest/services/Polar/Antarctic_Imagery/MapServer"
}
}
locationDisplay {
positionSource: PositionSource {
id: ps
}
}
onStatusChanged: {
if (loadstatus === Enums.MapStatusReady) {
ps.active = true;
}
}
}
Button {
anchors {
left: parent.left
top: parent.top
margins: 10
}
text: "get point"
onClicked: {
var point = mapView.locationDisplay.mapPoint;
console.log("x", point.x, "y", point.y, "wkid", point.spatialReference.wkid)
}
}
}
I can't see where "mapView" is defined in your sample code. Is it defined in your actual code?
I think its suppose to be MapView*
This seems similar to this, https://community.esri.com/thread/221653-obtain-and-store-the-coordinates-of-a-devices-current-locat...
It is, however unintentionally. This problem was re-worded as well as the code was changed and posted in the forum as another question.