Hi,
I tried to zoom the map by drawing a rectangle on the map (i.e zooming a specific area) , the map zooms to the extent on which rectangle gets drawed, but I am unable to see the rectangle on my screen , I am sharing the code, can anyone tell me , what is my mistake ?
Hi,
I know that feature is already available , but I want to implement on a
button click.I don't want to add the rectangle on the map, I just want to
see ,while it gets drawn temporarily , but I am unable to see that. The map
zooms to the extent of the covered area while mouse is down , but I am
unable to see the trail of rectangle.
I see so you're not able to see the rectangle as it is drawn. What version of the api are you using? If it's earlier than v100.3, you might be hitting a bug on clearing GraphicsOverlays where sketch layer also gets removed.
If you have in your code `MyMapView.GraphicsOverlays.Clear()`, the workaround is to replace this line with
for (var counter = MyMapView.GraphicsOverlays.Count; counter > 0; counter--)
MyMapView.GraphicsOverlays.RemoveAt(counter);
The version I am using is 100.3 , but still I get this bug.
Can you confirm that commenting out `GraphicsOverlays.Clear()` or replacing this with `RemoveAt` fixes the issue?
Thanks.
I'm not able to reproduce the bug with v100.3, only in earlier version do I get no draw feedback once I've called GraphicsOverlays.Clear. I wanted to confirm so I can better help you, it might be a different issue you are hitting.
public MainWindow()
{
InitializeComponent();
MyMapView.Map = new Map(Basemap.CreateTopographic());
}
private void OnDraw(object sender, RoutedEventArgs e)
{
MyMapView.GraphicsOverlays.Clear();
MyMapView.SketchEditor.StartAsync(SketchCreationMode.Rectangle, false);
}