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.
Hi Max,
Adding CIMPictureGraphic to the Mapview overlay is not yet supported.
Thanks
Uma
OK, I suppose the question is closed in this case.
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:
// 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
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.