I want to overlay a .png image onto a 2d map and have it behave in the same way as graphics do (i.e. be able to update it's geometry and have it maintain it's actual size so when you zoom out it gets smaller and zoom in it gets bigger).
I have tried using PictureMarkerSymbol, but that seems to maintain it's size when zoomed in/out, and I've also tried PictureFillSymbol but the fill seems to change as you zoom in/out and tiles the image.
Currently, I am doing it using KML Ground Overlay. But as I am animating the image (updating it's location at a minimum once per second) I'm not sure if this is the best way. I am wondering if there is a better solution?
Uri img = new Uri(pathToImgFile);
KmlIcon overlayImg = new KmlIcon(img);
var polygonImg = new Polygon(new List<MapPoint> { defaultPoint, defaultPoint, defaultPoint, defaultPoint});
KmlGroundOverlay overlay = new KmlGroundOverlay(polygonImg, overlayImg);
KmlDataset dataset = new KmlDataset(overlay);
KmlLayer layer = new KmlLayer(dataset);
map.OperationalLayers.Add(layer);
Thanks
Solved! Go to Solution.
As for the Image Overlay, I checked the link and it looks like that is only available with SceneViews in 3D? I am using a MapView in 2D.
Apologies for the misdirection, Image Overlays are currently indeed only supported in 3D. Support in 2D is on the roadmap, for a future release.
Sounds like you're good to go with KML.
KML isn't a bad way to do it, although if you subsequently save the KML file locally it would require a Standard license (a Standard level license is required to view, create, edit, and save KML data stored as a local file).
Since you mention you're working in 2D and frequently updating the image you should also consider using Image Overlays, see sample Animate images with image overlay | ArcGIS Runtime API for .NET | ArcGIS Developers
Hi Michael,
Thanks for the reply - the way I am currently doing it there is no need to store KML files locally, but thanks for the tip.
As for the Image Overlay, I checked the link and it looks like that is only available with SceneViews in 3D? I am using a MapView in 2D.
I have since done some tests with multiple KML Overlays updating position at multiple times per second and there doesn't seem to be any performance issues at all so this does seem like a suitable solution.
Cheers
As for the Image Overlay, I checked the link and it looks like that is only available with SceneViews in 3D? I am using a MapView in 2D.
Apologies for the misdirection, Image Overlays are currently indeed only supported in 3D. Support in 2D is on the roadmap, for a future release.
Sounds like you're good to go with KML.