Can you please assist or point me to any documentation for using ThinkGeo.Core.Async.GoogleMapsLayer that is replacing ThinkGeo.Core.GoogleMapsLayer? We include this layer to generate images for reports combined with other layers (i.e. InMemoryFeatureLayer, ShapeFileFeatureLayer, etc) using LayerOverlays and drawing them to a GeoImage using GeoCanvas. When I swtiched ThinkGeo.Core.GoogleMapsLayer to ThinkGeo.Core.Async.GoogleMapsLayer it is no longer drawing the Google imagery onto the GeoImage. We are using ThinkGeo version 13.3.0. The following error is thrown behind the scenes
System.Exception: Please call OpenAsync() instead of Open()
at ThinkGeo.Core.Async.LayerAsync.OpenCore()
at ThinkGeo.Core.Layer.Open()
at ThinkGeo.UI.WebApi.LayerOverlay.Dkc=(GeoCanvas geoCanvas)
at ThinkGeo.UI.WebApi.LayerOverlay.DrawCore(GeoCanvas geoCanvas)
at ThinkGeo.UI.WebApi.Overlay.Draw(GeoCanvas geoCanvas)
Here is a dumbed down version of our code that generates the image and and errors on layerOverlay.Draw(geoCanvas).
try
{
var extent = new RectangleShape(-10576465.08714375, 4824786.890078585, -10570683.571714485, 4819005.374649317);
var layerOverlay = new LayerOverlay();
var googleLayer = new ThinkGeo.Core.Async.GoogleMapsLayer("apikey", "signingsecret")
{
MapType = GoogleMapsMapType.Hybrid,
PictureFormat = GoogleMapsPictureFormat.Jpeg,
Name = "Google",
DrawingExceptionMode = DrawingExceptionMode.ThrowException
};
layerOverlay.Layers.Add(googleLayer);
using (var image = new GeoImage(400, 400))
{
var geoCanvas = GeoCanvas.CreateDefaultGeoCanvas();
geoCanvas.BeginDrawing(image, extent, GeographyUnit.Meter);
layerOverlay.Draw(geoCanvas);
geoCanvas.EndDrawing();
// output image to temp file
var guid = Guid.NewGuid();
var fs = new System.IO.FileStream($@"C:\\temp\{guid}.jpg", System.IO.FileMode.Create);
image.Save(fs, GeoImageFormat.Jpeg);
fs.Close();
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.Message);
}