Dear Support Team,
In normal MapSuite web application, my map opens and zooms to the visible extent by setting current extent of a map to a given bounding box.
But when the same map and same code is moved to MVC, the resulting map is so tiny that you can hardly see it untill it is zoomed to near maximum extent. Can you please give me a sample code showing how to set a current extent to a map in MVC and have it working like it is on normal mapsuite web application? Below is part of the MVC code I am running in my application
Map creation
@Html.ThinkGeo().Map(“Map1”, 400,510).MapBackground(new BackgroundLayer(new GeoSolidBrush(GeoColor.FromHtml("#E5E3DF"))))
.MapBackground(new BackgroundLayer(new GeoSolidBrush(GeoColor.FromHtml("#ffffff"))))
.MapUnit(GeographyUnit.Feet)
.OnClientClick(“TakeCordinate”)
.MapTools(tools =>
{
tools.MouseCoordinateMapTool().Enabled(true);
tools.OverlaySwitcherMapTool().Enabled(true);
})
.MapTools(mapTools =>
{
mapTools.LoadingImageMapTool().Enabled(true).Width(64).Height(64).ImageUri(new Uri(new Uri(Request.Url.AbsoluteUri), “Content/images/loading.gif”));
})
.CustomOverlays(overlay =>
{
overlay.LayerOverlay(“Image”).IsVisible(true).Name(“Image”).IsBaseOverlay(false);
overlay.LayerOverlay(“Boundary”).IsVisible(true).Name(“Boundary”).IsBaseOverlay(false);
})
.Render();
Map Loading
function LoadMap( {
alert(Map1);
GetMapHeight()
Map1.ajaxCallAction(“Custumers”,“LoadMap”, {“height”: GetMapHeight()}, function (result) {
Progress();
var value = result.get_responseData();
//alert(result);
if (value == ‘’) {
alert(“No place is found!”);
//return;
} else {
alert(value);
var bounds = OpenLayers.Bounds.fromString(value, false);
alert(bounds);
Map1.zoomToExtent(bounds, false);
alert(222)
}
//Map1.GetOpenLayersMap().updateSize();
FinishRequest();
})
redrawMap(“Boundary”);
redrawMap(“Image”);
//Map1.zoomToMaxExtent(true);
//WamisMap.numZoomLevels(200);
// Map1.printMap();
}
Server side code for loading map
public RectangleShape LoadMap(Map map, GeoCollection<
object
> args) {
Open(map);
map.Height = System.Web.UI.WebControls.Unit.Pixel(int.Parse(args[“height”].ToString()));
Web.Layers.Region mwanza = new Web.Layers.Region(GetProperty(“root”) + “App_Data/Map/Mwanza/ShapeFiles/CAPRIPORTt.shp”, this);
LayerOverlay region = map.CustomOverlays[“Boundary”] as LayerOverlay;
RectangleShape extent = mwanza.GetBoundingBox();
SetImage();
//catersion = new ISystem.Web.Map.Catersian(extent);
// GetPanel().StaticOverlay.Layers.Add(mwanza);
mwanza.Close();
region.Layers.Add(mwanza);
//map.MapTools.LoadingImage.
////overlay.Layer(mwanza);
//map.StaticOverlay.ServerCache = new ServerCache(GetProperty(“root”) + “Resources/Map/Image/Cache”);
Web.Models.Custumers custumers = new Models.Custumers(this);
RectangleShape custumers_extent = custumers.Load();
if (custumers_extent != null) {
return custumers_extent;
}
return extent;
}
Best Regards,
Vincent