ThinkGeo.com    |     Documentation    |     Premium Support

.Net Core. Screen Shot function

Dear ThinkGeo Team.

I have a web application written on .Net Core 3.0 Server.
At this moment I need a function which will draw several polygons on a global map and make a screen shot of an area with polygons.
I attached an image example I need.
map
Can it be achieved with your .Net Core SDK?

Thanks Alexander,
Yes. Since it is web application you can try with the this sample

Because it is web application you could use html2cavas to do the snapshot.

Thanks

Frank

@Frank4 thank you for the reply

It looks like I made a mistake in my first question.
I have a .Net Core server application (I called it web application what is not correct).
My application provides different APIs.
Sometimes it sends email messages where I want to attach an image similar to that one I shown previously.
The application doesn’t deal with HTML and Javascript. It is just .NET Core API server.
Is it possible somehow to get an image for such type of application?

Thanks Alexander,
I got it. I was confused before. Because I found you purchased and installed the winform and wpf edition.

Yes. Mapsuite 12 do support .Net core and .Net freamwork.
If you are using latest mapsuite desktop or wpf edition. You can find how do I sample here
https://gitlab.com/thinkgeo/public/thinkgeo-desktop-maps. You may need update the NuGet library to the latest one.
Then you could use mapView.GetSnapshot(); to do a snapshot after all layer rendered.

If you only use ThinkGeo.Core no UI involved. Here is some smaple code

  GeoImage bitmap = new GeoImage(1024, 1024);
            InMemoryFeatureLayer layer = new InMemoryFeatureLayer();
            // TODO add some shape to your InMemoryFeatureLayer  
            layer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyle.CreateSimpleLineStyle(GeoColor.FromArgb(255, 169, 195, 221), 2F, GeoColors.Black, 4F, false);
            layer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            layer.Open();
            RectangleShape extent = layer.GetBoundingBox(); // You may need get extent base on your image size and the zoomlevel, center point. 

            GeoCanvas canvas = GeoCanvas.CreateDefaultGeoCanvas();
            canvas.BeginDrawing(bitmap, extent, GeographyUnit.Meter);
            layer.Draw(canvas, new Collection<SimpleCandidate>());
            canvas.EndDrawing();
            bitmap.Save(@"d:\\test.png");

if you have multiple layers need draw. You could use the sample cavas. Just keep drawing.

Thanks

Frank

@Frank4,
Many thanks, will try

Thanks Alexander,
Go ahead let us know if you have any question.

Thanks

Frank