Select to view content in your preferred language

VB.NET Layer set SetMaxScale / SetMinScale

617
4
Jump to solution
04-06-2024 12:05 PM
SigurdurGesr
Emerging Contributor

 

Hi

I am try to set Layer MaxScale it look like nothing happened 

 

        Dim layerName As String = Layer_HR
        Dim HRLayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType(Of BasicFeatureLayer)().FirstOrDefault(Function(l) l.Name.Equals(layerName))
        HRLayer.SetMaxScale(501)

 

Thanks
Sigster

0 Kudos
1 Solution

Accepted Solutions
GKmieliauskas
Esri Regular Contributor

Hi,

At first, SetMaxScale must be called on MCT thread inside QueuedTask.Run.

After setting new values open layer properties and check is values are specified (general tab).

Max value must be less then min value:

GKmieliauskas_0-1712493491961.png

I have tried vb sample from community samples with values:

                    multiPointLayer.SetMaxScale(1000000)

                    multiPointLayer.SetMinScale(5000000)

And it works as expected. It could be that your values are to small or not in expected range

 

View solution in original post

0 Kudos
4 Replies
GKmieliauskas
Esri Regular Contributor

Hi,

At first, SetMaxScale must be called on MCT thread inside QueuedTask.Run.

After setting new values open layer properties and check is values are specified (general tab).

Max value must be less then min value:

GKmieliauskas_0-1712493491961.png

I have tried vb sample from community samples with values:

                    multiPointLayer.SetMaxScale(1000000)

                    multiPointLayer.SetMinScale(5000000)

And it works as expected. It could be that your values are to small or not in expected range

 

0 Kudos
SigurdurGesr
Emerging Contributor

 

What is MCT thread ? 

        Dim layerName As String = Layer_NR
        Dim NRLayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType(Of BasicFeatureLayer)().FirstOrDefault(Function(l) l.Name.Equals(layerName))
        QueuedTask.Run(Function()
                           NRLayer.SetMaxScale(1000000)
                           NRLayer.SetMinScale(5000000)
                       End Function)

 

 

0 Kudos
GKmieliauskas
Esri Regular Contributor

MCT means that you must call method inside QueuedTask.Run. Like in your second code sample

0 Kudos
SigurdurGesr
Emerging Contributor

 

Thanks GKmieliauskas

0 Kudos