Add CIMPictureGraphic to map

151
3
03-27-2019 01:19 PM
Highlighted
Occasional Contributor II

What is the proper way to add CIMPictureGraphic to map? What properties should be set? I tried following code:

var box = EnvelopeBuilder.CreateEnvelope(x - 10, y - 10, x + 10, y + 10, SpatialReferences.WGS84);

var pictureGraphic = new CIMPictureGraphic
{
SourceURL = imgPath,
PictureURL = imgPath,
Box = box
};

var overlay = _mapView.AddOverlay(pictureGraphic);‍‍‍‍‍‍‍‍‍‍

Image exist on path imgPath, but it is not shown on map.

Tags (2)
Reply
0 Kudos
3 Replies
Highlighted
Esri Regular Contributor

Hi Max,

Adding CIMPictureGraphic to the Mapview overlay is not yet supported.

Thanks

Uma

Highlighted
Occasional Contributor II

OK, I suppose the question is closed in this case.

Reply
0 Kudos
Highlighted
Esri Regular Contributor

Hi Max

On further testing, I found that this code snippet works for 2.3. CIMPictureGraphic seems to work for 2D Maps at this point. A little bit of work is needed for 3D support still.  It will be available in a future release.

Note:

  • This specific overload of the AddOverlay method needs to be used.
  • SourceURL property is not being used currently. Used PictureURL instead.  The only supported format to provide the URL currently are these:
// e.g. local file URL (note the 3 slashes):
// file:///<path>
// file:///c:/images/symbol.png
// e.g. network file URL:
// file://<host>/<path>
// file://server/share/symbol.png

            // get the current mapview and point
var mapView = MapView.Active;
if (mapView == null)
return;
var pictureGraphic = new CIMPictureGraphic();
pictureGraphic.PictureURL = @"file:///E:/Stuff/MyImage.png";
pictureGraphic.Box = envelope;
_graphic = mapView.AddOverlay(pictureGraphic); ‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

Thanks

Uma

Reply
0 Kudos