Hi Julian,
As below is the updated reply.
The options of map are asynchronous on the client and server side, so you need to sent the map current extent and scale to server when you save map.
Please refer the following sample code:
Client side:
@using ThinkGeo.MapSuite;
@using ThinkGeo.MapSuite.Mvc;
@{
ViewBag.Title = “Index”;
}
@{Html.ThinkGeo().Map(Model).OnClientClick("mapClick").Render();}
Server side:
using System;
using System.Drawing;
using System.Web.Mvc;
using ThinkGeo.MapSuite;
using ThinkGeo.MapSuite.Layers;
using ThinkGeo.MapSuite.Mvc;
using ThinkGeo.MapSuite.Shapes;
namespace MapPrinter.Controllers
{
public class HomeController : Controller
{
// GET: Home
public ActionResult Index()
{
Map map = new Map(“Map1”,
new System.Web.UI.WebControls.Unit(100, System.Web.UI.WebControls.UnitType.Percentage),
new System.Web.UI.WebControls.Unit(1000, System.Web.UI.WebControls.UnitType.Pixel));
map.MapUnit = GeographyUnit.DecimalDegree;
map.CurrentExtent = new RectangleShape(-178.215027, 71.406647, -66.969849, 18.924782);
InMemoryMarkerOverlay markerOverlay = new InMemoryMarkerOverlay();
markerOverlay.FeatureSource.InternalFeatures.Add(new Feature(map.CurrentExtent.GetCenterPoint()));
markerOverlay.ZoomLevelSet.ZoomLevel01.DefaultMarkerStyle.WebImage.ImageWidth = 21;
markerOverlay.ZoomLevelSet.ZoomLevel01.DefaultMarkerStyle.WebImage.ImageHeight = 21;
markerOverlay.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
map.CustomOverlays.Add(markerOverlay);
return View(map);
}
[MapActionFilter]
public void ClickEvent(Map map, GeoCollection<object> args)
{
double[] extentCell = Array.ConvertAll(args[0].ToString().Split(','), i => Convert.ToDouble(i));
map.CurrentExtent = new RectangleShape(extentCell[0], extentCell[3], extentCell[2], extentCell[1]);
map.CurrentScale = Convert.ToDouble(args[1]);
Bitmap bitmap = map.GetBitmap();
bitmap.Save(@"C:\result.png");
}
}
}
If you have any questions, please email me.
Thanks,