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.
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:
arcgis-runtime-samples-qt/EditKmlGroundOverlay.qml at v.next · Esri/arcgis-runtime-samples-qt · GitHub
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!
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!
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?
<SPAN class="keyword token">import</SPAN> QtQuick <SPAN class="number token">2.7</SPAN> <SPAN class="keyword token">import</SPAN> QtQuick<SPAN class="punctuation token">.</SPAN>Controls <SPAN class="number token">2.3</SPAN> <SPAN class="keyword token">import</SPAN> ArcGIS<SPAN class="punctuation token">.</SPAN>AppFramework <SPAN class="number token">1.0</SPAN> <SPAN class="keyword token">import</SPAN> ArcGIS<SPAN class="punctuation token">.</SPAN>AppFramework<SPAN class="punctuation token">.</SPAN>Controls <SPAN class="number token">1.0</SPAN> <SPAN class="keyword token">import</SPAN> Esri<SPAN class="punctuation token">.</SPAN>ArcGISRuntime <SPAN class="number token">100.6</SPAN> <SPAN class="comment token">//import Esri.ArcGISExtras 1.1</SPAN> App <SPAN class="punctuation token">{</SPAN> id<SPAN class="punctuation token">:</SPAN> app width<SPAN class="punctuation token">:</SPAN> <SPAN class="number token">400</SPAN> height<SPAN class="punctuation token">:</SPAN> <SPAN class="number token">640</SPAN> Rectangle <SPAN class="punctuation token">{</SPAN> id<SPAN class="punctuation token">:</SPAN> rootRectangle clip<SPAN class="punctuation token">:</SPAN> <SPAN class="keyword token">true</SPAN> width<SPAN class="punctuation token">:</SPAN> <SPAN class="number token">800</SPAN> height<SPAN class="punctuation token">:</SPAN> <SPAN class="number token">600</SPAN> readonly property url dataPath<SPAN class="punctuation token">:</SPAN> <SPAN class="string token">""</SPAN> MapView <SPAN class="punctuation token">{</SPAN> id<SPAN class="punctuation token">:</SPAN> mapView anchors<SPAN class="punctuation token">.</SPAN>fill<SPAN class="punctuation token">:</SPAN> parent Map <SPAN class="punctuation token">{</SPAN> BasemapImagery <SPAN class="punctuation token">{</SPAN><SPAN class="punctuation token">}</SPAN> initialViewpoint<SPAN class="punctuation token">:</SPAN> viewpoint ViewpointCenter <SPAN class="punctuation token">{</SPAN> id<SPAN class="punctuation token">:</SPAN>viewpoint Point <SPAN class="punctuation token">{</SPAN> x<SPAN class="punctuation token">:</SPAN> <SPAN class="operator token">-</SPAN><SPAN class="number token">123.066227926904</SPAN> y<SPAN class="punctuation token">:</SPAN> <SPAN class="number token">44.04736963555683</SPAN> SpatialReference <SPAN class="punctuation token">{</SPAN> wkid<SPAN class="punctuation token">:</SPAN> <SPAN class="number token">4326</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="punctuation token">}</SPAN> targetScale<SPAN class="punctuation token">:</SPAN> <SPAN class="number token">15000</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="comment token">// Create a KML Layer</SPAN> KmlLayer <SPAN class="punctuation token">{</SPAN> id<SPAN class="punctuation token">:</SPAN> kmlLayer <SPAN class="comment token">// Create a KML Dataset</SPAN> KmlDataset <SPAN class="punctuation token">{</SPAN> <SPAN class="comment token">// Create a Ground Overlay by assigning an icon and geometry</SPAN> KmlGroundOverlay <SPAN class="punctuation token">{</SPAN> id<SPAN class="punctuation token">:</SPAN> groundOverlay rotation<SPAN class="punctuation token">:</SPAN> <SPAN class="operator token">-</SPAN><SPAN class="number token">3.046024799346924</SPAN> KmlIcon <SPAN class="punctuation token">{</SPAN> url<SPAN class="punctuation token">:</SPAN> <SPAN class="string token">"C:/Users/mstay/ArcGIS/AppStudio/Apps/EditKmlGroundOverlay/1944.jpg"</SPAN> <SPAN class="punctuation token">}</SPAN> Envelope <SPAN class="punctuation token">{</SPAN> id<SPAN class="punctuation token">:</SPAN> env xMin<SPAN class="punctuation token">:</SPAN> <SPAN class="operator token">-</SPAN><SPAN class="number token">123.066227926904</SPAN> yMin<SPAN class="punctuation token">:</SPAN> <SPAN class="number token">44.04736963555683</SPAN> xMax<SPAN class="punctuation token">:</SPAN> <SPAN class="operator token">-</SPAN><SPAN class="number token">123.0796942287304</SPAN> yMax<SPAN class="punctuation token">:</SPAN> <SPAN class="number token">44.03878298600624</SPAN> SpatialReference <SPAN class="punctuation token">{</SPAN> wkid<SPAN class="punctuation token">:</SPAN> <SPAN class="number token">4326</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="punctuation token">}</SPAN> Rectangle <SPAN class="punctuation token">{</SPAN> anchors<SPAN class="punctuation token">.</SPAN>fill<SPAN class="punctuation token">:</SPAN> slider radius<SPAN class="punctuation token">:</SPAN> <SPAN class="number token">5</SPAN> <SPAN class="punctuation token">}</SPAN> Slider <SPAN class="punctuation token">{</SPAN> id<SPAN class="punctuation token">:</SPAN> slider anchors <SPAN class="punctuation token">{</SPAN> left<SPAN class="punctuation token">:</SPAN> parent<SPAN class="punctuation token">.</SPAN>left top<SPAN class="punctuation token">:</SPAN> parent<SPAN class="punctuation token">.</SPAN>top margins<SPAN class="punctuation token">:</SPAN> <SPAN class="number token">10</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="keyword token">from</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="number token">0</SPAN> to<SPAN class="punctuation token">:</SPAN> <SPAN class="number token">1</SPAN> value<SPAN class="punctuation token">:</SPAN> <SPAN class="number token">1</SPAN> stepSize<SPAN class="punctuation token">:</SPAN> <SPAN class="number token">0.1</SPAN> onValueChanged<SPAN class="punctuation token">:</SPAN> <SPAN class="punctuation token">{</SPAN> <SPAN class="comment token">// modify the overlay's color/alpha value</SPAN> groundOverlay<SPAN class="punctuation token">.</SPAN>color <SPAN class="operator token">=</SPAN> Qt<SPAN class="punctuation token">.</SPAN><SPAN class="token function">rgba</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="number token">0</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="number token">0</SPAN><SPAN class="punctuation token">,</SPAN> value<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="punctuation token">}</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
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.
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.