System.Collections.ObjectModel.Collection<simplecandidate> listSimpleCandidate = new System.Collections.ObjectModel.Collection<simplecandidate>(); Bitmap bitmap = null; GdiPlusGeoCanvas canvas = null; try { bitmap = new Bitmap((int)Map1.Width.Value, (int)Map1.Height.Value); canvas = new GdiPlusGeoCanvas(); string wkt = "POLYGON((3856893.8965224 3703052.43104992,3859640.8522259 3703052.43104992,3859640.8522259 3700759.32020178,3856893.8965224 3700759.32020178,3856893.8965224 3703052.43104992))"; RectangleShape extend = BaseShape.CreateShapeFromWellKnownData(wkt).GetBoundingBox(); canvas.BeginDrawing(bitmap, extend, Map1.MapUnit); canvas.Clear(Map1.MapBackground.BackgroundBrush); GoogleMapsLayer layer = new GoogleMapsLayer(); layer.Open(); layer.Draw(canvas, listSimpleCandidate); layer.Close(); string binaryImageFilePath = MapPath(@"~\Temp\Images\test\Field_1250.png"); GdiPlusRasterLayer gdiPlusImageLayer = new GdiPlusRasterLayer(binaryImageFilePath); gdiPlusImageLayer.UpperThreshold = double.MaxValue; gdiPlusImageLayer.LowerThreshold = 0; gdiPlusImageLayer.Open(); gdiPlusImageLayer.Draw(canvas, listSimpleCandidate); gdiPlusImageLayer.Close(); } finally { canvas.EndDrawing(); bitmap.Save(@"E:\test2.png"); }
I tried to run this piece of code to get the google map and superpose an image (i enclose my image as well) but the result of the image i store in e:\test2.png does not have the google map because the image covers the google map. (the transparency is not handled properly)
do you have an idea?
1477-MyImage.zip (4.19 KB)