Add CIMPictureGraphic to map

348
4
03-27-2019 01:19 PM
MaxMax2
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)
0 Kudos
4 Replies
UmaHarano
Esri Regular Contributor

Hi Max,

Adding CIMPictureGraphic to the Mapview overlay is not yet supported.

Thanks

Uma

MaxMax2
Occasional Contributor II

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

0 Kudos
UmaHarano
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

0 Kudos
AnthonyDunkDatamineDev1
New Contributor

Thanks. In case it helps anyone else, I could not get it to work until I put "file:///" in front of the image path! Also, I found it also works with .jpg images, not just .png.

0 Kudos