ThinkGeo.com    |     Blog    |     Wiki    |     Support

Unable to add more than 20 zoom levels

I need to be able to zoom in within a few feet. To do this, I thought I could just add custom zoom levels. However, I’m unable to zoom in any further than the original 20 zoom levels no matter how many I add to the customzoomlevel collection. Code below:

var partitionedZoomLevelSet = new ZoomLevelSet(); //make custom zoom levels to zoom in further than default
partitionedZoomLevelSet.CustomZoomLevels.Add(new ZoomLevel(GlobalObjects.Instance.OnyxMap.ZoomLevelSet.GetZoomLevels()[0].Scale));
partitionedZoomLevelSet.CustomZoomLevels.Add(new ZoomLevel(GlobalObjects.Instance.OnyxMap.ZoomLevelSet.GetZoomLevels()[1].Scale));
partitionedZoomLevelSet.CustomZoomLevels.Add(new ZoomLevel(GlobalObjects.Instance.OnyxMap.ZoomLevelSet.GetZoomLevels()[2].Scale)); 
partitionedZoomLevelSet.CustomZoomLevels.Add(new ZoomLevel(GlobalObjects.Instance.OnyxMap.ZoomLevelSet.GetZoomLevels()[3].Scale)); 
partitionedZoomLevelSet.CustomZoomLevels.Add(new ZoomLevel(GlobalObjects.Instance.OnyxMap.ZoomLevelSet.GetZoomLevels()[4].Scale)); 
partitionedZoomLevelSet.CustomZoomLevels.Add(new ZoomLevel(GlobalObjects.Instance.OnyxMap.ZoomLevelSet.GetZoomLevels()[5].Scale));  
partitionedZoomLevelSet.CustomZoomLevels.Add(new ZoomLevel(GlobalObjects.Instance.OnyxMap.ZoomLevelSet.GetZoomLevels()[6].Scale));  
partitionedZoomLevelSet.CustomZoomLevels.Add(new ZoomLevel(GlobalObjects.Instance.OnyxMap.ZoomLevelSet.GetZoomLevels()[7].Scale));  
partitionedZoomLevelSet.CustomZoomLevels.Add(new ZoomLevel(GlobalObjects.Instance.OnyxMap.ZoomLevelSet.GetZoomLevels()[8].Scale));   
partitionedZoomLevelSet.CustomZoomLevels.Add(new ZoomLevel(GlobalObjects.Instance.OnyxMap.ZoomLevelSet.GetZoomLevels()[9].Scale));   
partitionedZoomLevelSet.CustomZoomLevels.Add(new ZoomLevel(GlobalObjects.Instance.OnyxMap.ZoomLevelSet.GetZoomLevels()[10].Scale));   
partitionedZoomLevelSet.CustomZoomLevels.Add(new ZoomLevel(GlobalObjects.Instance.OnyxMap.ZoomLevelSet.GetZoomLevels()[11].Scale));   
partitionedZoomLevelSet.CustomZoomLevels.Add(new ZoomLevel(GlobalObjects.Instance.OnyxMap.ZoomLevelSet.GetZoomLevels()[12].Scale));   
partitionedZoomLevelSet.CustomZoomLevels.Add(new ZoomLevel(GlobalObjects.Instance.OnyxMap.ZoomLevelSet.GetZoomLevels()[13].Scale));   
partitionedZoomLevelSet.CustomZoomLevels.Add(new ZoomLevel(GlobalObjects.Instance.OnyxMap.ZoomLevelSet.GetZoomLevels()[14].Scale));   
partitionedZoomLevelSet.CustomZoomLevels.Add(new ZoomLevel(GlobalObjects.Instance.OnyxMap.ZoomLevelSet.GetZoomLevels()[15].Scale));   
partitionedZoomLevelSet.CustomZoomLevels.Add(new ZoomLevel(GlobalObjects.Instance.OnyxMap.ZoomLevelSet.GetZoomLevels()[16].Scale));   
partitionedZoomLevelSet.CustomZoomLevels.Add(new ZoomLevel(GlobalObjects.Instance.OnyxMap.ZoomLevelSet.GetZoomLevels()[17].Scale));   
partitionedZoomLevelSet.CustomZoomLevels.Add(new ZoomLevel(GlobalObjects.Instance.OnyxMap.ZoomLevelSet.GetZoomLevels()[18].Scale));   
partitionedZoomLevelSet.CustomZoomLevels.Add(new ZoomLevel(GlobalObjects.Instance.OnyxMap.ZoomLevelSet.GetZoomLevels()[19].Scale));   
partitionedZoomLevelSet.CustomZoomLevels.Add(new ZoomLevel(GlobalObjects.Instance.OnyxMap.ZoomLevelSet.GetZoomLevels()[19].Scale / 2));
partitionedZoomLevelSet.CustomZoomLevels.Add(new ZoomLevel(GlobalObjects.Instance.OnyxMap.ZoomLevelSet.GetZoomLevels()[19].Scale / 4));
partitionedZoomLevelSet.CustomZoomLevels.Add(new ZoomLevel(GlobalObjects.Instance.OnyxMap.ZoomLevelSet.GetZoomLevels()[19].Scale / 6));
partitionedZoomLevelSet.CustomZoomLevels.Add(new ZoomLevel(GlobalObjects.Instance.OnyxMap.ZoomLevelSet.GetZoomLevels()[19].Scale / 8));

MyMap.ZoomLevelSet = partitionedZoomLevelSet;

The map is in decimal degrees, unprojected.

Hi Dan,

I build a test project, and it looks the scale can be zoomed in deeper.

And I think if you set map.MinimumScale it should zoom better.

As below is the test project, please view it.

9536.zip (101.6 KB)

Regards,

Ethan

Thanks, that seemed to work. One question, do I have set each layer’s zoomlevelset to the custom levels or does it do it automatically?

For instance, I have a lot of layers set up like this:

inMemoryFeatureLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(FontValueStyle);
inMemoryFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

Will the above ApplyUntilZoomLevel work for the custom levels as well?

Hi Dan,

Yes you’re right, the ApplyUntilZoomLevel works for custom style also.

Regards,

Ethan