Can't zoom out on raster layer

944
0
04-28-2021 05:09 AM
NazarSamardak
New Contributor

Dear Gurus!

I would like to implement zoom out on map which contains raster layer.
I created simple program to check this option, but can't understand how to do it.

So, here is my code:

 

 

 

public partial class MainWindow : Window
    {
        MapView _mapView = null;
        public MainWindow()
        {
            InitializeComponent();

            _mapView = MyMapView;            
            try
            {
                #region Raster
                
                string qwe4 = Path.GetFullPath(@"D:\to_check_img\12_daniel_can_bc-207.jpg");
                
                RasterLayer myRasterLayer4 = new RasterLayer(qwe4);
                //myRasterLayer.MinScale = 450000;
                //myRasterLayer.MaxScale = 1000000;
                
                LoadRaster(myRasterLayer4);

                Map map = new Map();               
                map.OperationalLayers.Add(myRasterLayer4);
                MyMapView.Map = map;
                #endregion                
            }
            catch (Exception ex)
            {

            }
        }        

        private async void LoadRaster(RasterLayer myRasterLayer)
        {
            await myRasterLayer.LoadAsync();            
            ///not working
            //await _mapView.SetViewpointScaleAsync(50000);
            //await _mapView.SetViewpointCenterAsync(new MapPoint(myRasterLayer.FullExtent.XMin, myRasterLayer.FullExtent.YMin), 50000);                        
        }

    }

 

 

 

 

After it, I see an image on map with current scale. For it I added 

 

 

 

<Grid>
        <quartz:MapView x:Name="MyMapView" Margin="-21,-26,21,26" />
        <TextBlock Margin="469,10,50,380">
                    <!--  A run is used to format the label.  -->
                    <Run Text="Current map scale: " />
                    <Run Text="1:" />
                    <Run Text="{Binding ElementName=MyMapView, Path=MapScale, Mode=OneWay, StringFormat=n0}" />
        </TextBlock>
    </Grid>

 

 

 


When I run an application I see image with current scale:

NazarSamardak_0-1619611368828.png


But I don't have a possibility to zoom out from this scale. 

I really need to know if there is any possibility to zoom out when we have a nongeoreferenced map and image layer on it.

As you  see I tried to use MinScale, MaxScale, SetViewpointScaleAsync, but it didn't work.

Thanks in advance!

 

0 Kudos
0 Replies