Is it possible to add an image to a map based on an extent? In ArcGIS JS 3.X I can create a MapImageLayer and add a MapImage to it. See my demo here. I would like to do something similar in AppStudio.
Solved! Go to Solution.
You can do this with a KmlGroundOverlay with 100.6 and newer of Runtime. Basically you set the image and an Envelope of where it should display in geographic space. A sample can be found here:
I am including ArcGIS Runtime SDK for Qt to see if this is possible in ArcGIS Runtime or anyone on that group know how to do that.
You can do this with a KmlGroundOverlay with 100.6 and newer of Runtime. Basically you set the image and an Envelope of where it should display in geographic space. A sample can be found here:
Erwin Soekianto Thanks for the quick response!
Lucas Danzinger Yes, that is perfect! I love how KmlGroundOverlay can be defined using very similar parameters to the MapImageLayer class from Javascript 3.x (e.g. xmin, ymin, xmax, ymax, spatial reference). Thanks!
I have a quick follow up question, I noticed when I changed from a sceneView to a mapView the transparency slider stopped working (see below). Do you happen to know what that is about?
import QtQuick 2.7
import QtQuick.Controls 2.3
import ArcGIS.AppFramework 1.0
import ArcGIS.AppFramework.Controls 1.0
import Esri.ArcGISRuntime 100.6
//import Esri.ArcGISExtras 1.1
App {
id: app
width: 400
height: 640
Rectangle {
id: rootRectangle
clip: true
width: 800
height: 600
readonly property url dataPath: ""
MapView {
id: mapView
anchors.fill: parent
Map {
BasemapImagery {}
initialViewpoint: viewpoint
ViewpointCenter {
id:viewpoint
Point {
x: -123.066227926904
y: 44.04736963555683
SpatialReference {
wkid: 4326
}
}
targetScale: 15000
}
// Create a KML Layer
KmlLayer {
id: kmlLayer
// Create a KML Dataset
KmlDataset {
// Create a Ground Overlay by assigning an icon and geometry
KmlGroundOverlay {
id: groundOverlay
rotation: -3.046024799346924
KmlIcon {
url: "C:/Users/mstay/ArcGIS/AppStudio/Apps/EditKmlGroundOverlay/1944.jpg"
}
Envelope {
id: env
xMin: -123.066227926904
yMin: 44.04736963555683
xMax: -123.0796942287304
yMax: 44.03878298600624
SpatialReference {
wkid: 4326
}
}
}
}
}
}
}
Rectangle {
anchors.fill: slider
radius: 5
}
Slider {
id: slider
anchors {
left: parent.left
top: parent.top
margins: 10
}
from: 0
to: 1
value: 1
stepSize: 0.1
onValueChanged: {
// modify the overlay's color/alpha value
groundOverlay.color = Qt.rgba(0, 0, 0, value);
}
}
}
}
Not sure why - probably a bug in the API. If you use the opacity property on the KmlLayer (inherited from Layer base class) instead of setting color, that seems to work, so maybe give that a try if you are just looking to modify opacity. Please log a bug with Esri Support for the color issue if you need to get this part working. Thanks!
OK. That feature isn't a big deal for me. I just tried it since it was already and there and wanted to make sure there wasn't some big change I should be aware of about switching from a scene to a map.
Thanks again!