Select to view content in your preferred language

adding multiple graphics on the same point in arcgis .net sdk

1064
3
04-04-2017 01:15 PM
BillysonBueno
Deactivated User

Hi,

How do I add multiple graphics (side by side) on the same point (rather than on top of each other) in ArcGIS .Net SDK.

Thanks, Billyson

0 Kudos
3 Replies
JenniferNery
Esri Regular Contributor

You can use OffsetX property of MarkerSymbol. In the sample below, graphics share the same geometry, which is the tapped location, but x offset is added to the symbol for the succeeding graphics.

        xmlns:esri="http://schemas.esri.com/arcgis/runtime/2013">
    <Grid>
        <esri:MapView x:Name="MyMapView" GeoViewTapped="MyMapView_GeoViewTapped"/>
    </Grid>
        public MainWindow()
        {
            InitializeComponent();
            MyMapView.Map = new Map(Basemap.CreateTopographic());
            MyMapView.GraphicsOverlays.Add(new GraphicsOverlay());
        }

        private void MyMapView_GeoViewTapped(object sender, GeoViewInputEventArgs e)
        {
            var mp = e.Location;
            var overlay = MyMapView.GraphicsOverlays[0];
            for (int i = 0; i < 5; i++)
            {
                var sms = new SimpleMarkerSymbol(SimpleMarkerSymbolStyle.Circle, Colors.Red, 10d);
                sms.OffsetX = sms.Size * i;
                overlay.Graphics.Add(new Graphic(mp, sms));
            }
        }
0 Kudos
BillysonBueno
Deactivated User

Thanks for the reply.

How do I do this if I will use PictureMarkerSymbol?

0 Kudos
PreetiMaske
Esri Regular Contributor

Properties OffsetX and OffsetY are also available for PicturemarkerSymbol. You can use the properties same way for PictureMarkerSymbol also.

0 Kudos