Johnny,
thank you for reply.
I increased number of zoom levels to 120 and still can not achieve zooming to the selected area.
Navigate to Australia and below it you will see that iceland.
What is missing in my code?
I used code from the sample "Zoom In To a Feature Clicked"
@Imports ThinkGeo.MapSuite.Core
@Imports ThinkGeo.MapSuite.MvcEdition
<script language="javascript" type="text/javascript">
function zoomToFeature(e) {
var param = { x: e.worldXY.lon, y: e.worldXY.lat };
Map1.ajaxCallAction('@ViewContext.RouteData.Values("Controller").ToString()', 'ZoomToShape', param, callback);
}
function callback(result) {
var parameters = result.get_responseData().split("|");
var extent = parameters[0].split(",");
var bbox = new OpenLayers.Bounds(extent[0], extent[1], extent[2], extent[3]);
Map1.zoomToExtent(bbox);
document.getElementById("dataInfoDiv").innerHTML = parameters[1];
}
</script>
@Code Html.RenderPartial("SourceCode") End CODE
Click on a country to zoom to it.
@Code
With Html.ThinkGeo().Map("Map1", New System.Web.UI.WebControls.Unit("100%"), 510)
.MapBackground(New BackgroundLayer(New GeoSolidBrush(GeoColor.FromHtml("#E5E3DF"))))
.CurrentExtent(-125, 72, 50, -46)
.MapUnit(GeographyUnit.DecimalDegree)
.CustomOverlays(Sub(overlays)
Dim worldLayer As New ShapeFileFeatureLayer(Server.MapPath("~/App_Data/cntry02.shp"))
Dim highlightLayer As New InMemoryFeatureLayer()
Dim levels As Integer = 120
Dim initialScale As Double = worldLayer.ZoomLevelSet.ZoomLevel01.Scale
Dim colors As System.Collections.ObjectModel.Collection(Of ThinkGeo.MapSuite.Core.GeoColor) = GeoColor.GetColorsInQualityFamily(GeoColor.StandardColors.Red, GeoColor.StandardColors.Blue, levels, ColorWheelDirection.Clockwise)
Dim zls As New ZoomLevelSet
Dim divider As Double = 1
For level = 1 To levels
zls.CustomZoomLevels.Add(New ZoomLevel(initialScale / (divider)))
divider = divider * 2
Next
worldLayer.ZoomLevelSet = zls
For idx As Integer = 0 To levels - 1
worldLayer.ZoomLevelSet.CustomZoomLevels(idx).DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.FromArgb(100, colors(idx)), colors(idx))
Next
zls = New ZoomLevelSet
divider = 1
For level = 1 To levels
zls.CustomZoomLevels.Add(New ZoomLevel(initialScale / (divider)))
divider = divider * 2
Next
highlightLayer.ZoomLevelSet = zls
For idx As Integer = 0 To levels - 1
highlightLayer.ZoomLevelSet.CustomZoomLevels(idx).DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.FromArgb(100, colors(idx)), GeoColor.GeographicColors.DeepOcean)
highlightLayer.ZoomLevelSet.CustomZoomLevels(idx).DefaultTextStyle = TextStyles.Country1("CNTRY_NAME")
Next
zls = New ZoomLevelSet
divider = 1
For level = 1 To levels
zls.CustomZoomLevels.Add(New ZoomLevel(initialScale / (divider)))
divider = divider * 2
Next
.ZoomLevelSet(zls)
overlays.LayerOverlay("CountryOverlay").IsBaseOverlay(False).Layer("WorldLayer", worldLayer)
overlays.LayerOverlay("HighlightOverlay").IsBaseOverlay(False).TileType(TileType.SingleTile).Layer("HighlighLayer", highlightLayer)
End Sub)
.OnClientClick("zoomToFeature")
.Render()
End With
End Code